michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // Preload some things, in an attempt to make app startup faster. michael@0: // michael@0: // This script is run when the preallocated process starts. It is injected as michael@0: // a frame script. michael@0: michael@0: const BrowserElementIsPreloaded = true; michael@0: michael@0: (function (global) { michael@0: "use strict"; michael@0: michael@0: let Cu = Components.utils; michael@0: let Cc = Components.classes; michael@0: let Ci = Components.interfaces; michael@0: michael@0: Cu.import("resource://gre/modules/AppsServiceChild.jsm"); michael@0: Cu.import("resource://gre/modules/AppsUtils.jsm"); michael@0: Cu.import("resource://gre/modules/BrowserElementPromptService.jsm"); michael@0: Cu.import("resource://gre/modules/CSPUtils.jsm"); michael@0: Cu.import("resource://gre/modules/DOMRequestHelper.jsm"); michael@0: Cu.import("resource://gre/modules/FileUtils.jsm"); michael@0: Cu.import("resource://gre/modules/Geometry.jsm"); michael@0: Cu.import("resource://gre/modules/IndexedDBHelper.jsm"); michael@0: Cu.import("resource://gre/modules/NetUtil.jsm"); michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: Cu.import("resource://gre/modules/SettingsDB.jsm"); michael@0: Cu.import("resource://gre/modules/SettingsQueue.jsm"); michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: michael@0: Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci["nsIAppShellService"]); michael@0: Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci["nsIWindowMediator"]); michael@0: Cc["@mozilla.org/AppsService;1"].getService(Ci["nsIAppsService"]); michael@0: Cc["@mozilla.org/base/telemetry;1"].getService(Ci["nsITelemetry"]); michael@0: Cc["@mozilla.org/categorymanager;1"].getService(Ci["nsICategoryManager"]); michael@0: Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci["nsIMessageSender"]); michael@0: Cc["@mozilla.org/consoleservice;1"].getService(Ci["nsIConsoleService"]); michael@0: Cc["@mozilla.org/cookieService;1"].getService(Ci["nsICookieService"]); michael@0: Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci["nsIURIFixup"]); michael@0: Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci["nsIDOMRequestService"]); michael@0: Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci["nsIPromptService"]); michael@0: Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci["nsIWindowWatcher"]); michael@0: Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci["nsIEventListenerService"]); michael@0: Cc["@mozilla.org/focus-manager;1"].getService(Ci["nsIFocusManager"]); michael@0: Cc["@mozilla.org/intl/nslocaleservice;1"].getService(Ci["nsILocaleService"]); michael@0: Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci["nsIStringBundleService"]); michael@0: Cc["@mozilla.org/layout/content-policy;1"].getService(Ci["nsIContentPolicy"]); michael@0: Cc["@mozilla.org/message-loop;1"].getService(Ci["nsIMessageLoop"]); michael@0: Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci["mozIJSSubScriptLoader"]); michael@0: Cc["@mozilla.org/network/application-cache-service;1"].getService(Ci["nsIApplicationCacheService"]); michael@0: Cc["@mozilla.org/network/dns-service;1"].getService(Ci["nsIDNSService"]); michael@0: Cc["@mozilla.org/network/effective-tld-service;1"].getService(Ci["nsIEffectiveTLDService"]); michael@0: Cc["@mozilla.org/network/idn-service;1"].getService(Ci["nsIIDNService"]); michael@0: Cc["@mozilla.org/network/io-service;1"].getService(Ci["nsIIOService2"]); michael@0: Cc["@mozilla.org/network/mime-hdrparam;1"].getService(Ci["nsIMIMEHeaderParam"]); michael@0: Cc["@mozilla.org/network/protocol-proxy-service;1"].getService(Ci["nsIProtocolProxyService"]); michael@0: Cc["@mozilla.org/network/socket-transport-service;1"].getService(Ci["nsISocketTransportService"]); michael@0: Cc["@mozilla.org/network/stream-transport-service;1"].getService(Ci["nsIStreamTransportService"]); michael@0: Cc["@mozilla.org/network/url-parser;1?auth=maybe"].getService(Ci["nsIURLParser"]); michael@0: Cc["@mozilla.org/network/url-parser;1?auth=no"].getService(Ci["nsIURLParser"]); michael@0: Cc["@mozilla.org/network/url-parser;1?auth=yes"].getService(Ci["nsIURLParser"]); michael@0: Cc["@mozilla.org/observer-service;1"].getService(Ci["nsIObserverService"]); michael@0: Cc["@mozilla.org/permissionmanager;1"].getService(Ci["nsIPermissionManager"]); michael@0: Cc["@mozilla.org/preferences-service;1"].getService(Ci["nsIPrefBranch"]); michael@0: Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci["nsIScriptSecurityManager"]); michael@0: Cc["@mozilla.org/storage/service;1"].getService(Ci["mozIStorageService"]); michael@0: Cc["@mozilla.org/system-info;1"].getService(Ci["nsIPropertyBag2"]); michael@0: Cc["@mozilla.org/thread-manager;1"].getService(Ci["nsIThreadManager"]); michael@0: Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci["nsIAppStartup"]); michael@0: Cc["@mozilla.org/uriloader;1"].getService(Ci["nsIURILoader"]); michael@0: Cc["@mozilla.org/contentsecuritypolicy;1"].createInstance(Ci["nsIContentSecurityPolicy"]); michael@0: michael@0: /* Applications Specific Helper */ michael@0: try { michael@0: // May throw if we don't have the settings permission michael@0: navigator.mozSettings; michael@0: } catch(e) { michael@0: } michael@0: michael@0: try { michael@0: if (Services.prefs.getBoolPref("dom.sysmsg.enabled")) { michael@0: Cc["@mozilla.org/system-message-manager;1"].getService(Ci["nsIDOMNavigatorSystemMessages"]); michael@0: } michael@0: } catch(e) { michael@0: } michael@0: michael@0: try { michael@0: if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) { michael@0: Services.scriptloader.loadSubScript("chrome://global/content/forms.js", global); michael@0: } michael@0: } catch (e) { michael@0: } michael@0: michael@0: Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js", global); michael@0: Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js", global); michael@0: michael@0: Services.io.getProtocolHandler("app"); michael@0: Services.io.getProtocolHandler("default"); michael@0: michael@0: docShell.isActive = false; michael@0: docShell.createAboutBlankContentViewer(null); michael@0: michael@0: })(this);