Bug 1528097 U2F doesn't work on Windows 10 19H1/20H1 Insider builds r=jcj,keeler
authorAkshay Kumar <akshay.sonu@gmail.com>
Wed, 06 Mar 2019 22:59:29 +0000
changeset 520703 bfe72a7c57bde0d1825ba43cbd9afa34d03ed00d
parent 520700 ecbfad744a66ee47428dff7992aa6604391844e6
child 520704 f8b979bd590424560bf17a1877baa575b29b6013
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcj, keeler
bugs1528097
milestone67.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 1528097 U2F doesn't work on Windows 10 19H1/20H1 Insider builds r=jcj,keeler Differential Revision: https://phabricator.services.mozilla.com/D22343
dom/u2f/U2F.cpp
--- a/dom/u2f/U2F.cpp
+++ b/dom/u2f/U2F.cpp
@@ -10,16 +10,20 @@
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/dom/WebAuthnTransactionChild.h"
 #include "mozilla/dom/WebAuthnUtil.h"
 #include "nsContentUtils.h"
 #include "nsIEffectiveTLDService.h"
 #include "nsNetUtil.h"
 #include "nsURLParsers.h"
 
+#ifdef OS_WIN
+#include "WinWebAuthnManager.h"
+#endif
+
 using namespace mozilla::ipc;
 
 // Forward decl because of nsHTMLDocument.h's complex dependency on
 // /layout/style
 class nsHTMLDocument {
  public:
   bool IsRegistrableDomainSuffixOfOrEqualTo(const nsAString& aHostSuffixString,
                                             const nsACString& aOrigHost);
@@ -248,17 +252,23 @@ void U2F::Register(const nsAString& aApp
   if (!MaybeCreateBackgroundActor()) {
     RegisterResponse response;
     response.mErrorCode.Construct(
         static_cast<uint32_t>(ErrorCode::OTHER_ERROR));
     ExecuteCallback(response, callback);
     return;
   }
 
+#ifdef OS_WIN
+  if (!WinWebAuthnManager::AreWebAuthNApisAvailable()) {
+    ListenForVisibilityEvents();
+  }
+#else
   ListenForVisibilityEvents();
+#endif
 
   NS_ConvertUTF16toUTF8 clientData(clientDataJSON);
   uint32_t adjustedTimeoutMillis = AdjustedTimeoutMillis(opt_aTimeoutSeconds);
 
   WebAuthnMakeCredentialInfo info(mOrigin, adjustedAppId, challenge, clientData,
                                   adjustedTimeoutMillis, excludeList,
                                   null_t() /* no extra info for U2F */);
 
@@ -386,17 +396,23 @@ void U2F::Sign(const nsAString& aAppId, 
   if (!MaybeCreateBackgroundActor()) {
     SignResponse response;
     response.mErrorCode.Construct(
         static_cast<uint32_t>(ErrorCode::OTHER_ERROR));
     ExecuteCallback(response, callback);
     return;
   }
 
+#ifdef OS_WIN
+  if (!WinWebAuthnManager::AreWebAuthNApisAvailable()) {
+    ListenForVisibilityEvents();
+  }
+#else
   ListenForVisibilityEvents();
+#endif
 
   // Always blank for U2F
   nsTArray<WebAuthnExtension> extensions;
 
   NS_ConvertUTF16toUTF8 clientData(clientDataJSON);
   uint32_t adjustedTimeoutMillis = AdjustedTimeoutMillis(opt_aTimeoutSeconds);
 
   WebAuthnGetAssertionInfo info(mOrigin, adjustedAppId, challenge, clientData,