author | Fabrice Desré <fabrice@mozilla.com> |
Thu, 15 Nov 2012 16:31:06 -0800 | |
changeset 113437 | 2c2c6ddb6fe619c0748e425466e23c0f6d510154 |
parent 113436 | 31c2faaae4b64180b3926561dda571d5a8970595 |
child 113438 | 224fe2a12a04c5edb6ec7a1b9d0cad1890f8e66f |
push id | 18153 |
push user | fdesre@mozilla.com |
push date | Fri, 16 Nov 2012 00:31:14 +0000 |
treeherder | mozilla-inbound@2c2c6ddb6fe6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | myk |
bugs | 810551 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/apps/src/AppsUtils.jsm +++ b/dom/apps/src/AppsUtils.jsm @@ -153,22 +153,21 @@ this.AppsUtils = { function cbCheckAllowedOrigin(aOrigin) { return aOrigin == "*" || aOrigin == aInstallOrigin; } if (aManifest.installs_allowed_from && !aManifest.installs_allowed_from.some(cbCheckAllowedOrigin)) return false; function isAbsolute(uri) { - try { - Services.io.newURI(uri, null, null); - } catch (e if e.result == Cr.NS_ERROR_MALFORMED_URI) { - return false; - } - return true; + // 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) {
--- a/dom/tests/mochitest/webapps/apps/Makefile.in +++ b/dom/tests/mochitest/webapps/apps/Makefile.in @@ -19,16 +19,18 @@ MOCHITEST_CHROME_FILES = \ json_syntax_error.webapp^headers^ \ no_delegated_install.webapp \ no_delegated_install.webapp^headers^ \ bad_content_type.webapp \ utf8.webapp \ utf8.webapp^headers^ \ invalid_launch_path.webapp \ invalid_launch_path.webapp^headers^ \ + invalid_launch_path2.webapp \ + invalid_launch_path2.webapp^headers^ \ invalid_entry_point.webapp \ invalid_entry_point.webapp^headers^ \ invalid_locale_entry_point.webapp \ invalid_locale_entry_point.webapp^headers^ \ launch_paths.webapp \ launch_paths.webapp^headers^ \ $(NULL)
new file mode 100644 --- /dev/null +++ b/dom/tests/mochitest/webapps/apps/invalid_launch_path2.webapp @@ -0,0 +1,5 @@ +{ + "name": "Invalid Launch Path App", + "installs_allowed_from": [ "*" ], + "launch_path": "///example.com" +}
new file mode 100644 --- /dev/null +++ b/dom/tests/mochitest/webapps/apps/invalid_launch_path2.webapp^headers^ @@ -0,0 +1,1 @@ +Content-Type: application/x-web-app-manifest+json
--- a/dom/tests/mochitest/webapps/test_install_errors.xul +++ b/dom/tests/mochitest/webapps/test_install_errors.xul @@ -11,35 +11,36 @@ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> <script type="application/javascript" src="head.js"/> <!-- test results are displayed in the html:body --> <body xmlns="http://www.w3.org/1999/xhtml"> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741549" target="_blank">Mozilla Bug 741549</a> </body> -<script> +<script> var steps = [ noArgs, parseError, invalidManifest, permissionDenied, invalidContent, installPackageNotImplemented, invalidLaunchPath, + invalidLaunchPath2, invalidEntryPoint, invalidLocaleEntryPoint, fileURL, ]; runAll(steps); function noArgs(next) { - try { + try { navigator.mozApps.install(); } catch (e) { is(e.message, "Not enough arguments \[mozIDOMApplicationRegistry.install\]", "install without arguments throws exception"); next(); } } @@ -101,17 +102,27 @@ function invalidContent(next) { }; } function invalidLaunchPath(next) { var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_launch_path.webapp"; confirmNextInstall(); navigator.mozApps.install(url, null).onerror = function onInstallError() { - is(this.error.name, "INVALID_MANIFEST", "manifest missing required field"); + is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest"); + next(); + }; +} + +function invalidLaunchPath2(next) { + var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_launch_path2.webapp"; + + confirmNextInstall(); + navigator.mozApps.install(url, null).onerror = function onInstallError() { + is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest"); next(); }; } function invalidEntryPoint(next) { var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_entry_point.webapp"; confirmNextInstall();