mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 829679 - Package installation without // on the manifest URL causes webapps.json corruption r=ferjm a=tef+
This commit is contained in:
parent
6bf0ddbadd
commit
59be7f3e7a
@ -72,14 +72,28 @@ WebappsRegistry.prototype = {
|
||||
return uri.prePath;
|
||||
},
|
||||
|
||||
_validateScheme: function(aURL) {
|
||||
let scheme = Services.io.newURI(aURL, null, null).scheme;
|
||||
if (scheme != "http" && scheme != "https") {
|
||||
_validateURL: function(aURL) {
|
||||
let uri;
|
||||
let res;
|
||||
try {
|
||||
uri = Services.io.newURI(aURL, null, null);
|
||||
if (uri.schemeIs("http") || uri.schemeIs("https")) {
|
||||
res = uri.spec;
|
||||
}
|
||||
} catch(e) {
|
||||
throw new Components.Exception(
|
||||
"INVALID_URL_SCHEME: '" + scheme + "'; must be 'http' or 'https'",
|
||||
"INVALID_URL: '" + aURL, Cr.NS_ERROR_FAILURE
|
||||
);
|
||||
}
|
||||
|
||||
// The scheme is incorrect, throw an exception.
|
||||
if (!res) {
|
||||
throw new Components.Exception(
|
||||
"INVALID_URL_SCHEME: '" + uri.scheme + "'; must be 'http' or 'https'",
|
||||
Cr.NS_ERROR_FAILURE
|
||||
);
|
||||
}
|
||||
return uri.spec;
|
||||
},
|
||||
|
||||
// Checks that we run as a foreground page, and fire an error on the
|
||||
@ -105,14 +119,14 @@ WebappsRegistry.prototype = {
|
||||
// mozIDOMApplicationRegistry implementation
|
||||
|
||||
install: function(aURL, aParams) {
|
||||
let uri = this._validateURL(aURL);
|
||||
|
||||
let request = this.createRequest();
|
||||
|
||||
if (!this._ensureForeground(request)) {
|
||||
return request;
|
||||
}
|
||||
|
||||
this._validateScheme(aURL);
|
||||
|
||||
let installURL = this._window.location.href;
|
||||
let requestID = this.getRequestId(request);
|
||||
let receipts = (aParams && aParams.receipts &&
|
||||
@ -126,8 +140,8 @@ WebappsRegistry.prototype = {
|
||||
cpmm.sendAsyncMessage("Webapps:Install",
|
||||
{ app: {
|
||||
installOrigin: this._getOrigin(installURL),
|
||||
origin: this._getOrigin(aURL),
|
||||
manifestURL: aURL,
|
||||
origin: this._getOrigin(uri),
|
||||
manifestURL: uri,
|
||||
receipts: receipts,
|
||||
categories: categories
|
||||
},
|
||||
@ -184,14 +198,14 @@ WebappsRegistry.prototype = {
|
||||
// mozIDOMApplicationRegistry2 implementation
|
||||
|
||||
installPackage: function(aURL, aParams) {
|
||||
let uri = this._validateURL(aURL);
|
||||
|
||||
let request = this.createRequest();
|
||||
|
||||
if (!this._ensureForeground(request)) {
|
||||
return request;
|
||||
}
|
||||
|
||||
this._validateScheme(aURL);
|
||||
|
||||
let installURL = this._window.location.href;
|
||||
let requestID = this.getRequestId(request);
|
||||
let receipts = (aParams && aParams.receipts &&
|
||||
@ -205,8 +219,8 @@ WebappsRegistry.prototype = {
|
||||
cpmm.sendAsyncMessage("Webapps:InstallPackage",
|
||||
{ app: {
|
||||
installOrigin: this._getOrigin(installURL),
|
||||
origin: this._getOrigin(aURL),
|
||||
manifestURL: aURL,
|
||||
origin: this._getOrigin(uri),
|
||||
manifestURL: uri,
|
||||
receipts: receipts,
|
||||
categories: categories
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ try {
|
||||
SpecialPowers.setBoolPref('browser.mozApps.installer.dry_run', true);
|
||||
|
||||
// URL of the manifest of the app we want to install.
|
||||
const gManifestURL = "http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
// ID of the installed app.
|
||||
var gTestAppId = 0;
|
||||
// Cookies currently in the system.
|
||||
|
@ -112,7 +112,7 @@ var gPreviousLaunchableValue = Webapps.DOMApplicationRegistry.allAppsLaunchable;
|
||||
Webapps.DOMApplicationRegistry.allAppsLaunchable = true;
|
||||
|
||||
// URL of the manifest of the app we want to install.
|
||||
const gManifestURL = "http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
// ID of the installed app.
|
||||
var gTestAppId = 0;
|
||||
// Cookies currently in the system.
|
||||
|
@ -96,7 +96,7 @@ var gPreviousLaunchableValue = Webapps.DOMApplicationRegistry.allAppsLaunchable;
|
||||
Webapps.DOMApplicationRegistry.allAppsLaunchable = true;
|
||||
|
||||
// URL of the manifest of the app we want to install.
|
||||
const gManifestURL = "http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
// ID of the installed app.
|
||||
var gTestAppId = 0;
|
||||
|
||||
|
@ -14,7 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=783408
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=786296">Mozilla Bug 783408</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
@ -155,7 +155,7 @@ SpecialPowers.setBoolPref('browser.mozApps.installer.dry_run', true);
|
||||
permManager.addFromPrincipal(window.document.nodePrincipal, "webapps-manage",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
||||
var gManifestURL = "http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
var gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
|
||||
confirmNextInstall();
|
||||
|
||||
|
@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=786296
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=786296">Mozilla Bug 786296</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
@ -73,7 +73,7 @@ SpecialPowers.setBoolPref('browser.mozApps.installer.dry_run', true);
|
||||
permManager.addFromPrincipal(window.document.nodePrincipal, "webapps-manage",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
||||
var gManifestURL = "http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
var gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
|
||||
|
||||
confirmNextInstall();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user