mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 791943. r=fabrice
This commit is contained in:
parent
597c61b068
commit
159114ff49
@ -80,9 +80,21 @@ WebappsRegistry.prototype = {
|
||||
return uri.prePath;
|
||||
},
|
||||
|
||||
_validateScheme: function(aURL) {
|
||||
let scheme = Services.io.newURI(aURL, null, null).scheme;
|
||||
if (scheme != "http" && scheme != "https") {
|
||||
throw new Components.Exception(
|
||||
"INVALID_URL_SCHEME: '" + scheme + "'; must be 'http' or 'https'",
|
||||
Cr.NS_ERROR_FAILURE
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// mozIDOMApplicationRegistry implementation
|
||||
|
||||
install: function(aURL, aParams) {
|
||||
this._validateScheme(aURL);
|
||||
|
||||
let installURL = this._window.location.href;
|
||||
let installOrigin = this._getOrigin(installURL);
|
||||
let request = this.createRequest();
|
||||
@ -162,6 +174,8 @@ WebappsRegistry.prototype = {
|
||||
// mozIDOMApplicationRegistry2 implementation
|
||||
|
||||
installPackage: function(aPackageURL, aParams) {
|
||||
this._validateScheme(aPackageURL);
|
||||
|
||||
let request = this.createRequest();
|
||||
let requestID = this.getRequestId(request);
|
||||
|
||||
|
@ -28,6 +28,7 @@ var steps = [
|
||||
invalidLaunchPath,
|
||||
invalidEntryPoint,
|
||||
invalidLocaleEntryPoint,
|
||||
fileURL,
|
||||
];
|
||||
|
||||
runAll(steps);
|
||||
@ -136,5 +137,26 @@ function installPackageNotImplemented(next) {
|
||||
next();
|
||||
}
|
||||
|
||||
function fileURL(next) {
|
||||
try {
|
||||
navigator.mozApps.install("file:///nonexistent");
|
||||
ok(false,
|
||||
"attempt to install nonexistent file: URL doesn't throw exception");
|
||||
} catch(ex) {
|
||||
is(ex.message, "INVALID_URL_SCHEME: 'file'; must be 'http' or 'https'",
|
||||
"attempt to install nonexistent file: URL throws exception");
|
||||
}
|
||||
|
||||
try {
|
||||
navigator.mozApps.install("file:///");
|
||||
ok(false, "attempt to install existent file: URL doesn't throw exception");
|
||||
} catch(ex) {
|
||||
is(ex.message, "INVALID_URL_SCHEME: 'file'; must be 'http' or 'https'",
|
||||
"attempt to install existent file: URL throws exception");
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
</script>
|
||||
</window>
|
||||
|
Loading…
Reference in New Issue
Block a user