Bug 846200 - Update mochitests to use new settings-api permissions
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 20 Aug 2014 10:40:40 -0700
changeset 200591 b5d49f1885af20a700b58105042f3e09fce277b6
parent 200590 d71120161e89e70ad79d06e0f2508891c2a2cdc0
child 200592 bf7502c3239f1563069c0aa75a50d0c89152211b
push id9898
push userkmachulis@mozilla.com
push dateWed, 20 Aug 2014 17:40:56 +0000
treeherderb2g-inbound@b5d49f1885af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs846200
milestone34.0a1
Bug 846200 - Update mochitests to use new settings-api permissions
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_navigator_object.html
dom/settings/tests/test_settings_onsettingchange.html
dom/tests/mochitest/geolocation/test_mozsettings.html
dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
--- a/dom/settings/tests/test_settings_basics.html
+++ b/dom/settings/tests/test_settings_basics.html
@@ -20,16 +20,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.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);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
--- a/dom/settings/tests/test_settings_blobs.html
+++ b/dom/settings/tests/test_settings_blobs.html
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.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);
 
 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
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.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);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_navigator_object.html
+++ b/dom/settings/tests/test_settings_navigator_object.html
@@ -27,17 +27,19 @@ function testPref() {
   }, function() {
     ise(navigator.mozSettings, undefined, "navigator.mozSettings is undefined");
     SimpleTest.finish();
   });
 }
 
 SpecialPowers.pushPermissions([
   {type: "settings-read", allow: 0, context: document},
-  {type: "settings-write", 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}
 ], 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
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.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);
 
 var screenBright = {"screen.brightness": 0.7};
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
 
 function observer1(setting) {
--- a/dom/tests/mochitest/geolocation/test_mozsettings.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettings.html
@@ -26,17 +26,21 @@ resume_geolocationProvider(function() {
 });
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.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}], test2);
+  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}
+  ], test2);
 }
 
 function test2() {
   ok(navigator.geolocation, "get geolocation object");
 
   toggleGeolocationSetting(false, function() {
       ok(true, "turned off geolocation via mozSettings");
       setTimeout(function() {
--- a/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
@@ -26,17 +26,21 @@ resume_geolocationProvider(function() {
 });
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.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}], test2);
+  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}
+  ], test2);
 }
 
 var watchId;
 function test2() {
   ok(navigator.geolocation, "get geolocation object");
 
   toggleGeolocationSetting(false, function() {
       ok(true, "turned off geolocation via mozSettings");