mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 960246 - Handle failures when executing frame scripts (r=smaug,bholley)
This commit is contained in:
parent
e0d10c001a
commit
2ca030651d
@ -1410,6 +1410,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
JS::Rooted<JSObject*> global(cx, mGlobal->GetJSObject());
|
||||
if (global) {
|
||||
JSAutoCompartment ac(cx, global);
|
||||
bool ok = true;
|
||||
if (funobj) {
|
||||
JS::Rooted<JSObject*> method(cx, JS_CloneFunctionObject(cx, funobj, global));
|
||||
if (!method) {
|
||||
@ -1417,10 +1418,14 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
}
|
||||
JS::Rooted<JS::Value> rval(cx);
|
||||
JS::Rooted<JS::Value> methodVal(cx, JS::ObjectValue(*method));
|
||||
(void) JS_CallFunctionValue(cx, global, methodVal,
|
||||
0, nullptr, rval.address());
|
||||
ok = JS_CallFunctionValue(cx, global, methodVal,
|
||||
0, nullptr, rval.address());
|
||||
} else if (script) {
|
||||
(void) JS_ExecuteScript(cx, global, script, nullptr);
|
||||
ok = JS_ExecuteScript(cx, global, script, nullptr);
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
nsJSUtils::ReportPendingException(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user