browser/metro/base/content/startui/startui-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 /* 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
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 let Cc = Components.classes;
michael@0 8 let Ci = Components.interfaces;
michael@0 9 let Cu = Components.utils;
michael@0 10 let Cr = Components.results;
michael@0 11
michael@0 12 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 13 Cu.import("resource://gre/modules/Services.jsm");
michael@0 14
michael@0 15 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
michael@0 16 "resource://gre/modules/PlacesUtils.jsm");
michael@0 17
michael@0 18 XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
michael@0 19 "resource://gre/modules/NetUtil.jsm");
michael@0 20
michael@0 21 XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
michael@0 22 "resource://gre/modules/NewTabUtils.jsm");
michael@0 23
michael@0 24 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
michael@0 25 "resource://gre/modules/Promise.jsm");
michael@0 26
michael@0 27 XPCOMUtils.defineLazyModuleGetter(this, "Task",
michael@0 28 "resource://gre/modules/Task.jsm");
michael@0 29
michael@0 30 XPCOMUtils.defineLazyModuleGetter(this, "CrossSlide",
michael@0 31 "resource:///modules/CrossSlide.jsm");
michael@0 32
michael@0 33 XPCOMUtils.defineLazyModuleGetter(this, "OS",
michael@0 34 "resource://gre/modules/osfile.jsm");
michael@0 35
michael@0 36 XPCOMUtils.defineLazyModuleGetter(this, "View",
michael@0 37 "resource:///modules/View.jsm");
michael@0 38
michael@0 39 XPCOMUtils.defineLazyServiceGetter(window, "gHistSvc",
michael@0 40 "@mozilla.org/browser/nav-history-service;1",
michael@0 41 "nsINavHistoryService",
michael@0 42 "nsIBrowserHistory");
michael@0 43
michael@0 44 let ScriptContexts = {};
michael@0 45 [
michael@0 46 ["Util", "chrome://browser/content/Util.js"],
michael@0 47 ["Site", "chrome://browser/content/Site.js"],
michael@0 48 ["StartUI", "chrome://browser/content/StartUI.js"],
michael@0 49 ["Bookmarks", "chrome://browser/content/bookmarks.js"],
michael@0 50 ["BookmarksView", "chrome://browser/content/BookmarksView.js"],
michael@0 51 ["HistoryView", "chrome://browser/content/HistoryView.js"],
michael@0 52 ["TopSitesView", "chrome://browser/content/TopSitesView.js"],
michael@0 53 ["RemoteTabsView", "chrome://browser/content/RemoteTabsView.js"],
michael@0 54 ["BookmarksStartView", "chrome://browser/content/BookmarksView.js"],
michael@0 55 ["HistoryStartView", "chrome://browser/content/HistoryView.js"],
michael@0 56 ["TopSitesStartView", "chrome://browser/content/TopSitesView.js"],
michael@0 57 ["RemoteTabsStartView", "chrome://browser/content/RemoteTabsView.js"],
michael@0 58 ["ItemPinHelper", "chrome://browser/content/helperui/ItemPinHelper.js"],
michael@0 59 ].forEach(function (aScript) {
michael@0 60 let [name, script] = aScript;
michael@0 61 XPCOMUtils.defineLazyGetter(window, name, function() {
michael@0 62 let sandbox;
michael@0 63 if (script in ScriptContexts) {
michael@0 64 sandbox = ScriptContexts[script];
michael@0 65 } else {
michael@0 66 sandbox = ScriptContexts[script] = {};
michael@0 67 Services.scriptloader.loadSubScript(script, sandbox);
michael@0 68 }
michael@0 69 return sandbox[name];
michael@0 70 });
michael@0 71 });
michael@0 72
michael@0 73 // singleton
michael@0 74 XPCOMUtils.defineLazyGetter(this, "TopSites", function() {
michael@0 75 return StartUI.chromeWin.TopSites;
michael@0 76 });
michael@0 77
michael@0 78 #ifdef MOZ_SERVICES_SYNC
michael@0 79 XPCOMUtils.defineLazyGetter(this, "Weave", function() {
michael@0 80 Components.utils.import("resource://services-sync/main.js");
michael@0 81 return Weave;
michael@0 82 });
michael@0 83 #endif

mercurial