Bug 900551 - Mochitests for settings permissions; r=bent r=ehsan
☠☠ backed out by 7c97c5f7a05e ☠ ☠
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 27 Aug 2014 21:01:30 -0700
changeset 223760 a2b6d7c84100055c0063e06f288db7d57a875092
parent 223759 ceb79fe83d15ffea7abda042a73b453e9cac93aa
child 223761 b953dd5bfdaabcad3f639ef5411fd836f10fcab7
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, ehsan
bugs900551
milestone34.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 900551 - Mochitests for settings permissions; r=bent r=ehsan
dom/events/test/test_all_synthetic_events.html
dom/settings/tests/mochitest.ini
dom/settings/tests/test_settings_basics.html
dom/settings/tests/test_settings_blobs.html
dom/settings/tests/test_settings_data_uris.html
dom/settings/tests/test_settings_events.html
dom/settings/tests/test_settings_navigator_object.html
dom/settings/tests/test_settings_onsettingchange.html
dom/settings/tests/test_settings_permissions.html
dom/tests/mochitest/general/test_interfaces.html
dom/tests/mochitest/geolocation/test_mozsettings.html
dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
dom/webidl/MozSettingsTransactionEvent.webidl
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -272,16 +272,20 @@ const kEventConstructors = {
   MozOtaStatusEvent:                         { create: function (aName, aProps) {
                                                           return new MozOtaStatusEvent(aName, aProps);
                                                        },
                                              },
   MozSettingsEvent:                          { create: function (aName, aProps) {
                                                          return new MozSettingsEvent(aName, aProps);
                                                        },
                                              },
+  MozSettingsTransactionEvent:               { create: function (aName, aProps) {
+                                                         return new MozSettingsTransactionEvent(aName, aProps);
+                                                       },
+                                             },
   MozSmsEvent:                               { create: function (aName, aProps) {
                                                          return new MozSmsEvent(aName, aProps);
                                                        },
                                              },
   MozStkCommandEvent:                        { create: function (aName, aProps) {
                                                           return new MozStkCommandEvent(aName, aProps);
                                                        },
                                              },
--- a/dom/settings/tests/mochitest.ini
+++ b/dom/settings/tests/mochitest.ini
@@ -1,9 +1,10 @@
 [DEFAULT]
 skip-if = (toolkit == 'gonk' && debug) || e10s #debug-only failure, bug 932878
 
 [test_settings_basics.html]
+[test_settings_permissions.html]
 [test_settings_blobs.html]
 [test_settings_data_uris.html]
 [test_settings_events.html]
 [test_settings_navigator_object.html]
 [test_settings_onsettingchange.html]
--- a/dom/settings/tests/test_settings_basics.html
+++ b/dom/settings/tests/test_settings_basics.html
@@ -17,23 +17,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
-  SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
 }
 
 SpecialPowers.addPermission("settings-api-read", true, document);
 SpecialPowers.addPermission("settings-api-write", true, document);
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-write", true, document);
+SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
@@ -321,43 +322,46 @@ var steps = [
     req5.onerror = onFailure;
   },
   function () {
     ok(true, "Deleting database");
     var lock = mozSettings.createLock();
     req = lock.clear();
     req.onsuccess = function () {
       ok(true, "Deleted the database");
+      next();
     };
-    req.onerror = onFailure;
+  },
+  function () {
+    var lock = mozSettings.createLock();
     req2 = lock.set(wifi);
     req2.onsuccess = function () {
       ok(true, "set done");
     }
     req2.onerror = onFailure;
 
     ok(true, "Get all settings");
     var lock2 = mozSettings.createLock();
-    req = lock2.get("*");
-    req.onsuccess = function () {
-      is(Object.keys(req.result).length, 1, "length 1");
-      check(wifi, req.result);
-      ok(true, JSON.stringify(req.result));
+    req3 = lock2.get("*");
+    req3.onsuccess = function () {
+      is(Object.keys(req3.result).length, 1, "length 1");
+      check(req3.result, wifi);
+      ok(true, JSON.stringify(req3.result));
       ok(true, "Get all settings Done");
     };
-    req.onerror = onFailure;
+    req3.onerror = onFailure;
 
-    req2 = lock2.get("net3g.apn");
-    req2.onsuccess = function () {
-      is(Object.keys(req2.result).length, 1, "length 1");
-      check(wifi, req2.result);
+    req4 = lock2.get("net3g.apn");
+    req4.onsuccess = function () {
+      is(Object.keys(req4.result).length, 1, "length 1");
+      check(wifi, req4.result);
       ok(true, "Get net3g.apn Done");
       next();
     };
-    req2.onerror = onFailure;
+    req4.onerror = onFailure;
   },
   function () {
     ok(true, "Change wifi1");
     var lock = mozSettings.createLock();
     req = lock.set(wifi2);
     req.onsuccess = function () {
       ok(true, "Set Done");
     };
@@ -464,18 +468,18 @@ var steps = [
       testObj["wifi.enabled" + i] = false;
       req5.onsuccess = function () {
         check(this.request.result, this.testObj);
         ok(true, "Get2 Done");
       }.bind({testObj: testObj, request: req5});
       req5.onerror = onFailure;
     }
 
-    var lock5 = mozSettings.createLock();
-    req6 = lock5.clear();
+    var lock6 = mozSettings.createLock();
+    req6 = lock6.clear();
     req6.onsuccess = function () {
       ok(true, "Deleted the database");
       next();
     };
     req6.onerror = onFailure;
   },
   function () {
     ok(true, "reverse Test locking");
@@ -501,23 +505,25 @@ var steps = [
 
     req = lock.get("wifi.enabled");
     req.onsuccess = function() {
       check(req.result, wifiEnabled);
       ok(true, "Test2 locking result done");
     }
     req.onerror = onFailure;
 
-    req2 = lock.clear();
+    var lock2 = mozSettings.createLock();
+    req2 = lock2.clear();
     req2.onsuccess = function () {
       ok(true, "Deleted the database");
     };
     req2.onerror = onFailure;
 
-    req3 = lock.set(wifi);
+    var lock3 = mozSettings.createLock();
+    req3 = lock3.set(wifi);
     req3.onsuccess = function () {
       ok(true, "set done");
       next();
     }
     req3.onerror = onFailure;
 
   },
   function () {
@@ -759,16 +765,44 @@ var steps = [
     req = lock.clear();
     req.onsuccess = function () {
       ok(true, "Deleted the database");
       next();
     };
     req.onerror = onFailure;
   },
   function () {
+    ok(true, "Call success callback when transaction commits");
+    var lock = mozSettings.createLock();
+    lock.onsettingstransactionsuccess = function () {
+      next();
+    };
+    req = lock.set({"setting-obj": {foo: {bar: 23}}});
+    req.onsuccess = function() {
+      req2 = lock.get("setting-obj");
+      req2.onsuccess = function(event) {
+        var result = event.target.result["setting-obj"];
+        ok(result, "Got valid result");
+        ok(typeof result == "object", "Result is object");
+        ok("foo" in result && "bar" in result.foo, "Result has properties");
+        ok(result.foo.bar == 23, "Result properties are set");
+      };
+    };
+  },
+  function() {
+    ok(true, "Clear DB");
+    var lock = mozSettings.createLock();
+    req = lock.clear();
+    req.onsuccess = function () {
+      ok(true, "Deleted the database");
+      next();
+    };
+    req.onerror = onFailure;
+  },
+  function () {
     ok(true, "all done!\n");
     SimpleTest.finish();
   }
 ];
 
 function next() {
   ok(true, "Begin!");
   if (index >= steps.length) {
--- a/dom/settings/tests/test_settings_blobs.html
+++ b/dom/settings/tests/test_settings_blobs.html
@@ -17,23 +17,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript;version=1.7">
 
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
-  SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
 }
 
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-write", true, document);
 SpecialPowers.addPermission("settings-api-read", true, document);
 SpecialPowers.addPermission("settings-api-write", true, document);
+SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_data_uris.html
+++ b/dom/settings/tests/test_settings_data_uris.html
@@ -17,23 +17,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript;version=1.7">
 
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
-  SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
 }
 
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-write", true, document);
 SpecialPowers.addPermission("settings-api-read", true, document);
 SpecialPowers.addPermission("settings-api-write", true, document);
+SpecialPowers.addPermission("settings-clear", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_events.html
+++ b/dom/settings/tests/test_settings_events.html
@@ -27,13 +27,21 @@ is(e.settingValue, 1, "Value should be 1
 e = new MozSettingsEvent("settingchanged", {settingName: "test", settingValue: {test: "test"}});
 is(e.settingName, "test", "Name should be 'test'.");
 is(e.settingValue.test, "test", "Name should be 'test'.");
 
 e = new MozSettingsEvent("settingchanged", {settingName: "a", settingValue: true});
 is(e.settingName, "a", "Name should be a.");
 is(e.settingValue, true, "Value should be true.");
 
+var e = new MozSettingsTransactionEvent("settingtransactionsuccess", {});
+ok(e, "Should have settings event!");
+is(e.error, "", "error should be null");
+
+var e = new MozSettingsTransactionEvent("settingtransactionfailure", {error: "Test error."});
+ok(e, "Should have settings event!");
+is(e.error, "Test error.", "error should be 'Test error.'");
+
 
 </script>
 </pre>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/dom/settings/tests/test_settings_navigator_object.html
+++ b/dom/settings/tests/test_settings_navigator_object.html
@@ -29,17 +29,18 @@ function testPref() {
     SimpleTest.finish();
   });
 }
 
 SpecialPowers.pushPermissions([
   {type: "settings-read", allow: 0, context: document},
   {type: "settings-write", allow: 0, context: document},
   {type: "settings-api-read", allow: 0, context: document},
-  {type: "settings-api-write", allow: 0, context: document}
+  {type: "settings-api-write", allow: 0, context: document},
+  {type: "settings-clear", allow: 0, context: document}
 ], function() {
   ise(frames[0].navigator.mozSettings, null, "navigator.mozSettings is null when the page doesn't have permissions");
   testPref();
 });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/settings/tests/test_settings_onsettingchange.html
+++ b/dom/settings/tests/test_settings_onsettingchange.html
@@ -17,23 +17,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
-  SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
 }
 
 SpecialPowers.addPermission("settings-write", true, document);
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-api-read", true, document);
 SpecialPowers.addPermission("settings-api-write", true, document);
+SpecialPowers.addPermission("settings-clear", true, document);
 
 var screenBright = {"screen.brightness": 0.7};
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
 
 function observer1(setting) {
@@ -86,18 +87,22 @@ var mozSettings = window.navigator.mozSe
 
 var steps = [
   function () {
     ok(true, "Deleting database");
     var lock = mozSettings.createLock();
     req = lock.clear();
     req.onsuccess = function () {
       ok(true, "Deleted the database");
+      next();
     };
     req.onerror = onFailure;
+  },
+  function () {
+    var lock = mozSettings.createLock();
     req2 = lock.set(screenBright);
     req2.onsuccess = function () {
       ok(true, "set done");
       navigator.mozSettings.onsettingchange = onsettingschangeWithNext;
       next();
     }
     req2.onerror = onFailure;
   },
@@ -264,26 +269,29 @@ var steps = [
     req.onerror = onFailure;
   },
   function () {
     ok(true, "Deleting database");
     var lock = mozSettings.createLock();
     req = lock.clear();
     req.onsuccess = function () {
       ok(true, "Deleted the database");
-      navigator.mozSettings.onsettingchange = onComplexSettingschangeWithNext;
+      next();
     };
     req.onerror = onFailure;
+  },
+  function () {
+    var lock = mozSettings.createLock();
+    navigator.mozSettings.onsettingchange = onComplexSettingschangeWithNext;
     req2 = navigator.mozSettings.createLock().set({'test.key': cset});
     req2.onsuccess = function () {
       ok(true, "set done");
     }
     req2.onerror = onFailure;
   },
-  
   function () {
     ok(true, "all done!\n");
     SimpleTest.finish();
   }
 ];
 
 function next() {
   ok(true, "Begin!");
new file mode 100644
--- /dev/null
+++ b/dom/settings/tests/test_settings_permissions.html
@@ -0,0 +1,203 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
+-->
+<head>
+  <title>Test for Bug {678695} Settings API</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={900551}">Mozilla Bug {900551}</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+"use strict";
+
+if (SpecialPowers.isMainProcess()) {
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
+}
+
+SpecialPowers.removePermission("settings-read", document);
+SpecialPowers.removePermission("settings-write", document);
+SpecialPowers.addPermission("settings-api-read", true, document);
+SpecialPowers.addPermission("settings-api-write", true, document);
+SpecialPowers.addPermission("settings:wallpaper.image-read", true, document);
+SpecialPowers.addPermission("settings:wallpaper.image-write", true, document);
+SpecialPowers.addPermission("settings-clear", true, document);
+
+function onUnwantedSuccess() {
+  ok(false, "onUnwantedSuccess: shouldn't get here");
+}
+
+function onFailure() {
+  ok(false, "in on Failure!");
+}
+
+const wifi  = {"wifi.enabled": false}
+const wallpaper = {"wallpaper.image": "test-image"};
+
+var combination = {
+  "wifi.enabled": false,
+  "wallpaper.image": "test-image"
+}
+
+function equals(o1, o2) {
+  var k1 = Object.keys(o1).sort();
+  var k2 = Object.keys(o2).sort();
+  if (k1.length != k2.length) return false;
+  return k1.zip(k2, function(keyPair) {
+    if(typeof o1[keyPair[0]] == typeof o2[keyPair[1]] == "object"){
+      return equals(o1[keyPair[0]], o2[keyPair[1]])
+    } else {
+      return o1[keyPair[0]] == o2[keyPair[1]];
+    }
+  }).all();
+};
+
+function observer1(setting) {
+  is(setting.settingName, "screen.brightness", "Same settingName");
+  is(setting.settingValue, "0.7", "Same settingvalue");
+};
+
+function onsettingschangeWithNext(event) {
+  is(event.settingName, "screen.brightness", "Same settingName");
+  is(event.settingValue, "0.7", "Same settingvalue");
+  next();
+};
+
+function check(o1, o2) {
+  is(JSON.stringify(o1), JSON.stringify(o2), "same");
+}
+
+var req, req2, req3, req4, req5, req6;
+var index = 0;
+
+var mozSettings = navigator.mozSettings;
+
+var steps = [
+  // Can't delete database here since that requires permissions we don't want
+  // to give the page.
+  function () {
+    ok(true, "Setting wallpaper");
+    var lock = mozSettings.createLock();
+    req = lock.set(wallpaper);
+    req.onsuccess = function () {
+      ok(true, "set done");
+    }
+    req.onerror = onFailure;
+
+    var lock2 = mozSettings.createLock();
+    req2 = lock2.get("wallpaper.image");
+    req2.onsuccess = function () {
+      is(Object.keys(req2.result).length, 1, "length 1");
+      check(wallpaper, req2.result);
+      ok(true, "Get wallpaper Done");
+      next();
+    };
+    req2.onerror = onFailure;
+  },
+  function () {
+    ok(true, "Get Wifi");
+    var lock = mozSettings.createLock();
+    req = lock.get("wifi.enabled");
+    req.onerror = function () {
+      ok(true, "get failed (expected)");
+      next();
+    }
+    req.onsuccess = onFailure;
+  },
+  function () {
+    ok(true, "Set Wifi");
+    var lock = mozSettings.createLock();
+    req = lock.set(wifi);
+    req.onerror = function () {
+      ok(true, "set failed (expected)");
+      next();
+    }
+    req.onsuccess = onFailure;
+  },
+  function () {
+    ok(true, "Set combination (1 valid 1 not valid)");
+    var lock = mozSettings.createLock();
+    req = lock.set(combination);
+    req.onerror = function () {
+      ok(true, "set failed (expected)");
+      next();
+    }
+    req.onsuccess = onFailure;
+  },
+  function () {
+    ok(true, "All requests on a failed lock should fail");
+    var lock = mozSettings.createLock();
+    lock.onsettingstransactionfailure = function (evt) {
+      ok(evt.error == "Lock failed a permissions check, all requests now failing.", "transaction failure on permissions error message correct.");
+      ok(true, "transaction failed (expected) ");
+      next();
+    };
+    lock.onsettingstransactionsuccess = onFailure;
+
+    req = lock.set(wifi);
+    req.onerror = function () {
+      ok(true, "set failed (expected)");
+    }
+    req.onsuccess = onFailure;
+    req2 = lock.get("wallpaper.image");
+    req2.onerror = function () {
+      ok(true, "get failed (expected)");
+    }
+    req2.onsuccess = onFailure;
+  },
+  function () {
+    ok(true, "Set combination (1 valid 1 not valid)");
+    var lock = mozSettings.createLock();
+    req = lock.set(combination);
+    req.onerror = function () {
+      ok(true, "set failed (expected)");
+      next();
+    }
+    req.onsuccess = onFailure;
+  },
+  function () {
+    ok(true, "Set combination (1 valid 1 not valid)");
+    var lock = mozSettings.createLock();
+    req = lock.set(combination);
+    req.onerror = function () {
+      ok(true, "set failed (expected)");
+      next();
+    }
+    req.onsuccess = onFailure;
+  },
+  function () {
+    ok(true, "all done!\n");
+    SimpleTest.finish();
+  }
+];
+
+function next() {
+  ok(true, "Begin!");
+  if (index >= steps.length) {
+    ok(false, "Shouldn't get here!");
+    return;
+  }
+  try {
+    steps[index]();
+  } catch(ex) {
+    ok(false, "Caught exception", ex);
+  }
+  index += 1;
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(next);
+</script>
+</pre>
+</body>
+</html>
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -696,16 +696,18 @@ var interfaceNamesInGlobalScope =
     {name: "mozRTCIceCandidate", pref: "media.peerconnection.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "mozRTCPeerConnection", pref: "media.peerconnection.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "mozRTCSessionDescription", pref: "media.peerconnection.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "MozSettingsEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
+    {name: "MozSettingsTransactionEvent", permission: "settings-api-read"},
+// IMPORTANT: Do not change this list without review from a DOM peer!
     "MozSmsEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "MozSmsMessage",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "MozSpeakerManager", b2g: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "MozStkCommandEvent", b2g: true, pref: "dom.icc.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
--- a/dom/tests/mochitest/geolocation/test_mozsettings.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettings.html
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 SimpleTest.waitForExplicitFinish();
 
 resume_geolocationProvider(function() {
   force_prompt(true, test1);
 });
 
 if (SpecialPowers.isMainProcess()) {
-  SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
 }
 
 function test1() {
   //This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
   SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
                                  {'type': 'settings-write', 'allow': true, 'context': document},
                                  {'type': 'settings-api-write', 'allow': true, 'context': document},
                                  {'type': 'settings-api-read', 'allow': true, 'context': document}
--- a/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 SimpleTest.waitForExplicitFinish();
 
 resume_geolocationProvider(function() {
   force_prompt(true, test1);
 });
 
 if (SpecialPowers.isMainProcess()) {
-  SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+  SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
 }
 
 function test1() {
   //This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
   SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
                                  {'type': 'settings-write', 'allow': true, 'context': document},
                                  {'type': 'settings-api-write', 'allow': true, 'context': document},
                                  {'type': 'settings-api-read', 'allow': true, 'context': document}
--- a/dom/webidl/MozSettingsTransactionEvent.webidl
+++ b/dom/webidl/MozSettingsTransactionEvent.webidl
@@ -1,15 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[Constructor(DOMString type, optional MozSettingsTransactionEventInit eventInitDict)]
+[Constructor(DOMString type, optional MozSettingsTransactionEventInit eventInitDict),
+ CheckPermissions="settings-api-read settings-api-write"]
 interface MozSettingsTransactionEvent : Event
 {
   readonly attribute DOMString? error;
 };
 
 dictionary MozSettingsTransactionEventInit : EventInit
 {
   DOMString error = "";