tor-browser

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

no-newtab-refs-outside-newtab.rst (1526B)


      1 no-newtab-refs-outside-newtab
      2 =============================
      3 
      4 Prevents the use of ``chrome://newtab`` or ``resource://newtab`` URIs from code
      5 outside of the newtab codebase. This is because as of Firefox 142, newtab can
      6 be updated out-of-band from the rest of the browser. This linting rule aims to
      7 prevent accidental dependencies from being created against a moving newtab
      8 target. If external code _must_ depend or call into newtab code, please consult
      9 with the newtab team before adding an exception.
     10 
     11 **Allowed locations:**
     12 
     13 * ``browser/extensions/newtab/``
     14 * ``browser/components/newtab/``
     15 * ``browser/modules/AboutNewTab.sys.mjs``
     16 * ``browser/actors/AboutNewTabChild.sys.mjs``
     17 
     18 Examples of incorrect code for this rule:
     19 -----------------------------------------
     20 
     21 .. code-block:: js
     22 
     23    // In toolkit/components/places/PlacesUtils.sys.mjs:
     24    ChromeUtils.importESModule("resource://newtab/lib/TopSitesFeed.sys.mjs")
     25 
     26    // In browser/components/urlbar/UrlbarProviderTopSites.sys.mjs:
     27    const { ActivityStream } = ChromeUtils.importESModule("resource://newtab/lib/ActivityStream.sys.mjs")
     28 
     29    // In browser/base/content/browser.js:
     30    ChromeUtils.defineESModuleGetters(lazy, {
     31      "NewTabMessaging": "resource://newtab/lib/NewTabMessaging.sys.mjs"
     32    })
     33 
     34    // In browser/components/sessionstore/SessionStore.sys.mjs:
     35    Services.wm.getMostRecentWindow("chrome://newtab/content/newtab.xhtml")
     36 
     37    // In toolkit/modules/ResetProfile.sys.mjs:
     38    fetch("resource://newtab/data/content/activity-stream.bundle.js")