Bug 1330138 - Differentiate prefs for u2f and webauthn apis; r=jcj r=baku
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 11 Jan 2017 14:09:03 -0800
changeset 375235 c582598b2065c9a8d588d5ed6ad6cfff62c8bb9a
parent 375234 9f3cdeb82990d0d2eb1d6ada02e958bfe4e43ecf
child 375236 a8d2fc52fdeec706da43fd2ae824a03a462fce82
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcj, baku
bugs1330138
milestone53.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 1330138 - Differentiate prefs for u2f and webauthn apis; r=jcj r=baku MozReview-Commit-ID: EUpleNqjFKQ
dom/webauthn/WebAuthentication.cpp
dom/webauthn/tests/test_webauthn_get_assertion.html
dom/webauthn/tests/test_webauthn_loopback.html
dom/webauthn/tests/test_webauthn_make_credential.html
dom/webauthn/tests/test_webauthn_no_token.html
dom/webauthn/tests/test_webauthn_sameorigin.html
dom/webidl/Navigator.webidl
netwerk/base/security-prefs.js
--- a/dom/webauthn/WebAuthentication.cpp
+++ b/dom/webauthn/WebAuthentication.cpp
@@ -8,18 +8,18 @@
 #include "mozilla/dom/WebAuthnAssertion.h"
 #include "mozilla/dom/WebAuthnAttestation.h"
 
 #include "mozilla/dom/Promise.h"
 #include "nsICryptoHash.h"
 #include "pkix/Input.h"
 #include "pkixutil.h"
 
-#define PREF_U2F_SOFTTOKEN_ENABLED "security.webauth.u2f_enable_softtoken"
-#define PREF_U2F_USBTOKEN_ENABLED  "security.webauth.u2f_enable_usbtoken"
+#define PREF_WEBAUTHN_SOFTTOKEN_ENABLED "security.webauth.webauthn_enable_softtoken"
+#define PREF_WEBAUTHN_USBTOKEN_ENABLED  "security.webauth.webauthn_enable_usbtoken"
 
 namespace mozilla {
 namespace dom {
 
 static mozilla::LazyLogModule gWebauthLog("webauthn");
 
 // Only needed for refcounted objects.
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebAuthentication, mParent)
@@ -286,17 +286,17 @@ WebAuthentication::InitLazily()
   // This only functions in e10s mode
   // TODO: Remove in Bug 1323339
   if (XRE_IsParentProcess()) {
     MOZ_LOG(gWebauthLog, LogLevel::Debug,
             ("Is non-e10s Process, WebAuthn not available"));
     return NS_ERROR_FAILURE;
   }
 
-  if (Preferences::GetBool(PREF_U2F_SOFTTOKEN_ENABLED)) {
+  if (Preferences::GetBool(PREF_WEBAUTHN_SOFTTOKEN_ENABLED)) {
     if (!mAuthenticators.AppendElement(new NSSU2FTokenRemote(),
                                        mozilla::fallible)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
 
   mInitialized = true;
   return NS_OK;
--- a/dom/webauthn/tests/test_webauthn_get_assertion.html
+++ b/dom/webauthn/tests/test_webauthn_get_assertion.html
@@ -31,19 +31,19 @@ function expectNotAllowedError(aResult) 
   return Promise.resolve();
 }
 
 function expectTypeError(aResult) {
   ok(aResult.toString().startsWith("TypeError"), "Expecting a TypeError");
   return Promise.resolve();
 }
 
-SpecialPowers.pushPrefEnv({"set": [["security.webauth.w3c", true],
-                                   ["security.webauth.u2f_enable_softtoken", true],
-                                   ["security.webauth.u2f_enable_usbtoken", false]]},
+SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
+                                   ["security.webauth.webauthn_enable_softtoken", true],
+                                   ["security.webauth.webauthn_enable_usbtoken", false]]},
 function() {
   isnot(navigator.authentication, undefined, "WebAuthn API endpoint must exist");
   isnot(navigator.authentication.makeCredential, undefined, "WebAuthn makeCredential API endpoint must exist");
   isnot(navigator.authentication.getAssertion, undefined, "WebAuthn getAssertion API endpoint must exist");
 
   let authn = navigator.authentication;
 
   let gAssertionChallenge = new Uint8Array(16);
--- a/dom/webauthn/tests/test_webauthn_loopback.html
+++ b/dom/webauthn/tests/test_webauthn_loopback.html
@@ -16,19 +16,19 @@
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309284">Mozilla Bug 1309284</a>
 
 <script class="testbody" type="text/javascript">
 "use strict";
 
 // Execute the full-scope test
 SimpleTest.waitForExplicitFinish();
 
-SpecialPowers.pushPrefEnv({"set": [["security.webauth.w3c", true],
-                                   ["security.webauth.u2f_enable_softtoken", true],
-                                   ["security.webauth.u2f_enable_usbtoken", false]]},
+SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
+                                   ["security.webauth.webauthn_enable_softtoken", true],
+                                   ["security.webauth.webauthn_enable_usbtoken", false]]},
 function() {
   isnot(navigator.authentication, undefined, "WebAuthn API endpoint must exist");
   isnot(navigator.authentication.makeCredential, undefined, "WebAuthn makeCredential API endpoint must exist");
   isnot(navigator.authentication.getAssertion, undefined, "WebAuthn getAssertion API endpoint must exist");
 
   let authn = navigator.authentication;
 
   let gCredentialChallenge = new Uint8Array(16);
--- a/dom/webauthn/tests/test_webauthn_make_credential.html
+++ b/dom/webauthn/tests/test_webauthn_make_credential.html
@@ -41,19 +41,19 @@ function expectTypeError(aResult) {
   return Promise.resolve();
 }
 
 function expectNotSupportedError(aResult) {
   ok(aResult.toString().startsWith("NotSupportedError"), "Expecting a NotSupportedError");
   return Promise.resolve();
 }
 
-SpecialPowers.pushPrefEnv({"set": [["security.webauth.w3c", true],
-                                   ["security.webauth.u2f_enable_softtoken", true],
-                                   ["security.webauth.u2f_enable_usbtoken", false]]},
+SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
+                                   ["security.webauth.webauthn_enable_softtoken", true],
+                                   ["security.webauth.webauthn_enable_usbtoken", false]]},
 function() {
   isnot(navigator.authentication, undefined, "WebAuthn API endpoint must exist");
   isnot(navigator.authentication.makeCredential, undefined, "WebAuthn makeCredential API endpoint must exist");
   isnot(navigator.authentication.getAssertion, undefined, "WebAuthn getAssertion API endpoint must exist");
 
   let authn = navigator.authentication;
 
   let gCredentialChallenge = new Uint8Array(16);
--- a/dom/webauthn/tests/test_webauthn_no_token.html
+++ b/dom/webauthn/tests/test_webauthn_no_token.html
@@ -16,19 +16,19 @@
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309284">Mozilla Bug 1309284</a>
 
 <script class="testbody" type="text/javascript">
 "use strict";
 
 // Execute the full-scope test
 SimpleTest.waitForExplicitFinish();
 
-SpecialPowers.pushPrefEnv({"set": [["security.webauth.w3c", true],
-                                   ["security.webauth.u2f_enable_softtoken", false],
-                                   ["security.webauth.u2f_enable_usbtoken", false]]},
+SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
+                                   ["security.webauth.webauthn_enable_softtoken", false],
+                                   ["security.webauth.webauthn_enable_usbtoken", false]]},
 function() {
   isnot(navigator.authentication, undefined, "WebAuthn API endpoint must exist");
   isnot(navigator.authentication.makeCredential, undefined, "WebAuthn makeCredential API endpoint must exist");
   isnot(navigator.authentication.getAssertion, undefined, "WebAuthn getAssertion API endpoint must exist");
 
   let authn = navigator.authentication;
 
   let credentialChallenge = new Uint8Array(16);
--- a/dom/webauthn/tests/test_webauthn_sameorigin.html
+++ b/dom/webauthn/tests/test_webauthn_sameorigin.html
@@ -44,19 +44,19 @@ function keepThisScopedCredential(aScope
   gTrackedCredential = {
     type: aScopedCredInfo.credential.type,
     id: Uint8Array.from(aScopedCredInfo.credential.id),
     transports: [ "usb" ],
   }
   return Promise.resolve(aScopedCredInfo);
 }
 
-SpecialPowers.pushPrefEnv({"set": [["security.webauth.w3c", true],
-                                   ["security.webauth.u2f_enable_softtoken", true],
-                                   ["security.webauth.u2f_enable_usbtoken", false]]},
+SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
+                                   ["security.webauth.webauthn_enable_softtoken", true],
+                                   ["security.webauth.webauthn_enable_usbtoken", false]]},
 function() {
   isnot(navigator.authentication, undefined, "WebAuthn API endpoint must exist");
   isnot(navigator.authentication.makeCredential, undefined,
         "WebAuthn makeCredential API endpoint must exist");
   isnot(navigator.authentication.getAssertion, undefined,
         "WebAuthn getAssertion API endpoint must exist");
 
   let authn = navigator.authentication;
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -377,11 +377,11 @@ partial interface Navigator {
 #endif
 
 [NoInterfaceObject, Exposed=(Window,Worker)]
 interface NavigatorConcurrentHardware {
   readonly attribute unsigned long long hardwareConcurrency;
 };
 
 partial interface Navigator {
-  [Pref="security.webauth.w3c", SameObject]
+  [Pref="security.webauth.webauthn", SameObject]
   readonly attribute WebAuthentication authentication;
 };
--- a/netwerk/base/security-prefs.js
+++ b/netwerk/base/security-prefs.js
@@ -88,17 +88,20 @@ pref("security.pki.netscape_step_up_poli
 // Configures Certificate Transparency support mode:
 // 0: Fully disabled.
 // 1: Only collect telemetry. CT qualification checks are not performed.
 pref("security.pki.certificate_transparency.mode", 1);
 
 pref("security.webauth.u2f", false);
 pref("security.webauth.u2f_enable_softtoken", false);
 pref("security.webauth.u2f_enable_usbtoken", false);
-pref("security.webauth.w3c", false);
+
+pref("security.webauth.webauthn", false);
+pref("security.webauth.webauthn_enable_softtoken", false);
+pref("security.webauth.webauthn_enable_usbtoken", false);
 
 pref("security.ssl.errorReporting.enabled", true);
 pref("security.ssl.errorReporting.url", "https://incoming.telemetry.mozilla.org/submit/sslreports/");
 pref("security.ssl.errorReporting.automatic", false);
 
 // Impose a maximum age on HPKP headers, to avoid sites getting permanently
 // blacking themselves out by setting a bad pin.  (60 days by default)
 // https://tools.ietf.org/html/rfc7469#section-4.1