Bug 787927 - Prevent self-hosted JS script from being registered with the debugger

--HG--
extra : rebase_source : ff55c210e70cd551f394c7105084b067508ef81b
This commit is contained in:
Till Schneidereit 2012-09-03 16:04:14 +02:00
parent 6296536837
commit 926aae1659
3 changed files with 8 additions and 0 deletions

View File

@ -1689,6 +1689,8 @@ BytecodeEmitter::needsImplicitThis()
void
BytecodeEmitter::tellDebuggerAboutCompiledScript(JSContext *cx)
{
if (selfHostingMode)
return;
js_CallNewScriptHook(cx, script, script->function());
if (!parent) {
GlobalObject *compileAndGoGlobal = NULL;

View File

@ -1488,6 +1488,7 @@ JSScript::Create(JSContext *cx, HandleObject enclosingScope, bool savedCallerFun
}
script->compileAndGo = options.compileAndGo;
script->selfHosted = options.selfHostingMode;
script->noScriptRval = options.noScriptRval;
script->version = options.version;
@ -1762,6 +1763,8 @@ JS_FRIEND_API(void)
js_CallNewScriptHook(JSContext *cx, JSScript *script, JSFunction *fun)
{
JS_ASSERT(!script->isActiveEval);
if (script->selfHosted)
return;
if (JSNewScriptHook hook = cx->runtime->debugHooks.newScriptHook) {
AutoKeepAtoms keep(cx->runtime);
hook(cx, script->filename, script->lineno, script, fun,
@ -1772,6 +1775,8 @@ js_CallNewScriptHook(JSContext *cx, JSScript *script, JSFunction *fun)
void
js::CallDestroyScriptHook(FreeOp *fop, JSScript *script)
{
if (script->selfHosted)
return;
if (JSDestroyScriptHook hook = fop->runtime()->debugHooks.destroyScriptHook)
hook(fop, script, fop->runtime()->debugHooks.destroyScriptHookData);
script->clearTraps(fop);

View File

@ -450,6 +450,7 @@ struct JSScript : public js::gc::Cell
bool strictModeCode:1; /* code is in strict mode */
bool explicitUseStrict:1; /* code has "use strict"; explicitly */
bool compileAndGo:1; /* see Parser::compileAndGo */
bool selfHosted:1; /* see Parser::selfHostingMode */
bool bindingsAccessedDynamically:1; /* see ContextFlags' field of the same name */
bool funHasExtensibleScope:1; /* see ContextFlags' field of the same name */
bool funHasAnyAliasedFormal:1; /* true if any formalIsAliased(i) */