Bug 897322 - Match up the script global and compile-and-go global when cloning function scripts. r=jimb

This commit is contained in:
Bobby Holley 2013-08-01 18:38:46 -07:00
parent 3b5f7c3277
commit b7694118ca
2 changed files with 2 additions and 2 deletions

View File

@ -2519,10 +2519,9 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c
clone->setScript(cscript);
cscript->setFunction(clone);
RootedGlobalObject global(cx, script->compileAndGo ? &script->global() : NULL);
script = clone->nonLazyScript();
CallNewScriptHook(cx, script, clone);
RootedGlobalObject global(cx, script->compileAndGo ? &script->global() : NULL);
Debugger::onNewScript(cx, script, global);
return true;

View File

@ -676,6 +676,7 @@ void
Debugger::onNewScript(JSContext *cx, HandleScript script, GlobalObject *compileAndGoGlobal)
{
JS_ASSERT_IF(script->compileAndGo, compileAndGoGlobal);
JS_ASSERT_IF(script->compileAndGo, compileAndGoGlobal == &script->global());
JS_ASSERT_IF(!script->compileAndGo, !compileAndGoGlobal);
if (!script->compartment()->getDebuggees().empty())
slowPathOnNewScript(cx, script, compileAndGoGlobal);