mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 903873 - Finish porting Web Activities to WebIDL; r=bzbarsky
This patch ports over the ActivityRequestHandler interface. Unfortunately the original design of the interface specifies that ActivityRequestHandler.source should be of type ActivityOptions which is a dictionary. This is not expressible in WebIDL, so for now we're just using the type 'object' for that.
This commit is contained in:
parent
769642980a
commit
7a1c2562be
@ -7,7 +7,6 @@
|
||||
XPIDL_SOURCES += [
|
||||
'nsIActivityProxy.idl',
|
||||
'nsIActivityUIGlue.idl',
|
||||
'nsIDOMActivityRequestHandler.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_activities'
|
||||
|
@ -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(e93c4df2-af49-4421-8d75-1237b51c555b)]
|
||||
interface nsIDOMMozActivityRequestHandler : nsISupports
|
||||
{
|
||||
void postResult(in jsval result);
|
||||
void postError(in DOMString error);
|
||||
readonly attribute jsval source;
|
||||
};
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
@ -25,30 +24,25 @@ 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._id = null;
|
||||
this._options = null;
|
||||
// system message callback. The newly created wrapper then create an
|
||||
// ActivityRequestHandler object.
|
||||
}
|
||||
|
||||
ActivityRequestHandler.prototype = {
|
||||
__exposedProps__: {
|
||||
source: "r",
|
||||
postResult: "r",
|
||||
postError: "r"
|
||||
},
|
||||
init: function arh_init(aWindow) {
|
||||
this._window = aWindow;
|
||||
},
|
||||
|
||||
__init: function arh___init(aId, aOptions) {
|
||||
this._id = aId;
|
||||
this._options = aOptions;
|
||||
},
|
||||
|
||||
get source() {
|
||||
if (this._options === null) {
|
||||
Cu.reportError("ActivityRequestHandler._options must be initialized at this point");
|
||||
}
|
||||
return this._options;
|
||||
return Cu.cloneInto(this._options, this._window);
|
||||
},
|
||||
|
||||
postResult: function arh_postResult(aResult) {
|
||||
@ -70,16 +64,8 @@ ActivityRequestHandler.prototype = {
|
||||
classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIDOMMozActivityRequestHandler
|
||||
]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
|
||||
contractID: "@mozilla.org/dom/activities/request-handler;1",
|
||||
interfaces: [Ci.nsIDOMMozActivityRequestHandler],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "Activity Request Handler"
|
||||
})
|
||||
Ci.nsIDOMGlobalPropertyInitializer
|
||||
])
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityRequestHandler]);
|
||||
|
@ -37,15 +37,7 @@ ActivityWrapper.prototype = {
|
||||
// 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.
|
||||
handler.wrappedJSObject._options = Cu.cloneInto({
|
||||
name: aMessage.payload.name,
|
||||
data: Cu.cloneInto(aMessage.payload.data, aWindow),
|
||||
}, aWindow);
|
||||
let handler = new aWindow.ActivityRequestHandler(aMessage.id, aMessage.payload);
|
||||
|
||||
// When the activity window is closed, fire an error to notify the activity
|
||||
// caller of the situation.
|
||||
|
14
dom/webidl/ActivityRequestHandler.webidl
Normal file
14
dom/webidl/ActivityRequestHandler.webidl
Normal file
@ -0,0 +1,14 @@
|
||||
/* 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/. */
|
||||
|
||||
[Pref="dom.sysmsg.enabled",
|
||||
JSImplementation="@mozilla.org/dom/activities/request-handler;1",
|
||||
ChromeConstructor(DOMString id, optional ActivityOptions options),
|
||||
ChromeOnly]
|
||||
interface ActivityRequestHandler
|
||||
{
|
||||
void postResult(any result);
|
||||
void postError(DOMString error);
|
||||
readonly attribute object source;
|
||||
};
|
@ -16,6 +16,7 @@ PREPROCESSED_WEBIDL_FILES = [
|
||||
|
||||
WEBIDL_FILES = [
|
||||
'AbstractWorker.webidl',
|
||||
'ActivityRequestHandler.webidl',
|
||||
'AnalyserNode.webidl',
|
||||
'AnimationEvent.webidl',
|
||||
'AppInfo.webidl',
|
||||
|
Loading…
Reference in New Issue
Block a user