From 3817442ad3496a782e92fe2e94beadcc5e1b1e15 Mon Sep 17 00:00:00 2001 From: David Clarke Date: Wed, 18 Jul 2012 15:38:00 -0700 Subject: [PATCH] Bug 775051 - Make sure there is a valid url before attempting to add perms for it, r=philikon --- b2g/chrome/content/shell.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index 1a51fdfd5049..6e4f14f8b9ba 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -58,14 +58,17 @@ function addPermissions(urls) { 'content-camera', 'webcontacts-manage', 'wifi-manage', 'desktop-notification', 'geolocation', 'device-storage', 'alarms' ]; + urls.forEach(function(url) { url = url.trim(); - let uri = Services.io.newURI(url, null, null); - let allow = Ci.nsIPermissionManager.ALLOW_ACTION; + if (url) { + let uri = Services.io.newURI(url, null, null); + let allow = Ci.nsIPermissionManager.ALLOW_ACTION; - permissions.forEach(function(permission) { - Services.perms.add(uri, permission, allow); - }); + permissions.forEach(function(permission) { + Services.perms.add(uri, permission, allow); + }); + } }); }