Bug 815398 - Settings: set navigator.mozSettings to null if we don't have read or write permission. r=bent
authorGregor Wagner <anygregor@gmail.com>
Mon, 26 Nov 2012 15:33:34 -0800
changeset 114159 d5cfd29609dfd09467f2dd39c53e5ecd5102ab08
parent 114158 6bc3cd4a52ecc6608b38d4e24726d40d37fab137
child 114160 40208ff7967f3a07a7bea5e3ca70bfaa1613c8a1
push id18605
push usergwagner@mozilla.com
push dateMon, 26 Nov 2012 23:33:40 +0000
treeherdermozilla-inbound@d5cfd29609df [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs815398
milestone20.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 815398 - Settings: set navigator.mozSettings to null if we don't have read or write permission. r=bent
dom/settings/SettingsManager.js
--- a/dom/settings/SettingsManager.js
+++ b/dom/settings/SettingsManager.js
@@ -337,16 +337,17 @@ SettingsManager.prototype = {
 
     let readPerm = Services.perms.testExactPermissionFromPrincipal(aWindow.document.nodePrincipal, "settings-read");
     let writePerm = Services.perms.testExactPermissionFromPrincipal(aWindow.document.nodePrincipal, "settings-write");
     this.hasReadPrivileges = readPerm == Ci.nsIPermissionManager.ALLOW_ACTION;
     this.hasWritePrivileges = writePerm == Ci.nsIPermissionManager.ALLOW_ACTION;
 
     if (!this.hasReadPrivileges && !this.hasWritePrivileges) {
       Cu.reportError("NO SETTINGS PERMISSION FOR: " + aWindow.document.nodePrincipal.origin + "\n");
+      return null;
     }
   },
 
   observe: function(aSubject, aTopic, aData) {
     debug("Topic: " + aTopic);
     if (aTopic == "inner-window-destroyed") {
       let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
       if (wId == this.innerWindowID) {