bug 1083118 - re-enable unsafe legacy window.crypto functions by default r=bz a=lmandel ba=lmandel
authorDavid Keeler <dkeeler@mozilla.com>
Mon, 10 Nov 2014 12:43:17 -0800
changeset 226019 87fd4f56cfed
parent 226018 fea4ac1165f9
child 226020 667fd2cdd844
child 226022 7f3fa3538051
child 226024 9cd882996cbe
push id4108
push userdkeeler@mozilla.com
push date2014-11-10 21:44 +0000
treeherdermozilla-beta@87fd4f56cfed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lmandel
bugs1083118
milestone34.0
bug 1083118 - re-enable unsafe legacy window.crypto functions by default r=bz a=lmandel ba=lmandel
dom/tests/mochitest/crypto/test_no_legacy.html
modules/libpref/init/all.js
--- a/dom/tests/mochitest/crypto/test_no_legacy.html
+++ b/dom/tests/mochitest/crypto/test_no_legacy.html
@@ -4,20 +4,28 @@
   <title>Test lack of legacy window.crypto features when
          MOZ_DISABLE_CRYPTOLEGACY is set or dom.unsafe_legacy_crypto.enabled is false</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <script class="testbody" type="text/javascript">
 
-ok("crypto" in window, "crypto in window");
-ok(!("version" in window.crypto), "version not in window.crypto");
-ok(!("enableSmartCardEvents" in window.crypto),
-   "enableSmartCardEvents not in window.crypto");
-ok(!("generateCRMFRequest" in window.crypto),
-   "generateCRMFRequest not in window.crypto");
-ok(!("importUserCertificates" in window.crypto),
-   "importUserCertificates not in window.crypto");
-ok(!("signText" in window.crypto), "signText not in window.crypto");
+function test_unsafe_legacy_crypto_disabled() {
+  ok("crypto" in window, "crypto in window");
+  ok(!("version" in window.crypto), "version not in window.crypto");
+  ok(!("enableSmartCardEvents" in window.crypto),
+     "enableSmartCardEvents not in window.crypto");
+  ok(!("generateCRMFRequest" in window.crypto),
+     "generateCRMFRequest not in window.crypto");
+  ok(!("importUserCertificates" in window.crypto),
+     "importUserCertificates not in window.crypto");
+  ok(!("signText" in window.crypto), "signText not in window.crypto");
+
+  SimpleTest.finish();
+}
+
+SpecialPowers.pushPrefEnv({"set": [["dom.unsafe_legacy_crypto.enabled", false]]},
+                          test_unsafe_legacy_crypto_disabled);
+SimpleTest.waitForExplicitFinish();
 
 </script>
 </body></html>
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4290,8 +4290,10 @@ pref("dom.fetch.enabled", false);
 // it is running on a low memory platform, features that can be reliably
 // supported will be disabled. This threshold can be adjusted to suit other
 // platforms; and set to 0 to disable the low-memory check altogether.
 pref("camera.control.low_memory_thresholdMB", 404);
 #endif
 
 // UDPSocket API
 pref("dom.udpsocket.enabled", false);
+
+pref("dom.unsafe_legacy_crypto.enabled", true);