mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1165486 - Use JS::CompileForNonSyntacticScope in Gecko where we used to set polluted global scope. (r=bz, rs=bholley)
This commit is contained in:
parent
a63baf6429
commit
0b4f672545
@ -1788,8 +1788,7 @@ nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
|
||||
}
|
||||
} else {
|
||||
// We're going to run these against some non-global scope.
|
||||
options.setHasPollutedScope(true);
|
||||
if (!JS::Compile(cx, options, srcBuf, &script)) {
|
||||
if (!JS::CompileForNonSyntacticScope(cx, options, srcBuf, &script)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +146,10 @@ PrepareScript(nsIURI* uri,
|
||||
}
|
||||
|
||||
if (!reuseGlobal) {
|
||||
options.setHasPollutedScope(!JS_IsGlobalObject(targetObj));
|
||||
JS::Compile(cx, options, srcBuf, script);
|
||||
if (JS_IsGlobalObject(targetObj))
|
||||
JS::Compile(cx, options, srcBuf, script);
|
||||
else
|
||||
JS::CompileForNonSyntacticScope(cx, options, srcBuf, script);
|
||||
} else {
|
||||
AutoObjectVector scopeChain(cx);
|
||||
if (!JS_IsGlobalObject(targetObj) &&
|
||||
@ -162,9 +164,11 @@ PrepareScript(nsIURI* uri,
|
||||
// We only use lazy source when no special encoding is specified because
|
||||
// the lazy source loader doesn't know the encoding.
|
||||
if (!reuseGlobal) {
|
||||
options.setSourceIsLazy(true)
|
||||
.setHasPollutedScope(!JS_IsGlobalObject(targetObj));
|
||||
JS::Compile(cx, options, buf, len, script);
|
||||
options.setSourceIsLazy(true);
|
||||
if (JS_IsGlobalObject(targetObj))
|
||||
JS::Compile(cx, options, buf, len, script);
|
||||
else
|
||||
JS::CompileForNonSyntacticScope(cx, options, buf, len, script);
|
||||
} else {
|
||||
AutoObjectVector scopeChain(cx);
|
||||
if (!JS_IsGlobalObject(targetObj) &&
|
||||
|
Loading…
Reference in New Issue
Block a user