tor-browser

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

browser-main.js (3633B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
      2 * This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 // prettier-ignore
      7 // eslint-disable-next-line no-lone-blocks
      8 {
      9  Services.scriptloader.loadSubScript("chrome://browser/content/browser-init.js", this);
     10  Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
     11  Services.scriptloader.loadSubScript("chrome://browser/content/browser-captivePortal.js", this);
     12  if (AppConstants.MOZ_DATA_REPORTING) {
     13    Services.scriptloader.loadSubScript("chrome://browser/content/browser-data-submission-info-bar.js", this);
     14  }
     15  if (!AppConstants.MOZILLA_OFFICIAL) {
     16    Services.scriptloader.loadSubScript("chrome://browser/content/browser-development-helpers.js", this);
     17  }
     18  Services.scriptloader.loadSubScript("chrome://browser/content/browser-pageActions.js", this);
     19  Services.scriptloader.loadSubScript("chrome://browser/content/sidebar/browser-sidebar.js", this);
     20  Services.scriptloader.loadSubScript("chrome://browser/content/browser-customtitlebar.js", this);
     21  Services.scriptloader.loadSubScript("chrome://browser/content/browser-unified-extensions.js", this);
     22  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/drag-and-drop.js", this);
     23  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tab-stacking.js", this);
     24  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/split-view-footer.js", this);
     25  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tab.js", this);
     26  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tabbrowser.js", this);
     27  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tabgroup.js", this);
     28  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tabgroup-menu.js", this);
     29  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tabnote-menu.js", this);
     30  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tabs.js", this);
     31  Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser/tabsplitview.js", this);
     32  Services.scriptloader.loadSubScript("chrome://browser/content/places/places-menupopup.js", this);
     33  Services.scriptloader.loadSubScript("chrome://browser/content/search/autocomplete-popup.js", this);
     34  Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this);
     35  Services.scriptloader.loadSubScript("chrome://browser/content/languageNotification.js", this);
     36  if (AIWindow.isOpeningAIWindow(window)) {
     37    ChromeUtils.importESModule("chrome://browser/content/urlbar/SmartbarInput.mjs", { global: "current" });
     38  }
     39  ChromeUtils.importESModule("chrome://browser/content/urlbar/UrlbarInput.mjs", { global: "current" });
     40 }
     41 
     42 window.onload = gBrowserInit.onLoad.bind(gBrowserInit);
     43 window.onunload = gBrowserInit.onUnload.bind(gBrowserInit);
     44 window.onclose = WindowIsClosing;
     45 
     46 window.addEventListener(
     47  "MozBeforeInitialXULLayout",
     48  gBrowserInit.onBeforeInitialXULLayout.bind(gBrowserInit),
     49  { once: true }
     50 );
     51 
     52 // The listener of DOMContentLoaded must be set on window, rather than
     53 // document, because the window can go away before the event is fired.
     54 // In that case, we don't want to initialize anything, otherwise we
     55 // may be leaking things because they will never be destroyed after.
     56 window.addEventListener(
     57  "DOMContentLoaded",
     58  gBrowserInit.onDOMContentLoaded.bind(gBrowserInit),
     59  { once: true }
     60 );