dom/ipc/preload.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 // Preload some things, in an attempt to make app startup faster.
michael@0 6 //
michael@0 7 // This script is run when the preallocated process starts. It is injected as
michael@0 8 // a frame script.
michael@0 9
michael@0 10 const BrowserElementIsPreloaded = true;
michael@0 11
michael@0 12 (function (global) {
michael@0 13 "use strict";
michael@0 14
michael@0 15 let Cu = Components.utils;
michael@0 16 let Cc = Components.classes;
michael@0 17 let Ci = Components.interfaces;
michael@0 18
michael@0 19 Cu.import("resource://gre/modules/AppsServiceChild.jsm");
michael@0 20 Cu.import("resource://gre/modules/AppsUtils.jsm");
michael@0 21 Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
michael@0 22 Cu.import("resource://gre/modules/CSPUtils.jsm");
michael@0 23 Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
michael@0 24 Cu.import("resource://gre/modules/FileUtils.jsm");
michael@0 25 Cu.import("resource://gre/modules/Geometry.jsm");
michael@0 26 Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
michael@0 27 Cu.import("resource://gre/modules/NetUtil.jsm");
michael@0 28 Cu.import("resource://gre/modules/Services.jsm");
michael@0 29 Cu.import("resource://gre/modules/SettingsDB.jsm");
michael@0 30 Cu.import("resource://gre/modules/SettingsQueue.jsm");
michael@0 31 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 32
michael@0 33 Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci["nsIAppShellService"]);
michael@0 34 Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci["nsIWindowMediator"]);
michael@0 35 Cc["@mozilla.org/AppsService;1"].getService(Ci["nsIAppsService"]);
michael@0 36 Cc["@mozilla.org/base/telemetry;1"].getService(Ci["nsITelemetry"]);
michael@0 37 Cc["@mozilla.org/categorymanager;1"].getService(Ci["nsICategoryManager"]);
michael@0 38 Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci["nsIMessageSender"]);
michael@0 39 Cc["@mozilla.org/consoleservice;1"].getService(Ci["nsIConsoleService"]);
michael@0 40 Cc["@mozilla.org/cookieService;1"].getService(Ci["nsICookieService"]);
michael@0 41 Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci["nsIURIFixup"]);
michael@0 42 Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci["nsIDOMRequestService"]);
michael@0 43 Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci["nsIPromptService"]);
michael@0 44 Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci["nsIWindowWatcher"]);
michael@0 45 Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci["nsIEventListenerService"]);
michael@0 46 Cc["@mozilla.org/focus-manager;1"].getService(Ci["nsIFocusManager"]);
michael@0 47 Cc["@mozilla.org/intl/nslocaleservice;1"].getService(Ci["nsILocaleService"]);
michael@0 48 Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci["nsIStringBundleService"]);
michael@0 49 Cc["@mozilla.org/layout/content-policy;1"].getService(Ci["nsIContentPolicy"]);
michael@0 50 Cc["@mozilla.org/message-loop;1"].getService(Ci["nsIMessageLoop"]);
michael@0 51 Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci["mozIJSSubScriptLoader"]);
michael@0 52 Cc["@mozilla.org/network/application-cache-service;1"].getService(Ci["nsIApplicationCacheService"]);
michael@0 53 Cc["@mozilla.org/network/dns-service;1"].getService(Ci["nsIDNSService"]);
michael@0 54 Cc["@mozilla.org/network/effective-tld-service;1"].getService(Ci["nsIEffectiveTLDService"]);
michael@0 55 Cc["@mozilla.org/network/idn-service;1"].getService(Ci["nsIIDNService"]);
michael@0 56 Cc["@mozilla.org/network/io-service;1"].getService(Ci["nsIIOService2"]);
michael@0 57 Cc["@mozilla.org/network/mime-hdrparam;1"].getService(Ci["nsIMIMEHeaderParam"]);
michael@0 58 Cc["@mozilla.org/network/protocol-proxy-service;1"].getService(Ci["nsIProtocolProxyService"]);
michael@0 59 Cc["@mozilla.org/network/socket-transport-service;1"].getService(Ci["nsISocketTransportService"]);
michael@0 60 Cc["@mozilla.org/network/stream-transport-service;1"].getService(Ci["nsIStreamTransportService"]);
michael@0 61 Cc["@mozilla.org/network/url-parser;1?auth=maybe"].getService(Ci["nsIURLParser"]);
michael@0 62 Cc["@mozilla.org/network/url-parser;1?auth=no"].getService(Ci["nsIURLParser"]);
michael@0 63 Cc["@mozilla.org/network/url-parser;1?auth=yes"].getService(Ci["nsIURLParser"]);
michael@0 64 Cc["@mozilla.org/observer-service;1"].getService(Ci["nsIObserverService"]);
michael@0 65 Cc["@mozilla.org/permissionmanager;1"].getService(Ci["nsIPermissionManager"]);
michael@0 66 Cc["@mozilla.org/preferences-service;1"].getService(Ci["nsIPrefBranch"]);
michael@0 67 Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci["nsIScriptSecurityManager"]);
michael@0 68 Cc["@mozilla.org/storage/service;1"].getService(Ci["mozIStorageService"]);
michael@0 69 Cc["@mozilla.org/system-info;1"].getService(Ci["nsIPropertyBag2"]);
michael@0 70 Cc["@mozilla.org/thread-manager;1"].getService(Ci["nsIThreadManager"]);
michael@0 71 Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci["nsIAppStartup"]);
michael@0 72 Cc["@mozilla.org/uriloader;1"].getService(Ci["nsIURILoader"]);
michael@0 73 Cc["@mozilla.org/contentsecuritypolicy;1"].createInstance(Ci["nsIContentSecurityPolicy"]);
michael@0 74
michael@0 75 /* Applications Specific Helper */
michael@0 76 try {
michael@0 77 // May throw if we don't have the settings permission
michael@0 78 navigator.mozSettings;
michael@0 79 } catch(e) {
michael@0 80 }
michael@0 81
michael@0 82 try {
michael@0 83 if (Services.prefs.getBoolPref("dom.sysmsg.enabled")) {
michael@0 84 Cc["@mozilla.org/system-message-manager;1"].getService(Ci["nsIDOMNavigatorSystemMessages"]);
michael@0 85 }
michael@0 86 } catch(e) {
michael@0 87 }
michael@0 88
michael@0 89 try {
michael@0 90 if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
michael@0 91 Services.scriptloader.loadSubScript("chrome://global/content/forms.js", global);
michael@0 92 }
michael@0 93 } catch (e) {
michael@0 94 }
michael@0 95
michael@0 96 Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js", global);
michael@0 97 Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js", global);
michael@0 98
michael@0 99 Services.io.getProtocolHandler("app");
michael@0 100 Services.io.getProtocolHandler("default");
michael@0 101
michael@0 102 docShell.isActive = false;
michael@0 103 docShell.createAboutBlankContentViewer(null);
michael@0 104
michael@0 105 })(this);

mercurial