tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

reject-globalThis-modification.rst (621B)


      1 reject-globalThis-modification
      2 ==============================
      3 
      4 Reject any modification to ``globalThis`` inside the system modules.
      5 
      6 ``globalThis`` is the shared global inside the system modules, and modification
      7 on it is visible from all modules, and it shouldn't be done unless it's really
      8 necessary.
      9 
     10 Examples of incorrect code for this rule:
     11 -----------------------------------------
     12 
     13 .. code-block:: js
     14 
     15    globalThis.foo = 10;
     16    Object.defineProperty(globalThis, "bar", { value: 20});
     17    ChromeUtils.defineESModuleGetters(globalThis, {
     18      AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
     19    });