mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 787927 - Prevent self-hosted JS script from being registered with the debugger. r=jimb
--HG-- extra : rebase_source : e5fd2c4bc80d11ad782180d10123c563eca5347a
This commit is contained in:
parent
c16ed67e12
commit
095f9fa411
@ -4367,6 +4367,7 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
options.setPrincipals(parent->principals())
|
||||
.setOriginPrincipals(parent->originPrincipals)
|
||||
.setCompileAndGo(parent->compileAndGo)
|
||||
.setSelfHostingMode(parent->selfHosted)
|
||||
.setNoScriptRval(false)
|
||||
.setVersion(parent->getVersion())
|
||||
.setUserBit(parent->userBit);
|
||||
|
@ -1038,6 +1038,8 @@ JS::DescribeStack(JSContext *cx, unsigned maxFrames)
|
||||
Vector<FrameDescription> frames(cx);
|
||||
|
||||
for (ScriptFrameIter i(cx); !i.done(); ++i) {
|
||||
if (i.script()->selfHosted)
|
||||
continue;
|
||||
FrameDescription desc;
|
||||
desc.script = i.script();
|
||||
desc.lineno = PCToLineNumber(i.script(), i.pc());
|
||||
|
@ -1719,6 +1719,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;
|
||||
@ -2014,6 +2015,9 @@ JSScript::enclosingScriptsCompiledSuccessfully() const
|
||||
void
|
||||
js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
|
||||
{
|
||||
if (script->selfHosted)
|
||||
return;
|
||||
|
||||
JS_ASSERT(!script->isActiveEval);
|
||||
if (JSNewScriptHook hook = cx->runtime->debugHooks.newScriptHook) {
|
||||
AutoKeepAtoms keep(cx->runtime);
|
||||
@ -2025,6 +2029,9 @@ js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
|
||||
void
|
||||
js::CallDestroyScriptHook(FreeOp *fop, RawScript script)
|
||||
{
|
||||
if (script->selfHosted)
|
||||
return;
|
||||
|
||||
// The hook will only call into JS if a GC is not running.
|
||||
if (JSDestroyScriptHook hook = fop->runtime()->debugHooks.destroyScriptHook)
|
||||
hook(fop, script, fop->runtime()->debugHooks.destroyScriptHookData);
|
||||
@ -2375,6 +2382,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
|
||||
options.setPrincipals(cx->compartment->principals)
|
||||
.setOriginPrincipals(src->originPrincipals)
|
||||
.setCompileAndGo(src->compileAndGo)
|
||||
.setSelfHostingMode(src->selfHosted)
|
||||
.setNoScriptRval(src->noScriptRval)
|
||||
.setVersion(src->getVersion())
|
||||
.setUserBit(src->userBit);
|
||||
|
@ -469,6 +469,7 @@ class JSScript : public js::gc::Cell
|
||||
bool strict: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) */
|
||||
|
@ -1088,6 +1088,9 @@ AddNewScriptRecipients(GlobalObject::DebuggerVector *src, AutoValueVector *dest)
|
||||
void
|
||||
Debugger::slowPathOnNewScript(JSContext *cx, HandleScript script, GlobalObject *compileAndGoGlobal_)
|
||||
{
|
||||
if (script->selfHosted)
|
||||
return;
|
||||
|
||||
Rooted<GlobalObject*> compileAndGoGlobal(cx, compileAndGoGlobal_);
|
||||
|
||||
JS_ASSERT(script->compileAndGo == !!compileAndGoGlobal);
|
||||
@ -2474,7 +2477,7 @@ class Debugger::ScriptQuery {
|
||||
* condition occurred.
|
||||
*/
|
||||
void consider(JSScript *script) {
|
||||
if (oom)
|
||||
if (oom || script->selfHosted)
|
||||
return;
|
||||
JSCompartment *compartment = script->compartment();
|
||||
if (!compartments.has(compartment))
|
||||
@ -3289,7 +3292,7 @@ Debugger::observesScript(JSScript *script) const
|
||||
{
|
||||
if (!enabled)
|
||||
return false;
|
||||
return observesGlobal(&script->global());
|
||||
return observesGlobal(&script->global()) && !script->selfHosted;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -4224,7 +4227,7 @@ DebuggerObject_getScript(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
RootedFunction fun(cx, obj->toFunction());
|
||||
if (!fun->isInterpreted()) {
|
||||
if (fun->isBuiltin()) {
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user