--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ -118,17 +118,17 @@ ReportError(JSContext* cx, const char* o
msg.Append(": ");
msg.Append(spec);
ReportError(cx, msg);
}
static bool
PrepareScript(nsIURI* uri,
JSContext* cx,
- RootedObject& targetObj,
+ HandleObject targetObj,
const char* uriStr,
const nsAString& charset,
const char* buf,
int64_t len,
bool reuseGlobal,
MutableHandleScript script,
MutableHandleFunction function)
{
@@ -180,25 +180,25 @@ PrepareScript(nsIURI* uri,
return false;
}
return JS::CompileFunction(cx, envChain, options, nullptr, 0, nullptr,
buf, len, function);
}
static bool
EvalScript(JSContext* cx,
- RootedObject& targetObj,
+ HandleObject targetObj,
MutableHandleValue retval,
nsIURI* uri,
bool cache,
- RootedScript& script,
- RootedFunction& function)
+ MutableHandleScript script,
+ HandleFunction function)
{
if (function) {
- script = JS_GetFunctionScript(cx, function);
+ script.set(JS_GetFunctionScript(cx, function));
}
if (function) {
if (!JS_CallFunction(cx, targetObj, function, JS::HandleValueArray::empty(), retval)) {
return false;
}
} else {
if (JS_IsGlobalObject(targetObj)) {
@@ -388,17 +388,17 @@ AsyncScriptLoader::OnStreamComplete(nsII
if (!PrepareScript(uri, cx, targetObj, spec.get(), mCharset,
reinterpret_cast<const char*>(aBuf), aLength,
mReuseGlobal, &script, &function))
{
return NS_OK;
}
JS::Rooted<JS::Value> retval(cx);
- if (EvalScript(cx, targetObj, &retval, uri, mCache, script, function)) {
+ if (EvalScript(cx, targetObj, &retval, uri, mCache, &script, function)) {
autoPromise.ResolvePromise(retval);
}
return NS_OK;
}
nsresult
mozJSSubScriptLoader::ReadScriptAsync(nsIURI* uri, JSObject* targetObjArg,
@@ -692,17 +692,17 @@ mozJSSubScriptLoader::DoLoadSubScriptWit
principal, reusingGlobal, &script, &function))
{
return NS_OK;
}
} else {
cache = nullptr;
}
- Unused << EvalScript(cx, targetObj, retval, uri, !!cache, script, function);
+ Unused << EvalScript(cx, targetObj, retval, uri, !!cache, &script, function);
return NS_OK;
}
/**
* Let us compile scripts from a URI off the main thread.
*/
class ScriptPrecompiler : public nsIIncrementalStreamLoaderObserver