Back out a2e5b6d2f31a (bug 866528) for gaia-unit bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 17 Mar 2014 22:53:54 -0700
changeset 174116 d6c4ee8615f134ad063040ff1f95c1b422f830e6
parent 174115 298b5c52b771d64d71c23160977ca428cb4e05bb
child 174117 892dd317097f18fc78c2dcbd986c77b58b2fde7d
push id26443
push userkwierso@gmail.com
push dateTue, 18 Mar 2014 21:15:18 +0000
treeherdermozilla-central@df75761307b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs866528
milestone31.0a1
backs outa2e5b6d2f31a73c3106304c8f74a7abe12e73f11
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out a2e5b6d2f31a (bug 866528) for gaia-unit bustage
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
dom/activities/interfaces/moz.build
dom/activities/interfaces/nsIActivityProxy.idl
dom/activities/interfaces/nsIDOMActivityOptions.idl
dom/activities/interfaces/nsIDOMActivityRequestHandler.idl
dom/activities/src/Activities.manifest
dom/activities/src/Activity.cpp
dom/activities/src/Activity.h
dom/activities/src/ActivityOptions.js
dom/activities/src/ActivityRequestHandler.js
dom/activities/src/ActivityWrapper.js
dom/activities/src/moz.build
dom/bindings/Bindings.conf
dom/webidl/MozActivity.webidl
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -538,16 +538,17 @@
 @BINPATH@/components/nsIDService.js
 @BINPATH@/components/Identity.manifest
 
 @BINPATH@/components/SystemMessageInternal.js
 @BINPATH@/components/SystemMessageManager.js
 @BINPATH@/components/SystemMessageManager.manifest
 
 @BINPATH@/components/Activities.manifest
+@BINPATH@/components/ActivityOptions.js
 @BINPATH@/components/ActivityProxy.js
 @BINPATH@/components/ActivityRequestHandler.js
 @BINPATH@/components/ActivityWrapper.js
 @BINPATH@/components/ActivityMessageConfigurator.js
 
 @BINPATH@/components/TCPSocket.js
 @BINPATH@/components/TCPServerSocket.js
 @BINPATH@/components/TCPSocketParentIntermediary.js
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -539,16 +539,17 @@
 @BINPATH@/components/TCPSocket.manifest
 
 #ifdef MOZ_ACTIVITIES
 @BINPATH@/components/SystemMessageInternal.js
 @BINPATH@/components/SystemMessageManager.js
 @BINPATH@/components/SystemMessageManager.manifest
 
 @BINPATH@/components/Activities.manifest
+@BINPATH@/components/ActivityOptions.js
 @BINPATH@/components/ActivityProxy.js
 @BINPATH@/components/ActivityRequestHandler.js
 @BINPATH@/components/ActivityWrapper.js
 @BINPATH@/components/ActivityMessageConfigurator.js
 #endif
 
 @BINPATH@/components/Payment.js
 @BINPATH@/components/PaymentFlowInfo.js
--- a/dom/activities/interfaces/moz.build
+++ b/dom/activities/interfaces/moz.build
@@ -2,13 +2,14 @@
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
     'nsIActivityProxy.idl',
     'nsIActivityUIGlue.idl',
+    'nsIDOMActivityOptions.idl',
     'nsIDOMActivityRequestHandler.idl',
 ]
 
 XPIDL_MODULE = 'dom_activities'
 
--- a/dom/activities/interfaces/nsIActivityProxy.idl
+++ b/dom/activities/interfaces/nsIActivityProxy.idl
@@ -1,19 +1,20 @@
 /* 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/. */
 
 #include "nsISupports.idl"
 
+interface nsIDOMMozActivityOptions;
 interface nsIDOMWindow;
 
 /**
   * Implemented by @mozilla.org/dom/activities/proxy;1
   */
 [scriptable, uuid(c7a258f7-26a6-46c6-a887-a6c936034f98)]
 interface nsIActivityProxy : nsISupports
 {
     void startActivity(in nsISupports /* MozActivity */ activity,
-                       in jsval options,
+                       in nsIDOMMozActivityOptions options,
                        in nsIDOMWindow window);
     void cleanup();
 };
new file mode 100644
--- /dev/null
+++ b/dom/activities/interfaces/nsIDOMActivityOptions.idl
@@ -0,0 +1,13 @@
+/* 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/. */
+
+#include "domstubs.idl"
+
+[scriptable, uuid(f5bf5e9b-f53f-470f-b560-0d6f4c1c98ad)]
+interface nsIDOMMozActivityOptions : nsISupports
+{
+    readonly attribute DOMString name;
+    // The |data| field can be null.
+    readonly attribute jsval data;
+};
--- a/dom/activities/interfaces/nsIDOMActivityRequestHandler.idl
+++ b/dom/activities/interfaces/nsIDOMActivityRequestHandler.idl
@@ -1,13 +1,15 @@
 /* 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/. */
 
 #include "domstubs.idl"
 
+interface nsIDOMMozActivityOptions;
+
 [scriptable, uuid(e70c4181-ea3f-4aa5-a2f7-af910dc65e45)]
 interface nsIDOMMozActivityRequestHandler : nsISupports
 {
     void postResult(in jsval result);
     void postError(in DOMString error);
-    readonly attribute jsval source;
+    readonly attribute nsIDOMMozActivityOptions source;
 };
--- a/dom/activities/src/Activities.manifest
+++ b/dom/activities/src/Activities.manifest
@@ -4,8 +4,11 @@ contract @mozilla.org/dom/activities/pro
 component {5430d6f9-32d6-4924-ba39-6b6d1b093cd6} ActivityWrapper.js
 contract @mozilla.org/dom/system-messages/wrapper/activity;1 {5430d6f9-32d6-4924-ba39-6b6d1b093cd6}
 
 component {d2296daa-c406-4c5e-b698-e5f2c1715798} ActivityMessageConfigurator.js
 contract @mozilla.org/dom/system-messages/configurator/activity;1 {d2296daa-c406-4c5e-b698-e5f2c1715798}
 
 component {9326952a-dbe3-4d81-a51f-d9c160d96d6b} ActivityRequestHandler.js
 contract @mozilla.org/dom/activities/request-handler;1 {9326952a-dbe3-4d81-a51f-d9c160d96d6b}
+
+component {ee983dbb-d5ea-4c5b-be98-10a13cac9f9d} ActivityOptions.js
+contract @mozilla.org/dom/activities/options;1 {ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}
--- a/dom/activities/src/Activity.cpp
+++ b/dom/activities/src/Activity.cpp
@@ -1,14 +1,15 @@
 /* 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/. */
 
 #include "Activity.h"
 
+#include "mozilla/dom/MozActivityBinding.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsIConsoleService.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 
 using namespace mozilla::dom;
 
@@ -27,19 +28,19 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
 /* virtual */ JSObject*
 Activity::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return MozActivityBinding::Wrap(aCx, aScope, this);
 }
 
 nsresult
 Activity::Initialize(nsPIDOMWindow* aWindow,
-                     JSContext* aCx,
-                     const ActivityOptions& aOptions)
+                     nsIDOMMozActivityOptions* aOptions)
 {
+  MOZ_ASSERT(aOptions);
   MOZ_ASSERT(aWindow);
 
   nsCOMPtr<nsIDocument> document = aWindow->GetExtantDoc();
 
   bool isActive;
   aWindow->GetDocShell()->GetIsActive(&isActive);
 
   if (!isActive &&
@@ -61,22 +62,17 @@ Activity::Initialize(nsPIDOMWindow* aWin
   }
 
   // Instantiate a JS proxy that will do the child <-> parent communication
   // with the JS implementation of the backend.
   nsresult rv;
   mProxy = do_CreateInstance("@mozilla.org/dom/activities/proxy;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  JS::Rooted<JS::Value> optionsValue(aCx);
-  if (!aOptions.ToObject(aCx, JS::NullPtr(), &optionsValue)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  mProxy->StartActivity(static_cast<nsIDOMDOMRequest*>(this), optionsValue, aWindow);
+  mProxy->StartActivity(static_cast<nsIDOMDOMRequest*>(this), aOptions, aWindow);
   return NS_OK;
 }
 
 Activity::~Activity()
 {
   if (mProxy) {
     mProxy->Cleanup();
   }
--- a/dom/activities/src/Activity.h
+++ b/dom/activities/src/Activity.h
@@ -2,17 +2,16 @@
  * 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/. */
 
 #ifndef mozilla_dom_activities_Activity_h
 #define mozilla_dom_activities_Activity_h
 
 #include "DOMRequest.h"
 #include "mozilla/dom/BindingDeclarations.h"
-#include "mozilla/dom/MozActivityBinding.h"
 #include "nsIActivityProxy.h"
 #include "mozilla/Preferences.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
 class Activity : public DOMRequest
@@ -21,37 +20,35 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   static already_AddRefed<Activity>
   Constructor(const GlobalObject& aOwner,
-              JSContext* aCx,
-              const ActivityOptions& aOptions,
+              nsIDOMMozActivityOptions* aOptions,
               ErrorResult& aRv)
   {
     nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports());
     if (!window) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return nullptr;
     }
 
     nsRefPtr<Activity> activity = new Activity(window);
-    aRv = activity->Initialize(window, aCx, aOptions);
+    aRv = activity->Initialize(window, aOptions);
     return activity.forget();
   }
 
   Activity(nsPIDOMWindow* aWindow);
 
 protected:
   nsresult Initialize(nsPIDOMWindow* aWindow,
-                      JSContext* aCx,
-                      const ActivityOptions& aOptions);
+                      nsIDOMMozActivityOptions* aOptions);
 
   nsCOMPtr<nsIActivityProxy> mProxy;
 
   ~Activity();
 };
 
 } // namespace dom
 } // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/activities/src/ActivityOptions.js
@@ -0,0 +1,56 @@
+/* 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/. */
+
+"use strict";
+ 
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+ 
+function debug(aMsg) {
+  //dump("-- ActivityOptions.js " + Date.now() + " : " + aMsg + "\n");
+}
+
+/**
+  * nsIDOMMozActivityOptions implementation.
+  */
+
+function ActivityOptions() {
+  debug("ActivityOptions");
+  this.wrappedJSObject = this;
+
+  // When a system message of type 'activity' is emitted, it forces the
+  // creation of an ActivityWrapper which in turns replace the default
+  // system message callback. The newly created wrapper then create a
+  // nsIDOMActivityRequestHandler object and fills up the properties of 
+  // this object as well as the properties of the nsIDOMActivityOptions
+  // object contains by the request handler.
+  this._name = null;
+  this._data = null;
+}
+
+ActivityOptions.prototype = {
+  get name() {
+    return this._name;
+  },
+
+  get data() {
+    return this._data;
+  },
+
+  classID: Components.ID("{ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}"),
+
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozActivityOptions]),
+
+  classInfo: XPCOMUtils.generateCI({
+    classID: Components.ID("{ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}"),
+    contractID: "@mozilla.org/dom/activities/options;1",
+    interfaces: [Ci.nsIDOMMozActivityOptions],
+    flags: Ci.nsIClassInfo.DOM_OBJECT,
+    classDescription: "Activity Options"
+  })
+}
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityOptions]);
--- a/dom/activities/src/ActivityRequestHandler.js
+++ b/dom/activities/src/ActivityRequestHandler.js
@@ -26,20 +26,21 @@ function debug(aMsg) {
 function ActivityRequestHandler() {
   debug("ActivityRequestHandler");
   this.wrappedJSObject = this;
 
   // When a system message of type 'activity' is emitted, it forces the
   // creation of an ActivityWrapper which in turns replace the default
   // system message callback. The newly created wrapper then create a
   // nsIDOMActivityRequestHandler object and fills up the properties of
-  // this object as well as the properties of the ActivityOptions
-  // dictionary contained by the request handler.
+  // this object as well as the properties of the nsIDOMActivityOptions
+  // object contains by the request handler.
   this._id = null;
-  this._options = {name: "", data: null};
+  this._options = Cc["@mozilla.org/dom/activities/options;1"]
+                    .createInstance(Ci.nsIDOMMozActivityOptions);
 }
 
 ActivityRequestHandler.prototype = {
   __exposedProps__: {
                       source: "r",
                       postResult: "r",
                       postError: "r"
                     },
--- a/dom/activities/src/ActivityWrapper.js
+++ b/dom/activities/src/ActivityWrapper.js
@@ -36,17 +36,17 @@ ActivityWrapper.prototype = {
     // ActivitiesService will be able to fire an error and complete the
     // Activity workflow.
     cpmm.sendAsyncMessage("Activity:Ready", { id: aMessage.id });
 
     let handler = Cc["@mozilla.org/dom/activities/request-handler;1"]
                     .createInstance(Ci.nsIDOMMozActivityRequestHandler);
     handler.wrappedJSObject._id = aMessage.id;
 
-    // options is an ActivityOptions dictionary.
+    // options is an nsIDOMActivityOptions object.
     var options = handler.wrappedJSObject._options;
     options.wrappedJSObject._name = aMessage.payload.name;
     options.wrappedJSObject._data = Cu.cloneInto(aMessage.payload.data, aWindow);
 
     // When the activity window is closed, fire an error to notify the activity
     // caller of the situation.
     // We don't need to check whether the activity itself already sent
     // back something since ActivitiesService.jsm takes care of that.
--- a/dom/activities/src/moz.build
+++ b/dom/activities/src/moz.build
@@ -10,16 +10,17 @@ EXPORTS.mozilla.dom += [
 
 SOURCES += [
     'Activity.cpp',
 ]
 
 EXTRA_COMPONENTS += [
     'Activities.manifest',
     'ActivityMessageConfigurator.js',
+    'ActivityOptions.js',
     'ActivityProxy.js',
     'ActivityRequestHandler.js',
     'ActivityWrapper.js',
 ]
 
 EXTRA_JS_MODULES += [
     'ActivitiesService.jsm',
     'ActivitiesServiceFilter.jsm',
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1819,16 +1819,18 @@ def addExternalIface(iface, nativeType=N
     if not nativeType is None:
         domInterface['nativeType'] = nativeType
     if not headerFile is None:
         domInterface['headerFile'] = headerFile
     domInterface['notflattened'] = notflattened
     DOMInterfaces[iface] = domInterface
 
 addExternalIface('ApplicationCache', nativeType='nsIDOMOfflineResourceList')
+addExternalIface('ActivityOptions', nativeType='nsIDOMMozActivityOptions',
+                 headerFile='nsIDOMActivityOptions.h')
 addExternalIface('Counter')
 addExternalIface('CSSRule')
 addExternalIface('mozIDOMApplication', nativeType='mozIDOMApplication', headerFile='nsIDOMApplicationRegistry.h')
 addExternalIface('CSSRuleList')
 addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
 addExternalIface('File')
 addExternalIface('HitRegionOptions', nativeType='nsISupports')
 addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')
--- a/dom/webidl/MozActivity.webidl
+++ b/dom/webidl/MozActivity.webidl
@@ -1,15 +1,12 @@
 /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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/. */
 
-dictionary ActivityOptions {
-  DOMString name = "";
-  any data = null;
-};
+interface ActivityOptions;
 
 [Pref="dom.sysmsg.enabled",
- Constructor(optional ActivityOptions options)]
+ Constructor(ActivityOptions options)]
 interface MozActivity : DOMRequest {
 };