mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 935379 - RemoteWebProgress should handle missing/failing progress listener methods. r=felipe
This commit is contained in:
parent
4bc333961e
commit
5d2aaf2137
@ -109,6 +109,18 @@ RemoteWebProgressManager.prototype = {
|
||||
return [deserialized, aState];
|
||||
},
|
||||
|
||||
_callProgressListeners: function(methodName, ...args) {
|
||||
for (let p of this._progressListeners) {
|
||||
if (p[methodName]) {
|
||||
try {
|
||||
p[methodName].apply(p, args);
|
||||
} catch (ex) {
|
||||
Cu.reportError("RemoteWebProgress failed to call " + methodName + ": " + ex + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage: function (aMessage) {
|
||||
let json = aMessage.json;
|
||||
let objects = aMessage.objects;
|
||||
@ -133,9 +145,7 @@ RemoteWebProgressManager.prototype = {
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "Content:StateChange":
|
||||
for (let p of this._progressListeners) {
|
||||
p.onStateChange(webProgress, request, json.stateFlags, json.status);
|
||||
}
|
||||
this._callProgressListeners("onStateChange", webProgress, request, json.stateFlags, json.status);
|
||||
break;
|
||||
|
||||
case "Content:LocationChange":
|
||||
@ -150,9 +160,7 @@ RemoteWebProgressManager.prototype = {
|
||||
this._browser._imageDocument = null;
|
||||
}
|
||||
|
||||
for (let p of this._progressListeners) {
|
||||
p.onLocationChange(webProgress, request, location);
|
||||
}
|
||||
this._callProgressListeners("onLocationChange", webProgress, request, location);
|
||||
break;
|
||||
|
||||
case "Content:SecurityChange":
|
||||
@ -166,15 +174,11 @@ RemoteWebProgressManager.prototype = {
|
||||
this._browser._securityUI._update(status, state);
|
||||
}
|
||||
|
||||
for (let p of this._progressListeners) {
|
||||
p.onSecurityChange(webProgress, request, state);
|
||||
}
|
||||
this._callProgressListeners("onSecurityChange", webProgress, request, state);
|
||||
break;
|
||||
|
||||
case "Content:StatusChange":
|
||||
for (let p of this._progressListeners) {
|
||||
p.onStatusChange(webProgress, request, json.status, json.message);
|
||||
}
|
||||
this._callProgressListeners("onStatusChange", webProgress, request, json.status, json.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user