browser/metro/base/content/browser-scripts.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 7 Cu.import("resource://gre/modules/Services.jsm");
michael@0 8
michael@0 9 /*
michael@0 10 * JS modules
michael@0 11 */
michael@0 12
michael@0 13 XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
michael@0 14 "resource://gre/modules/Downloads.jsm");
michael@0 15
michael@0 16 XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
michael@0 17 "resource://gre/modules/FormHistory.jsm");
michael@0 18
michael@0 19 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
michael@0 20 "resource://gre/modules/FileUtils.jsm");
michael@0 21
michael@0 22 XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
michael@0 23 "resource://gre/modules/PageThumbs.jsm");
michael@0 24
michael@0 25 XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
michael@0 26 "resource://gre/modules/PluralForm.jsm");
michael@0 27
michael@0 28 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
michael@0 29 "resource://gre/modules/PlacesUtils.jsm");
michael@0 30
michael@0 31 XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
michael@0 32 "resource://gre/modules/NetUtil.jsm");
michael@0 33
michael@0 34 XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils",
michael@0 35 "resource://gre/modules/DownloadUtils.jsm");
michael@0 36
michael@0 37 XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
michael@0 38 "resource://gre/modules/NewTabUtils.jsm");
michael@0 39
michael@0 40 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
michael@0 41 "resource://gre/modules/Promise.jsm");
michael@0 42
michael@0 43 XPCOMUtils.defineLazyModuleGetter(this, "ColorUtils",
michael@0 44 "resource:///modules/colorUtils.jsm");
michael@0 45
michael@0 46 #ifdef NIGHTLY_BUILD
michael@0 47 XPCOMUtils.defineLazyModuleGetter(this, "ShumwayUtils",
michael@0 48 "resource://shumway/ShumwayUtils.jsm");
michael@0 49
michael@0 50 XPCOMUtils.defineLazyModuleGetter(this, "PdfJs",
michael@0 51 "resource://pdf.js/PdfJs.jsm");
michael@0 52 #endif
michael@0 53
michael@0 54 XPCOMUtils.defineLazyModuleGetter(this, "Task",
michael@0 55 "resource://gre/modules/Task.jsm");
michael@0 56
michael@0 57 XPCOMUtils.defineLazyModuleGetter(this, "OS",
michael@0 58 "resource://gre/modules/osfile.jsm");
michael@0 59
michael@0 60 XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
michael@0 61 "resource://gre/modules/UITelemetry.jsm");
michael@0 62
michael@0 63 #ifdef MOZ_UPDATER
michael@0 64 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
michael@0 65 "resource://gre/modules/AddonManager.jsm");
michael@0 66 #endif
michael@0 67
michael@0 68 /*
michael@0 69 * Services
michael@0 70 */
michael@0 71
michael@0 72 XPCOMUtils.defineLazyServiceGetter(this, "StyleSheetSvc",
michael@0 73 "@mozilla.org/content/style-sheet-service;1",
michael@0 74 "nsIStyleSheetService");
michael@0 75 XPCOMUtils.defineLazyServiceGetter(window, "gHistSvc",
michael@0 76 "@mozilla.org/browser/nav-history-service;1",
michael@0 77 "nsINavHistoryService",
michael@0 78 "nsIBrowserHistory");
michael@0 79 XPCOMUtils.defineLazyServiceGetter(window, "gURIFixup",
michael@0 80 "@mozilla.org/docshell/urifixup;1",
michael@0 81 "nsIURIFixup");
michael@0 82 XPCOMUtils.defineLazyServiceGetter(window, "gFaviconService",
michael@0 83 "@mozilla.org/browser/favicon-service;1",
michael@0 84 "nsIFaviconService");
michael@0 85 XPCOMUtils.defineLazyServiceGetter(window, "gFocusManager",
michael@0 86 "@mozilla.org/focus-manager;1",
michael@0 87 "nsIFocusManager");
michael@0 88 XPCOMUtils.defineLazyServiceGetter(window, "gEventListenerService",
michael@0 89 "@mozilla.org/eventlistenerservice;1",
michael@0 90 "nsIEventListenerService");
michael@0 91 #ifdef MOZ_CRASHREPORTER
michael@0 92 XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
michael@0 93 "@mozilla.org/xre/app-info;1",
michael@0 94 "nsICrashReporter");
michael@0 95 #endif
michael@0 96
michael@0 97 /*
michael@0 98 * window.Rect is used by
michael@0 99 * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-Rect
michael@0 100 * so it is not possible to set a lazy getter for Geometry.jsm.
michael@0 101 */
michael@0 102 Cu.import("resource://gre/modules/Geometry.jsm");
michael@0 103 /*
michael@0 104 * Browser scripts
michael@0 105 */
michael@0 106 let ScriptContexts = {};
michael@0 107 [
michael@0 108 ["ContentAreaObserver", "chrome://browser/content/ContentAreaObserver.js"],
michael@0 109 ["WebProgress", "chrome://browser/content/WebProgress.js"],
michael@0 110 ["FindHelperUI", "chrome://browser/content/helperui/FindHelperUI.js"],
michael@0 111 ["FormHelperUI", "chrome://browser/content/helperui/FormHelperUI.js"],
michael@0 112 ["BrowserTouchHandler", "chrome://browser/content/BrowserTouchHandler.js"],
michael@0 113 ["AlertsHelper", "chrome://browser/content/helperui/AlertsHelper.js"],
michael@0 114 ["AutofillMenuUI", "chrome://browser/content/helperui/MenuUI.js"],
michael@0 115 ["ContextMenuUI", "chrome://browser/content/helperui/MenuUI.js"],
michael@0 116 ["MenuControlUI", "chrome://browser/content/helperui/MenuUI.js"],
michael@0 117 ["MenuPopup", "chrome://browser/content/helperui/MenuUI.js"],
michael@0 118 ["IndexedDB", "chrome://browser/content/helperui/IndexedDB.js"],
michael@0 119 ["OfflineApps", "chrome://browser/content/helperui/OfflineApps.js"],
michael@0 120 ["SelectHelperUI", "chrome://browser/content/helperui/SelectHelperUI.js"],
michael@0 121 ["SelectionHelperUI", "chrome://browser/content/helperui/SelectionHelperUI.js"],
michael@0 122 ["SelectionPrototype", "chrome://browser/content/library/SelectionPrototype.js"],
michael@0 123 ["ChromeSelectionHandler", "chrome://browser/content/helperui/ChromeSelectionHandler.js"],
michael@0 124 ["CommandUpdater", "chrome://browser/content/commandUtil.js"],
michael@0 125 ["ContextCommands", "chrome://browser/content/ContextCommands.js"],
michael@0 126 ["Bookmarks", "chrome://browser/content/bookmarks.js"],
michael@0 127 ["MetroDownloadsView", "chrome://browser/content/downloads.js"],
michael@0 128 ["ConsolePanelView", "chrome://browser/content/console.js"],
michael@0 129 ["Site", "chrome://browser/content/Site.js"],
michael@0 130 ["TopSites", "chrome://browser/content/TopSites.js"],
michael@0 131 ["Sanitizer", "chrome://browser/content/sanitize.js"],
michael@0 132 ["SanitizeUI", "chrome://browser/content/sanitizeUI.js"],
michael@0 133 ["SSLExceptions", "chrome://browser/content/exceptions.js"],
michael@0 134 ["ItemPinHelper", "chrome://browser/content/helperui/ItemPinHelper.js"],
michael@0 135 ["NavButtonSlider", "chrome://browser/content/NavButtonSlider.js"],
michael@0 136 ["ContextUI", "chrome://browser/content/ContextUI.js"],
michael@0 137 ["FlyoutPanelsUI", "chrome://browser/content/flyoutpanels/FlyoutPanelsUI.js"],
michael@0 138 ["SettingsCharm", "chrome://browser/content/flyoutpanels/SettingsCharm.js"],
michael@0 139 ["APZCObserver", "chrome://browser/content/apzc.js"],
michael@0 140 ].forEach(function (aScript) {
michael@0 141 let [name, script] = aScript;
michael@0 142 XPCOMUtils.defineLazyGetter(window, name, function() {
michael@0 143 let sandbox;
michael@0 144 if (script in ScriptContexts) {
michael@0 145 sandbox = ScriptContexts[script];
michael@0 146 } else {
michael@0 147 sandbox = ScriptContexts[script] = {};
michael@0 148 Services.scriptloader.loadSubScript(script, sandbox);
michael@0 149 }
michael@0 150 return sandbox[name];
michael@0 151 });
michael@0 152 });
michael@0 153 #ifdef MOZ_SERVICES_SYNC
michael@0 154 XPCOMUtils.defineLazyGetter(this, "Weave", function() {
michael@0 155 Components.utils.import("resource://services-sync/main.js");
michael@0 156 return Weave;
michael@0 157 });
michael@0 158 #endif
michael@0 159
michael@0 160 /*
michael@0 161 * Delay load some global scripts using a custom namespace
michael@0 162 */
michael@0 163 XPCOMUtils.defineLazyGetter(this, "GlobalOverlay", function() {
michael@0 164 let GlobalOverlay = {};
michael@0 165 Services.scriptloader.loadSubScript("chrome://global/content/globalOverlay.js", GlobalOverlay);
michael@0 166 return GlobalOverlay;
michael@0 167 });
michael@0 168
michael@0 169 XPCOMUtils.defineLazyGetter(this, "ContentAreaUtils", function() {
michael@0 170 let ContentAreaUtils = {};
michael@0 171 Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", ContentAreaUtils);
michael@0 172 return ContentAreaUtils;
michael@0 173 });

mercurial