diff --git a/xpfe/communicator/resources/content/popupManager.js b/xpfe/communicator/resources/content/popupManager.js index 28d31bd3175a..49b71d6dc6fc 100644 --- a/xpfe/communicator/resources/content/popupManager.js +++ b/xpfe/communicator/resources/content/popupManager.js @@ -350,7 +350,7 @@ function addPermission() { var host = addSiteBox.value; if (host != "") { - host = host.replace(/^\s*([-\w]*:\/*)?/, ""); // trim any leading space and scheme + host = host.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); @@ -368,6 +368,8 @@ function addPermission() { return; } + host = uri.hostPort; + if (!host) { addSiteBox.value = ""; return; diff --git a/xpfe/components/permissions/content/permissionsManager.js b/xpfe/components/permissions/content/permissionsManager.js index 28d31bd3175a..49b71d6dc6fc 100644 --- a/xpfe/components/permissions/content/permissionsManager.js +++ b/xpfe/components/permissions/content/permissionsManager.js @@ -350,7 +350,7 @@ function addPermission() { var host = addSiteBox.value; if (host != "") { - host = host.replace(/^\s*([-\w]*:\/*)?/, ""); // trim any leading space and scheme + host = host.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); @@ -368,6 +368,8 @@ function addPermission() { return; } + host = uri.hostPort; + if (!host) { addSiteBox.value = ""; return;