From 0d84685ed41a207bfeb4905f8cc4bf56b51e00c5 Mon Sep 17 00:00:00 2001 From: "ben%bengoodger.com" Date: Sun, 27 Feb 2005 07:12:05 +0000 Subject: [PATCH] 283694 - cannot add cookie permissions. also fix annoying exception on startup git-svn-id: svn://10.0.0.236/trunk@169926 18797224-902f-48f8-a5cc-f745e15eee43 --- .../components/preferences/permissions.js | 16 ++++++++-------- mozilla/toolkit/components/nsDefaultCLH.js | 15 +++++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/mozilla/browser/components/preferences/permissions.js b/mozilla/browser/components/preferences/permissions.js index 48e7a87a7af..7b1846dc8c9 100644 --- a/mozilla/browser/components/preferences/permissions.js +++ b/mozilla/browser/components/preferences/permissions.js @@ -83,10 +83,10 @@ var gPermissionManager = { getCellProperties: function(row,column,prop){} }, - _getCapabilityString: function (aPermission) + _getCapabilityString: function (aCapability) { var stringKey = null; - switch (aPermission.capability) { + switch (aCapability) { case nsIPermissionManager.ALLOW_ACTION: stringKey = "can"; break; @@ -100,7 +100,7 @@ var gPermissionManager = { return this._bundle.getString(stringKey); }, - addPermission: function (aPermission) + addPermission: function (aCapability) { var textbox = document.getElementById("url"); var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme @@ -117,7 +117,7 @@ var gPermissionManager = { promptservice.alert(window,title,message); } - var capabilityString = this._getCapabilityString(aPermission); + var capabilityString = this._getCapabilityString(aCapability); // check whether the permission already exists, if not, add it var exists = false; @@ -125,7 +125,7 @@ var gPermissionManager = { if (this._permissions[i].rawHost == host) { exists = true; this._permissions[i].capability = capabilityString; - this._permissions[i].perm = aPermission; + this._permissions[i].perm = aCapability; break; } } @@ -135,7 +135,7 @@ var gPermissionManager = { (host.charAt(0) == ".") ? host.substring(1,host.length) : host, this._type, capabilityString, - aPermission); + aCapability); this._permissions.push(p); this._view._rowCount = this._permissions.length; @@ -227,7 +227,7 @@ var gPermissionManager = { else if (aData == "changed") { for (var i = 0; i < this._permissions.length; ++i) { if (this._permissions[i].host == permission.host) { - this._permissions[i].capability = this._getCapabilityString(permission); + this._permissions[i].capability = this._getCapabilityString(permission.capability); break; } } @@ -331,7 +331,7 @@ var gPermissionManager = { { if (aPermission.type == this._type) { var host = aPermission.host; - var capabilityString = this._getCapabilityString(aPermission); + var capabilityString = this._getCapabilityString(aPermission.capability); var p = new Permission(host, (host.charAt(0) == ".") ? host.substring(1,host.length) : host, aPermission.type, diff --git a/mozilla/toolkit/components/nsDefaultCLH.js b/mozilla/toolkit/components/nsDefaultCLH.js index cf97a6441a0..bd74634e04b 100644 --- a/mozilla/toolkit/components/nsDefaultCLH.js +++ b/mozilla/toolkit/components/nsDefaultCLH.js @@ -77,13 +77,16 @@ var nsDefaultCLH = { var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(nsIPrefBranch); - // if the pref is missing, just let the exception fall through - var chromeURI = prefs.getCharPref("toolkit.defaultChromeURI"); + // if the pref is missing, ignore the exception + try { + var chromeURI = prefs.getCharPref("toolkit.defaultChromeURI"); - var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] - .getService(nsIWindowWatcher); - wwatch.openWindow(null, chromeURI, "_blank", - "chrome,dialog=no,all", cmdLine); + var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(nsIWindowWatcher); + wwatch.openWindow(null, chromeURI, "_blank", + "chrome,dialog=no,all", cmdLine); + } + catch (e) { } }, helpInfo : "",