Bug 802108 - [MozActivity] fails for OOP applications [r=gwagner]
authorFabrice Desré <fabrice@mozilla.com>
Wed, 17 Oct 2012 13:44:39 -0700
changeset 110718 6d06541f4b2705f133acb2e60ef3e7e922c3883c
parent 110717 bd5e49f6d2fa534fdc1aeb8eb778563a0cae3c95
child 110719 130f0da363c80d3e535e3188aa9c36c01f83cf4e
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersgwagner
bugs802108
milestone19.0a1
Bug 802108 - [MozActivity] fails for OOP applications [r=gwagner]
dom/activities/src/ActivityProxy.js
--- a/dom/activities/src/ActivityProxy.js
+++ b/dom/activities/src/ActivityProxy.js
@@ -6,17 +6,16 @@
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/ObjectWrapper.jsm");
-Cu.import("resource://gre/modules/Webapps.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
                                    "@mozilla.org/childprocessmessagemanager;1",
                                    "nsISyncMessageSender");
 
 function debug(aMsg) {
   //dump("-- ActivityProxy " + Date.now() + " : " + aMsg + "\n");
 }
@@ -25,16 +24,21 @@ function debug(aMsg) {
   * nsIActivityProxy implementation
   * We keep a reference to the C++ Activity object, and
   * communicate with the Message Manager to know when to
   * fire events on it.
   */
 function ActivityProxy() {
   debug("ActivityProxy");
   this.activity = null;
+  let inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
+                   .processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
+  debug("inParent: " + inParent);
+  Cu.import(inParent ? "resource://gre/modules/Webapps.jsm"
+                     : "resource://gre/modules/AppsServiceChild.jsm");
 }
 
 ActivityProxy.prototype = {
   startActivity: function actProxy_startActivity(aActivity, aOptions, aWindow) {
     debug("startActivity");
 
     this.window = aWindow;
     this.activity = aActivity;