Bug 1097987 part 4. Change mozJSSubScriptLoader to use the scopechain version of JS_ExecuteScript as needed. r=bholley

This commit is contained in:
Boris Zbarsky 2015-03-14 01:36:16 -04:00
Родитель 0dbd99c459
Коммит 65cc333846
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -378,7 +378,13 @@ mozJSSubScriptLoader::DoLoadSubScriptWithOptions(const nsAString &url,
ok = JS_CallFunction(cx, targetObj, function, JS::HandleValueArray::empty(),
retval);
} else {
ok = JS_ExecuteScript(cx, targetObj, script, retval);
if (JS_IsGlobalObject(targetObj)) {
ok = JS_ExecuteScript(cx, targetObj, script, retval);
} else {
JS::AutoObjectVector scopeChain(cx);
ok = scopeChain.append(targetObj) &&
JS_ExecuteScript(cx, scopeChain, script, retval);
}
}
if (ok) {