Bug 834618 - Catch any error thrown from resolveFromOrigin. r=fabrice
authorJulien Wajsberg <jwajsberg@mozilla.com>
Mon, 04 Feb 2013 14:59:32 +0100
changeset 130662 704a1ceb0568ec4f42991fbc91ee031f2a4ac467
parent 130661 df128dab6a05fc34a6f8d8c13ea22efbf7094e05
child 130663 cfbd58e9c576c8af82b8117fe71ba9f5a2b812f4
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs834618
milestone21.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
Bug 834618 - Catch any error thrown from resolveFromOrigin. r=fabrice
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -456,17 +456,25 @@ this.DOMApplicationRegistry = {
     let manifest = new ManifestHelper(aManifest, aApp.origin);
     let launchPath = Services.io.newURI(manifest.fullLaunchPath(aEntryPoint), null, null);
     let manifestURL = Services.io.newURI(aApp.manifestURL, null, null);
     root.messages.forEach(function registerPages(aMessage) {
       let href = launchPath;
       let messageName;
       if (typeof(aMessage) === "object" && Object.keys(aMessage).length === 1) {
         messageName = Object.keys(aMessage)[0];
-        href = Services.io.newURI(manifest.resolveFromOrigin(aMessage[messageName]), null, null);
+        let uri;
+        try {
+          uri = manifest.resolveFromOrigin(aMessage[messageName]);
+        } catch(e) {
+          debug("system message url (" + aMessage[messageName] + ") is invalid, skipping. " +
+                "Error is: " + e);
+          return;
+        }
+        href = Services.io.newURI(uri, null, null);
       } else {
         messageName = aMessage;
       }
 
       if (SystemMessagePermissionsChecker
             .isSystemMessagePermittedToRegister(messageName,
                                                 aApp.origin,
                                                 aManifest)) {
@@ -501,17 +509,27 @@ this.DOMApplicationRegistry = {
     }
 
     let manifest = new ManifestHelper(aManifest, aApp.origin);
     for (let activity in root.activities) {
       let description = root.activities[activity];
       if (!description.href) {
         description.href = manifest.launch_path;
       }
-      description.href = manifest.resolveFromOrigin(description.href);
+
+      try {
+        description.href = manifest.resolveFromOrigin(description.href);
+      } catch (e) {
+        debug("Activity href (" + description.href + ") is invalid, skipping. " +
+              "Error is: " + e);
+        continue;
+      }
+
+      debug('_createActivitiesToRegister: ' + aApp.manifestURL + ', activity ' +
+          activity + ', description.href is ' + description.href);
 
       if (aRunUpdate) {
         activitiesToRegister.push({ "manifest": aApp.manifestURL,
                                     "name": activity,
                                     "icon": manifest.iconURLForSize(128),
                                     "description": description });
       }