bug 1524478 - don't create JS objects from WebAuthnManager or U2F destructors r=qdot a=pascalc
authorDana Keeler <dkeeler@mozilla.com>
Fri, 12 Apr 2019 18:18:57 +0000
changeset 526214 ef4d0e2f5ebc75f4023e1c2a7e2b7b82211e86dd
parent 526213 15baf86bf3179f5760fc7ee88ae5c12a74733197
child 526215 78d63ea6abba287bb83cd68d376d12c08bea4ad3
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot, pascalc
bugs1524478
milestone67.0
bug 1524478 - don't create JS objects from WebAuthnManager or U2F destructors r=qdot a=pascalc Before this patch, the WebAuthnManager/U2F destructors would call MaybeReject on existing transaction promises. Doing this leaks JS objects. If WebAuthnManager/U2F are being destructed, though, the window is going away, so it shouldn't be necessary to reject any outstanding promises. This patch just clears the transactions. Differential Revision: https://phabricator.services.mozilla.com/D27346
dom/u2f/U2F.cpp
dom/webauthn/WebAuthnManager.cpp
--- a/dom/u2f/U2F.cpp
+++ b/dom/u2f/U2F.cpp
@@ -127,17 +127,17 @@ static void RegisteredKeysToScopedCreden
 /***********************************************************************
  * U2F JavaScript API Implementation
  **********************************************************************/
 
 U2F::~U2F() {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mTransaction.isSome()) {
-    RejectTransaction(NS_ERROR_ABORT);
+    ClearTransaction();
   }
 
   if (mChild) {
     RefPtr<WebAuthnTransactionChild> c;
     mChild.swap(c);
     c->Disconnect();
   }
 }
--- a/dom/webauthn/WebAuthnManager.cpp
+++ b/dom/webauthn/WebAuthnManager.cpp
@@ -179,17 +179,17 @@ void WebAuthnManager::CancelTransaction(
 
   RejectTransaction(aError);
 }
 
 WebAuthnManager::~WebAuthnManager() {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mTransaction.isSome()) {
-    RejectTransaction(NS_ERROR_ABORT);
+    ClearTransaction();
   }
 
   if (mChild) {
     RefPtr<WebAuthnTransactionChild> c;
     mChild.swap(c);
     c->Disconnect();
   }
 }