mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1194525 - Gecko should ignore |postResult| calls for WebActivities with no returnValue. r=fabrice,sicking
This commit is contained in:
parent
19fa673ace
commit
d00989a641
@ -36,9 +36,10 @@ ActivityRequestHandler.prototype = {
|
||||
this._window = aWindow;
|
||||
},
|
||||
|
||||
__init: function arh___init(aId, aOptions) {
|
||||
__init: function arh___init(aId, aOptions, aReturnValue) {
|
||||
this._id = aId;
|
||||
this._options = aOptions;
|
||||
this._returnValue = aReturnValue;
|
||||
},
|
||||
|
||||
get source() {
|
||||
@ -49,11 +50,16 @@ ActivityRequestHandler.prototype = {
|
||||
},
|
||||
|
||||
postResult: function arh_postResult(aResult) {
|
||||
cpmm.sendAsyncMessage("Activity:PostResult", {
|
||||
"id": this._id,
|
||||
"result": aResult
|
||||
});
|
||||
Services.obs.notifyObservers(null, "activity-success", this._id);
|
||||
if (this._returnValue) {
|
||||
cpmm.sendAsyncMessage("Activity:PostResult", {
|
||||
"id": this._id,
|
||||
"result": aResult
|
||||
});
|
||||
Services.obs.notifyObservers(null, "activity-success", this._id);
|
||||
} else {
|
||||
Cu.reportError("postResult() can't be called when 'returnValue': 'true' isn't declared in manifest.webapp");
|
||||
throw new Error("postResult() can't be called when 'returnValue': 'true' isn't declared in manifest.webapp");
|
||||
}
|
||||
},
|
||||
|
||||
postError: function arh_postError(aError) {
|
||||
|
@ -37,7 +37,10 @@ ActivityWrapper.prototype = {
|
||||
// Activity workflow.
|
||||
cpmm.sendAsyncMessage("Activity:Ready", { id: aMessage.id });
|
||||
|
||||
let handler = new aWindow.ActivityRequestHandler(aMessage.id, aMessage.payload);
|
||||
// Gecko should ignore |postResult| calls for WebActivities with no returnValue
|
||||
// We need to pass returnValue to ActivityRequestHandler constructor to then properly
|
||||
// decide if should call postResult or not
|
||||
let handler = new aWindow.ActivityRequestHandler(aMessage.id, aMessage.payload, aMessage.target.returnValue);
|
||||
|
||||
// When the activity window is closed, fire an error to notify the activity
|
||||
// caller of the situation.
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
[Pref="dom.sysmsg.enabled",
|
||||
JSImplementation="@mozilla.org/dom/activities/request-handler;1",
|
||||
ChromeConstructor(DOMString id, optional ActivityOptions options),
|
||||
ChromeConstructor(DOMString id, optional ActivityOptions options, optional boolean returnvalue),
|
||||
ChromeOnly]
|
||||
interface ActivityRequestHandler
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user