mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 922187 - Properly catch exceptions in checkInstalled and fire the error callback on the DOM request. r=myk
This commit is contained in:
parent
3a48b28faa
commit
f7ddab0391
@ -181,10 +181,17 @@ WebappsRegistry.prototype = {
|
||||
|
||||
checkInstalled: function(aManifestURL) {
|
||||
let manifestURL = Services.io.newURI(aManifestURL, null, this._window.document.baseURIObject);
|
||||
this._window.document.nodePrincipal.checkMayLoad(manifestURL, true, false);
|
||||
|
||||
let request = this.createRequest();
|
||||
|
||||
try {
|
||||
this._window.document.nodePrincipal.checkMayLoad(manifestURL, true,
|
||||
false);
|
||||
} catch (ex) {
|
||||
Services.DOMRequest.fireErrorAsync(request, "CROSS_ORIGIN_CHECK_NOT_ALLOWED");
|
||||
return request;
|
||||
}
|
||||
|
||||
this.addMessageListeners("Webapps:CheckInstalled:Return:OK");
|
||||
cpmm.sendAsyncMessage("Webapps:CheckInstalled", { origin: this._getOrigin(this._window.location.href),
|
||||
manifestURL: manifestURL.spec,
|
||||
|
@ -34,11 +34,16 @@
|
||||
break;
|
||||
|
||||
case "checkInstalledWrong":
|
||||
try {
|
||||
navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
|
||||
var request = navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
|
||||
request.onsuccess = function() {
|
||||
finish(false);
|
||||
} catch (e) {
|
||||
finish(true);
|
||||
}
|
||||
request.onerror = function() {
|
||||
if (this.error.name == "CROSS_ORIGIN_CHECK_NOT_ALLOWED") {
|
||||
finish(true);
|
||||
} else {
|
||||
finish(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user