Bug 1111737. r=smaug, a=lsblakk
authorKyle Huey <khuey@kylehuey.com>
Fri, 19 Dec 2014 18:16:17 -0800
changeset 234339 9c908bced0dba3a8c854db108c69aa2c998c4b9e
parent 234338 7db3b347535a3ff48351a6782eeb64dfd1e7a223
child 234340 e83d78f377b65d47be18c20d54d046433639b2d6
push id4268
push userryanvm@gmail.com
push dateMon, 22 Dec 2014 22:22:50 +0000
treeherdermozilla-beta@e83d78f377b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lsblakk
bugs1111737
milestone35.0
Bug 1111737. r=smaug, a=lsblakk
content/base/src/nsScriptLoader.cpp
--- a/content/base/src/nsScriptLoader.cpp
+++ b/content/base/src/nsScriptLoader.cpp
@@ -819,17 +819,22 @@ nsScriptLoader::ProcessOffThreadRequest(
   return rv;
 }
 
 NS_IMETHODIMP
 NotifyOffThreadScriptLoadCompletedRunnable::Run()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsresult rv = mLoader->ProcessOffThreadRequest(mRequest, &mToken);
+  // We want these to be dropped on the main thread, once we return from this
+  // function.
+  nsRefPtr<nsScriptLoadRequest> request = mRequest.forget();
+  nsRefPtr<nsScriptLoader> loader = mLoader.forget();
+
+  nsresult rv = loader->ProcessOffThreadRequest(request, &mToken);
 
   if (mToken) {
     // The result of the off thread parse was not actually needed to process
     // the request (disappearing window, some other error, ...). Finish the
     // request to avoid leaks in the JS engine.
     nsCOMPtr<nsIJSRuntimeService> svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
     NS_ENSURE_TRUE(svc, NS_ERROR_FAILURE);
     JSRuntime *rt;