зеркало из https://github.com/mozilla/gecko-dev.git
Backout 63643fbbde88 due to mochitest-other orange.
This commit is contained in:
Родитель
530b9fbdef
Коммит
71dba2ec8c
|
@ -80,21 +80,9 @@ 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();
|
||||
|
@ -174,8 +162,6 @@ WebappsRegistry.prototype = {
|
|||
// mozIDOMApplicationRegistry2 implementation
|
||||
|
||||
installPackage: function(aPackageURL, aParams) {
|
||||
this._validateScheme(aPackageURL);
|
||||
|
||||
let request = this.createRequest();
|
||||
let requestID = this.getRequestId(request);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ var steps = [
|
|||
invalidLaunchPath,
|
||||
invalidEntryPoint,
|
||||
invalidLocaleEntryPoint,
|
||||
fileURL,
|
||||
];
|
||||
|
||||
runAll(steps);
|
||||
|
@ -137,38 +136,5 @@ 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");
|
||||
}
|
||||
|
||||
// Get the file:/// URL of an existent file, which we will use to test that
|
||||
// attempting to install an existent file has exactly the same effect as
|
||||
// attempting to install a nonexistent file. We use the URL of the Services
|
||||
// module in the test because we use the Services module to get the URL,
|
||||
// so we know it exists.
|
||||
var { Services: Services } =
|
||||
Components.utils.import("resource://gre/modules/Services.jsm", {});
|
||||
var file =
|
||||
Services.io.newURI("resource://gre/modules/Services.jsm", null, null).
|
||||
QueryInterface(Components.interfaces.nsIFileURL).file;
|
||||
var url = Services.io.newFileURI(file).spec;
|
||||
|
||||
try {
|
||||
navigator.mozApps.install(url);
|
||||
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>
|
||||
|
|
Загрузка…
Ссылка в новой задаче