diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index e1b063085094..a31a8e90b36c 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -202,7 +202,8 @@ ParseTask::ParseTask(ExclusiveContext* cx, JSObject* exclusiveContextGlobal, JSC alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), exclusiveContextGlobal(initCx->runtime(), exclusiveContextGlobal), callback(callback), callbackData(callbackData), - script(nullptr), sourceObject(nullptr), errors(cx), overRecursed(false) + script(initCx->runtime()), sourceObject(initCx->runtime()), + errors(cx), overRecursed(false) { } @@ -1384,7 +1385,7 @@ HelperThread::handleParseWorkload() task->options, srcBuf, /* source_ = */ nullptr, /* extraSct = */ nullptr, - /* sourceObjectOut = */ &(task->sourceObject)); + /* sourceObjectOut = */ task->sourceObject.address()); } // The callback is invoked while we are still off the main thread. diff --git a/js/src/vm/HelperThreads.h b/js/src/vm/HelperThreads.h index 10f1471fad48..aae3c152ddfa 100644 --- a/js/src/vm/HelperThreads.h +++ b/js/src/vm/HelperThreads.h @@ -479,10 +479,10 @@ struct ParseTask // Holds the final script between the invocation of the callback and the // point where FinishOffThreadScript is called, which will destroy the // ParseTask. - JSScript* script; + PersistentRootedScript script; // Holds the ScriptSourceObject generated for the script compilation. - ScriptSourceObject* sourceObject; + PersistentRooted sourceObject; // Any errors or warnings produced during compilation. These are reported // when finishing the script.