Explorar o código

fix: no-import-assign doesn't work in dev mode

tophf %!s(int64=2) %!d(string=hai) anos
pai
achega
6e6bab793f

+ 3 - 3
src/injected/content/cmd-run.js

@@ -1,6 +1,6 @@
 import bridge, { addHandlers, onScripts } from './bridge';
 import bridge, { addHandlers, onScripts } from './bridge';
 import { sendSetPopup } from './gm-api-content';
 import { sendSetPopup } from './gm-api-content';
-import { nextTask, sendCmd, topRenderMode } from './util';
+import { nextTask, sendCmd } from './util';
 
 
 const getPersisted = describeProperty(PageTransitionEvent[PROTO], 'persisted').get;
 const getPersisted = describeProperty(PageTransitionEvent[PROTO], 'persisted').get;
 let pending = topRenderMode === 2; // wait until reified if pre-rendered
 let pending = topRenderMode === 2; // wait until reified if pre-rendered
@@ -22,11 +22,11 @@ function onShown(evt) {
   // isTrusted is `unforgeable` per DOM spec
   // isTrusted is `unforgeable` per DOM spec
   if (evt.isTrusted) {
   if (evt.isTrusted) {
     if (!this) {
     if (!this) {
-      topRenderMode = 3; // eslint-disable-line no-import-assign
+      topRenderMode = 3; // eslint-disable-line no-global-assign
       sent = bridge[REIFY] = false;
       sent = bridge[REIFY] = false;
       resolveOnReify();
       resolveOnReify();
       report();
       report();
-      topRenderMode = 4; // eslint-disable-line no-import-assign
+      topRenderMode = 4; // eslint-disable-line no-global-assign
     } else if (evt::getPersisted()) {
     } else if (evt::getPersisted()) {
       report(0, 'bfcache');
       report(0, 'bfcache');
     }
     }

+ 2 - 0
src/injected/content/safe-globals.js

@@ -63,3 +63,5 @@ const { document } = global;
 export const { getElementsByTagName } = document;
 export const { getElementsByTagName } = document;
 export const REIFY = 'reify';
 export const REIFY = 'reify';
 export let IS_FIREFOX = !chrome.app;
 export let IS_FIREFOX = !chrome.app;
+/** @type {VMTopRenderMode} */
+export let topRenderMode = window !== top ? 0 : document.prerendering ? 2 : 1;

+ 0 - 2
src/injected/content/util.js

@@ -2,8 +2,6 @@
 import { sendMessage } from '@/common';
 import { sendMessage } from '@/common';
 
 
 export * from './util-task';
 export * from './util-task';
-/** @type {VMTopRenderMode} */
-export let topRenderMode = window !== top ? 0 : document.prerendering ? 2 : 1;
 
 
 /** When looking for documentElement, use '*' to also support XML pages
 /** When looking for documentElement, use '*' to also support XML pages
  * Note that we avoid spoofed prototype getters by using hasOwnProperty, and not using `length`
  * Note that we avoid spoofed prototype getters by using hasOwnProperty, and not using `length`

+ 1 - 1
src/injected/index.js

@@ -1,5 +1,5 @@
 import browser from '@/common/browser'; // eslint-disable-line no-restricted-imports
 import browser from '@/common/browser'; // eslint-disable-line no-restricted-imports
-import { sendCmd, topRenderMode } from './content/util';
+import { sendCmd } from './content/util';
 import { USERSCRIPT_META_INTRO } from './util';
 import { USERSCRIPT_META_INTRO } from './util';
 import './content';
 import './content';