diff --git a/dom/apps/src/AppsUtils.jsm b/dom/apps/src/AppsUtils.jsm index 75949671212..8d495ac1f2d 100644 --- a/dom/apps/src/AppsUtils.jsm +++ b/dom/apps/src/AppsUtils.jsm @@ -25,13 +25,6 @@ function debug(s) { //dump("-*- AppsUtils.jsm: " + s + "\n"); } -function isAbsoluteURI(aURI) { - let foo = Services.io.newURI("http://foo", null, null); - let bar = Services.io.newURI("http://bar", null, null); - return Services.io.newURI(aURI, null, foo).prePath != foo.prePath || - Services.io.newURI(aURI, null, bar).prePath != bar.prePath; -} - this.AppsUtils = { // Clones a app, without the manifest. cloneAppObject: function cloneAppObject(aApp) { @@ -168,13 +161,21 @@ this.AppsUtils = { if (aManifest.name == undefined) return false; - // launch_path, entry_points launch paths, message hrefs, and activity hrefs can't be absolute - if (aManifest.launch_path && isAbsoluteURI(aManifest.launch_path)) + function isAbsolute(uri) { + // See bug 810551 + let foo = Services.io.newURI("http://foo", null, null); + let bar = Services.io.newURI("http://bar", null, null); + return Services.io.newURI(uri, null, foo).prePath != foo.prePath || + Services.io.newURI(uri, null, bar).prePath != bar.prePath; + } + + // launch_path and entry_points launch paths can't be absolute + if (aManifest.launch_path && isAbsolute(aManifest.launch_path)) return false; function checkAbsoluteEntryPoints(entryPoints) { for (let name in entryPoints) { - if (entryPoints[name].launch_path && isAbsoluteURI(entryPoints[name].launch_path)) { + if (entryPoints[name].launch_path && isAbsolute(entryPoints[name].launch_path)) { return true; } } @@ -190,35 +191,6 @@ this.AppsUtils = { } } - if (aManifest.activities) { - for (let activityName in aManifest.activities) { - let activity = aManifest.activities[activityName]; - if (activity.href && isAbsoluteURI(activity.href)) { - return false; - } - } - } - - // |messages| is an array of items, where each item is either a string or - // a {name: href} object. - let messages = aManifest.messages; - if (messages) { - if (!Array.isArray(messages)) { - return false; - } - for (let item of aManifest.messages) { - if (typeof item == "object") { - let keys = Object.keys(item); - if (keys.length != 1) { - return false; - } - if (isAbsoluteURI(item[keys[0]])) { - return false; - } - } - } - } - return true; }, @@ -335,6 +307,10 @@ this.AppsUtils = { return false; } + if (!dev1 && !dev2) { + return true; + } + return (dev1.name === dev2.name && dev1.url === dev2.url); } @@ -468,10 +444,6 @@ ManifestHelper.prototype = { }, resolveFromOrigin: function(aURI) { - // This should be enforced higher up, but check it here just in case. - if (!isAbsoluteURI(aURI)) { - throw new Error("Webapps.jsm: non-relative URI passed to resolveFromOrigin"); - } return this._origin.resolve(aURI); }, diff --git a/dom/apps/src/Webapps.jsm b/dom/apps/src/Webapps.jsm index 9e849ba054d..61b6454f1a9 100644 --- a/dom/apps/src/Webapps.jsm +++ b/dom/apps/src/Webapps.jsm @@ -241,7 +241,6 @@ this.DOMApplicationRegistry = { // We copy this app to DIRECTORY_NAME/$aId, and set the base path as needed. let destDir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", aId], true, true); - destDir.permissions = FileUtils.PERMS_DIRECTORY; ["application.zip", "update.webapp"] .forEach(function(aFile) { @@ -250,7 +249,6 @@ this.DOMApplicationRegistry = { file.copyTo(destDir, aFile); let newFile = destDir.clone(); newFile.append(aFile); - newFile.permissions = FileUtils.PERMS_FILE; }); app.basePath = FileUtils.getDir(DIRECTORY_NAME, ["webapps"], true, true) @@ -272,7 +270,6 @@ this.DOMApplicationRegistry = { let manifestFile = destDir.clone(); manifestFile.append("manifest.webapp"); zipReader.extract("manifest.webapp", manifestFile); - manifestFile.permissions = FileUtils.PERMS_FILE; } catch(e) { // If we are unable to extract the manifest, cleanup and remove this app. debug("Cleaning up: " + e); @@ -408,16 +405,6 @@ this.DOMApplicationRegistry = { this.installSystemApps(onAppsLoaded); else onAppsLoaded(); - - // XXX: To be removed as soon as the app:// protocol is remoted. - // See Bug 819061 - let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); - dir.initWithPath("/data"); - dir.permissions = parseInt("755", 8); - dir.append("local"); - dir.permissions = parseInt("755", 8); - dir.append("webapps"); - dir.permissions = parseInt("755", 8); #else onAppsLoaded(); #endif @@ -1540,7 +1527,6 @@ this.DOMApplicationRegistry = { appObject.localId = localId; appObject.basePath = FileUtils.getDir(DIRECTORY_NAME, ["webapps"], true, true).path; let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id], true, true); - dir.permissions = FileUtils.PERMS_DIRECTORY; let manFile = dir.clone(); manFile.append(manifestName); let jsonManifest = aData.isPackage ? app.updateManifest : app.manifest; @@ -1620,7 +1606,6 @@ this.DOMApplicationRegistry = { let zipFile = FileUtils.getFile("TmpD", ["webapps", aId, "application.zip"], true); let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", aId], true, true); zipFile.moveTo(dir, "application.zip"); - zipFile.permissions = FileUtils.PERMS_FILE; let tmpDir = FileUtils.getDir("TmpD", ["webapps", aId], true, true); try { tmpDir.remove(true);