Bug 783551 - Get tooltool running on the b2g on OS X builds. r=respindola
[gecko.git] / webapprt / Startup.jsm
blobba07d72469b79cc491401061db17ea59c005a1d9
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* This is imported by each new webapp window but is only evaluated the first
6  * time it is imported.  Put stuff here that you want to happen once on startup
7  * before the webapp is loaded.  But note that the "stuff" happens immediately
8  * the first time this module is imported.  So only put stuff here that must
9  * happen before the webapp is loaded. */
11 const EXPORTED_SYMBOLS = [];
13 const Ci = Components.interfaces;
14 const Cu = Components.utils;
16 Cu.import("resource://gre/modules/Services.jsm");
18 // Initialize DOMApplicationRegistry by importing Webapps.jsm.
19 Cu.import("resource://gre/modules/Webapps.jsm");
21 // Initialize window-independent handling of webapps- notifications.
22 Cu.import("resource://webapprt/modules/WebappsHandler.jsm");
23 WebappsHandler.init();
25 // On firstrun, set permissions to their default values.
26 if (!Services.prefs.getBoolPref("webapprt.firstrun")) {
27   Cu.import("resource://webapprt/modules/WebappRT.jsm");
28   let uri = Services.io.newURI(WebappRT.config.app.origin, null, null);
30   // Set AppCache-related permissions.
31   Services.perms.add(uri, "pin-app",
32                      Ci.nsIPermissionManager.ALLOW_ACTION);
33   Services.perms.add(uri, "offline-app",
34                      Ci.nsIPermissionManager.ALLOW_ACTION);
36   Services.perms.add(uri, "indexedDB",
37                      Ci.nsIPermissionManager.ALLOW_ACTION);
38   Services.perms.add(uri, "indexedDB-unlimited",
39                      Ci.nsIPermissionManager.ALLOW_ACTION);
41   // Now that we've set the appropriate permissions, twiddle the firstrun
42   // flag so we don't try to do so again.
43   Services.prefs.setBoolPref("webapprt.firstrun", true);