Bug 1414549: Correctly handle GetDeliveryTarget failure. r?mixedpuppy draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 05 Nov 2017 19:22:38 -0800
changeset 695127 3726e369a486e757b444028a187fedc3946a883c
parent 693206 4350a326a49805c6138aabd0ed68136498bf97cd
child 739538 1d7d644048740bbde17aabbf4f0d8ce4576dfaa5
push id88359
push usermaglione.k@gmail.com
push dateWed, 08 Nov 2017 21:29:33 +0000
reviewersmixedpuppy
bugs1414549
milestone58.0a1
Bug 1414549: Correctly handle GetDeliveryTarget failure. r?mixedpuppy getter_AddRefs nulls its parameter before passing it to the getter function, which means that on failure, we wind up with a null IO thread, rather than its original main thread value. MozReview-Commit-ID: 1SSIeNtiBq9
toolkit/components/extensions/webrequest/StreamFilterParent.cpp
--- a/toolkit/components/extensions/webrequest/StreamFilterParent.cpp
+++ b/toolkit/components/extensions/webrequest/StreamFilterParent.cpp
@@ -413,18 +413,21 @@ StreamFilterParent::OnStartRequest(nsIRe
     });
   }
 
   nsresult rv = mOrigListener->OnStartRequest(aRequest, aContext);
 
   // Important: Do this only *after* running the next listener in the chain, so
   // that we get the final delivery target after any retargeting that it may do.
   if (nsCOMPtr<nsIThreadRetargetableRequest> req = do_QueryInterface(aRequest)) {
-    Unused << req->GetDeliveryTarget(getter_AddRefs(mIOThread));
-    MOZ_ASSERT(mIOThread);
+    nsCOMPtr<nsIEventTarget> thread;
+    Unused << req->GetDeliveryTarget(getter_AddRefs(thread));
+    if (thread) {
+      mIOThread = Move(thread);
+    }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 StreamFilterParent::OnStopRequest(nsIRequest* aRequest,
                                   nsISupports* aContext,