Bug 1528097 - U2F doesn't work on Windows 10 19H1/20H1 Insider builds r=jcj, keeler a=lizzard
authorBogdan Tara <btara@mozilla.com>
Sat, 09 Mar 2019 06:00:23 +0200
changeset 516342 93d78ef4e591cb9b980605691051abadaca9d773
parent 516341 c4d0a83454a291d01e5c8d2f9215a2d43c890562
child 516343 0b7f3caba2aa08835a4f252c6805c0224f029d98
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcj, keeler, lizzard
bugs1528097
milestone66.0
Bug 1528097 - U2F doesn't work on Windows 10 19H1/20H1 Insider builds r=jcj, keeler a=lizzard Reviewers: jcj, keeler Reviewed By: jcj, keeler Subscribers: reviewbot, jcj Bug #: 1528097 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,