diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index e63d78ab0fa2..0982fde2f08b 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -543,7 +543,6 @@ @BINPATH@/components/SystemMessageManager.manifest @BINPATH@/components/Activities.manifest -@BINPATH@/components/ActivityOptions.js @BINPATH@/components/ActivityProxy.js @BINPATH@/components/ActivityRequestHandler.js @BINPATH@/components/ActivityWrapper.js diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index d9a53f9c5755..97ca8b1334ce 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -544,7 +544,6 @@ @BINPATH@/components/SystemMessageManager.manifest @BINPATH@/components/Activities.manifest -@BINPATH@/components/ActivityOptions.js @BINPATH@/components/ActivityProxy.js @BINPATH@/components/ActivityRequestHandler.js @BINPATH@/components/ActivityWrapper.js diff --git a/dom/activities/interfaces/moz.build b/dom/activities/interfaces/moz.build index 0da2d3ffed4c..02414add0341 100644 --- a/dom/activities/interfaces/moz.build +++ b/dom/activities/interfaces/moz.build @@ -7,7 +7,6 @@ XPIDL_SOURCES += [ 'nsIActivityProxy.idl', 'nsIActivityUIGlue.idl', - 'nsIDOMActivityOptions.idl', 'nsIDOMActivityRequestHandler.idl', ] diff --git a/dom/activities/interfaces/nsIActivityProxy.idl b/dom/activities/interfaces/nsIActivityProxy.idl index 680971073840..a5fa059f1e06 100644 --- a/dom/activities/interfaces/nsIActivityProxy.idl +++ b/dom/activities/interfaces/nsIActivityProxy.idl @@ -4,7 +4,6 @@ #include "nsISupports.idl" -interface nsIDOMMozActivityOptions; interface nsIDOMWindow; /** @@ -14,7 +13,7 @@ interface nsIDOMWindow; interface nsIActivityProxy : nsISupports { void startActivity(in nsISupports /* MozActivity */ activity, - in nsIDOMMozActivityOptions options, + in jsval options, in nsIDOMWindow window); void cleanup(); }; diff --git a/dom/activities/interfaces/nsIDOMActivityOptions.idl b/dom/activities/interfaces/nsIDOMActivityOptions.idl deleted file mode 100644 index 146eb43e3a3c..000000000000 --- a/dom/activities/interfaces/nsIDOMActivityOptions.idl +++ /dev/null @@ -1,13 +0,0 @@ -/* 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; -}; diff --git a/dom/activities/interfaces/nsIDOMActivityRequestHandler.idl b/dom/activities/interfaces/nsIDOMActivityRequestHandler.idl index 5cea23688dbb..4fe0ac0fe4b7 100644 --- a/dom/activities/interfaces/nsIDOMActivityRequestHandler.idl +++ b/dom/activities/interfaces/nsIDOMActivityRequestHandler.idl @@ -4,12 +4,10 @@ #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 nsIDOMMozActivityOptions source; + readonly attribute jsval source; }; diff --git a/dom/activities/src/Activities.manifest b/dom/activities/src/Activities.manifest index 1802d646327c..06b14cdc6a02 100644 --- a/dom/activities/src/Activities.manifest +++ b/dom/activities/src/Activities.manifest @@ -9,6 +9,3 @@ contract @mozilla.org/dom/system-messages/configurator/activity;1 {d2296daa-c406 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} diff --git a/dom/activities/src/Activity.cpp b/dom/activities/src/Activity.cpp index 532affd9d4cc..26344f91760e 100644 --- a/dom/activities/src/Activity.cpp +++ b/dom/activities/src/Activity.cpp @@ -4,7 +4,6 @@ #include "Activity.h" -#include "mozilla/dom/MozActivityBinding.h" #include "nsContentUtils.h" #include "nsDOMClassInfo.h" #include "nsIConsoleService.h" @@ -33,9 +32,9 @@ Activity::WrapObject(JSContext* aCx, JS::Handle aScope) nsresult Activity::Initialize(nsPIDOMWindow* aWindow, - nsIDOMMozActivityOptions* aOptions) + JSContext* aCx, + const ActivityOptions& aOptions) { - MOZ_ASSERT(aOptions); MOZ_ASSERT(aWindow); nsCOMPtr document = aWindow->GetExtantDoc(); @@ -67,7 +66,12 @@ Activity::Initialize(nsPIDOMWindow* aWindow, mProxy = do_CreateInstance("@mozilla.org/dom/activities/proxy;1", &rv); NS_ENSURE_SUCCESS(rv, rv); - mProxy->StartActivity(static_cast(this), aOptions, aWindow); + JS::Rooted optionsValue(aCx); + if (!aOptions.ToObject(aCx, JS::NullPtr(), &optionsValue)) { + return NS_ERROR_FAILURE; + } + + mProxy->StartActivity(static_cast(this), optionsValue, aWindow); return NS_OK; } diff --git a/dom/activities/src/Activity.h b/dom/activities/src/Activity.h index 679e6b5752f1..30f5fadaa571 100644 --- a/dom/activities/src/Activity.h +++ b/dom/activities/src/Activity.h @@ -7,6 +7,7 @@ #include "DOMRequest.h" #include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/MozActivityBinding.h" #include "nsIActivityProxy.h" #include "mozilla/Preferences.h" #include "nsPIDOMWindow.h" @@ -25,7 +26,8 @@ public: static already_AddRefed Constructor(const GlobalObject& aOwner, - nsIDOMMozActivityOptions* aOptions, + JSContext* aCx, + const ActivityOptions& aOptions, ErrorResult& aRv) { nsCOMPtr window = do_QueryInterface(aOwner.GetAsSupports()); @@ -35,7 +37,7 @@ public: } nsRefPtr activity = new Activity(window); - aRv = activity->Initialize(window, aOptions); + aRv = activity->Initialize(window, aCx, aOptions); return activity.forget(); } @@ -43,7 +45,8 @@ public: protected: nsresult Initialize(nsPIDOMWindow* aWindow, - nsIDOMMozActivityOptions* aOptions); + JSContext* aCx, + const ActivityOptions& aOptions); nsCOMPtr mProxy; diff --git a/dom/activities/src/ActivityOptions.js b/dom/activities/src/ActivityOptions.js deleted file mode 100644 index 6481266cb795..000000000000 --- a/dom/activities/src/ActivityOptions.js +++ /dev/null @@ -1,56 +0,0 @@ -/* 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]); diff --git a/dom/activities/src/ActivityRequestHandler.js b/dom/activities/src/ActivityRequestHandler.js index 08d081d314af..41889cf46462 100644 --- a/dom/activities/src/ActivityRequestHandler.js +++ b/dom/activities/src/ActivityRequestHandler.js @@ -31,11 +31,10 @@ function ActivityRequestHandler() { // 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 object as well as the properties of the ActivityOptions + // dictionary contained by the request handler. this._id = null; - this._options = Cc["@mozilla.org/dom/activities/options;1"] - .createInstance(Ci.nsIDOMMozActivityOptions); + this._options = null; } ActivityRequestHandler.prototype = { @@ -46,6 +45,9 @@ ActivityRequestHandler.prototype = { }, get source() { + if (this._options === null) { + Cu.reportError("ActivityRequestHandler._options must be initialized at this point"); + } return this._options; }, diff --git a/dom/activities/src/ActivityWrapper.js b/dom/activities/src/ActivityWrapper.js index fd4a7754af2e..090db49f95c5 100644 --- a/dom/activities/src/ActivityWrapper.js +++ b/dom/activities/src/ActivityWrapper.js @@ -41,10 +41,11 @@ ActivityWrapper.prototype = { .createInstance(Ci.nsIDOMMozActivityRequestHandler); handler.wrappedJSObject._id = aMessage.id; - // 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); + // options is an ActivityOptions dictionary. + handler.wrappedJSObject._options = Cu.cloneInto({ + name: aMessage.payload.name, + data: Cu.cloneInto(aMessage.payload.data, aWindow), + }, aWindow); // When the activity window is closed, fire an error to notify the activity // caller of the situation. diff --git a/dom/activities/src/moz.build b/dom/activities/src/moz.build index daefa8d379d7..8ae35d08c6e2 100644 --- a/dom/activities/src/moz.build +++ b/dom/activities/src/moz.build @@ -15,7 +15,6 @@ SOURCES += [ EXTRA_COMPONENTS += [ 'Activities.manifest', 'ActivityMessageConfigurator.js', - 'ActivityOptions.js', 'ActivityProxy.js', 'ActivityRequestHandler.js', 'ActivityWrapper.js', diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index ba274fd485d1..7717043dd281 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -1829,8 +1829,6 @@ def addExternalIface(iface, nativeType=None, headerFile=None, 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') diff --git a/dom/webidl/MozActivity.webidl b/dom/webidl/MozActivity.webidl index 512628593c50..d98eea40e430 100644 --- a/dom/webidl/MozActivity.webidl +++ b/dom/webidl/MozActivity.webidl @@ -4,9 +4,12 @@ * 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/. */ -interface ActivityOptions; +dictionary ActivityOptions { + DOMString name = ""; + any data = null; +}; [Pref="dom.sysmsg.enabled", - Constructor(ActivityOptions options)] + Constructor(optional ActivityOptions options)] interface MozActivity : DOMRequest { };