Bug 1413741 - Improve the use of XHR.mProxy in workers after the dispatching of sync OpenRunnable, r=smaug a=gchang
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 14 Nov 2017 08:18:41 +0100
changeset 704430 bd9c24730b5b1bbd4a35d165eaafadd108e6115d
parent 704429 645141391be71853e7a7dff8913f4df685b3ffb6
child 704431 6a0f1693d6641bcb4bb0b00e3ae39ecd7bac3cce
push id91167
push userbmo:csadilek@mozilla.com
push dateTue, 28 Nov 2017 16:21:38 +0000
reviewerssmaug, gchang
bugs1413741
milestone58.0
Bug 1413741 - Improve the use of XHR.mProxy in workers after the dispatching of sync OpenRunnable, r=smaug a=gchang
dom/xhr/XMLHttpRequestWorker.cpp
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -1890,17 +1890,17 @@ XMLHttpRequestWorker::Open(const nsACStr
   RefPtr<OpenRunnable> runnable =
     new OpenRunnable(mWorkerPrivate, mProxy, aMethod, aUrl, aUser, aPassword,
                      mBackgroundRequest, mWithCredentials,
                      mTimeout, mResponseType);
 
   ++mProxy->mOpenCount;
   runnable->Dispatch(Terminating, aRv);
   if (aRv.Failed()) {
-    if (!--mProxy->mOpenCount) {
+    if (mProxy && !--mProxy->mOpenCount) {
       ReleaseProxy();
     }
 
     return;
   }
 
   // We have been released in one of the nested Open() calls.
   if (!mProxy) {