webapprt/Startup.jsm
author Nicholas D. Matsakis <nmatsakis@mozilla.com>
Thu, 24 Jan 2013 21:12:44 -0800
changeset 129727 ace1e79d65d90f12ec5644eee5ceecce25c90649
parent 119882 5ce71981e005a52d4cb0b831ad3db9284f2fb356
permissions -rw-r--r--
Bug 825714: Refactor JS allocation routines to enable allocation on parallel threads, and move various ion fields into per-thread-data. r=billm More detailed: - A new routine JSObject::parExtendDenseArray() that permits parallel code to allocate a dense array on its own Allocator. - Create an allocation path in the GC for loading a fresh arena as needed (ArenaLists::parallelAllocate()). - Ensure that if GC is triggered during parallel execution, parallel execution is aborted and the request is deferred until parallel execution terminates. - Updates to the ForkJoin/ThreadPool so that they create their own Allocators as well as other misc API changes. - Moves some of the ion-related fields (e.g., |ionTop|) into perThreadData. - Remove out-of-date malloc tracking fields.

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

/* This is imported by each new webapp window but is only evaluated the first
 * time it is imported.  Put stuff here that you want to happen once on startup
 * before the webapp is loaded.  But note that the "stuff" happens immediately
 * the first time this module is imported.  So only put stuff here that must
 * happen before the webapp is loaded. */

this.EXPORTED_SYMBOLS = [];

const Ci = Components.interfaces;
const Cu = Components.utils;

Cu.import("resource://gre/modules/Services.jsm");

// Initialize DOMApplicationRegistry by importing Webapps.jsm.
Cu.import("resource://gre/modules/Webapps.jsm");

// Initialize window-independent handling of webapps- notifications.
Cu.import("resource://webapprt/modules/WebappsHandler.jsm");
WebappsHandler.init();

// On firstrun, set permissions to their default values.
if (!Services.prefs.getBoolPref("webapprt.firstrun")) {
  Cu.import("resource://webapprt/modules/WebappRT.jsm");
  let uri = Services.io.newURI(WebappRT.config.app.origin, null, null);

  // Set AppCache-related permissions.
  Services.perms.add(uri, "pin-app",
                     Ci.nsIPermissionManager.ALLOW_ACTION);
  Services.perms.add(uri, "offline-app",
                     Ci.nsIPermissionManager.ALLOW_ACTION);

  Services.perms.add(uri, "indexedDB",
                     Ci.nsIPermissionManager.ALLOW_ACTION);
  Services.perms.add(uri, "indexedDB-unlimited",
                     Ci.nsIPermissionManager.ALLOW_ACTION);

  // Now that we've set the appropriate permissions, twiddle the firstrun
  // flag so we don't try to do so again.
  Services.prefs.setBoolPref("webapprt.firstrun", true);
}