mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 3 changesets (bug 969786) for m-oth permabustage on a CLOSED TREE
Backed out changeset a79a64806e6c (bug 969786) Backed out changeset 198decf16acf (bug 969786) Backed out changeset 7d0b03e13765 (bug 969786)
This commit is contained in:
parent
0d7d346a64
commit
04bdf4754e
@ -320,7 +320,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame
|
|||||||
.setNoScriptRval(false)
|
.setNoScriptRval(false)
|
||||||
.setPrincipals(principals)
|
.setPrincipals(principals)
|
||||||
.setOriginPrincipals(originPrincipals)
|
.setOriginPrincipals(originPrincipals)
|
||||||
.setIntroductionInfo(introducerFilename, "eval", lineno, script, pcOffset);
|
.setIntroductionInfo(introducerFilename, "eval", lineno, pcOffset);
|
||||||
JSScript *compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
JSScript *compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
||||||
scopeobj, callerScript, options,
|
scopeobj, callerScript, options,
|
||||||
chars.get(), length, flatStr, staticLevel);
|
chars.get(), length, flatStr, staticLevel);
|
||||||
@ -392,7 +392,7 @@ js::DirectEvalStringFromIon(JSContext *cx,
|
|||||||
.setNoScriptRval(false)
|
.setNoScriptRval(false)
|
||||||
.setPrincipals(principals)
|
.setPrincipals(principals)
|
||||||
.setOriginPrincipals(originPrincipals)
|
.setOriginPrincipals(originPrincipals)
|
||||||
.setIntroductionInfo(introducerFilename, "eval", lineno, script, pcOffset);
|
.setIntroductionInfo(introducerFilename, "eval", lineno, pcOffset);
|
||||||
JSScript *compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
JSScript *compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
||||||
scopeobj, callerScript, options,
|
scopeobj, callerScript, options,
|
||||||
chars.get(), length, flatStr, staticLevel);
|
chars.get(), length, flatStr, staticLevel);
|
||||||
|
@ -1,118 +0,0 @@
|
|||||||
// Dynamically generated sources should have their introduction script and
|
|
||||||
// offset set correctly.
|
|
||||||
|
|
||||||
var g = newGlobal();
|
|
||||||
var dbg = new Debugger;
|
|
||||||
var gDO = dbg.addDebuggee(g);
|
|
||||||
var log;
|
|
||||||
|
|
||||||
// Direct eval, while the frame is live.
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'd';
|
|
||||||
var source = frame.script.source;
|
|
||||||
var introducer = frame.older;
|
|
||||||
assertEq(source.introductionScript, introducer.script);
|
|
||||||
assertEq(source.introductionOffset, introducer.offset);
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.eval('\n\neval("\\n\\ndebugger;");');
|
|
||||||
assertEq(log, 'd');
|
|
||||||
|
|
||||||
// Direct eval, after the frame has been popped.
|
|
||||||
var introducer, introduced;
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'de1';
|
|
||||||
introducer = frame.script;
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'de2';
|
|
||||||
introduced = frame.script.source;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.evaluate('debugger; eval("\\n\\ndebugger;");', { lineNumber: 1812 });
|
|
||||||
assertEq(log, 'de1de2');
|
|
||||||
assertEq(introduced.introductionScript, introducer);
|
|
||||||
assertEq(introducer.getOffsetLine(introduced.introductionOffset), 1812);
|
|
||||||
|
|
||||||
// Indirect eval, while the frame is live.
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'd';
|
|
||||||
var source = frame.script.source;
|
|
||||||
var introducer = frame.older;
|
|
||||||
assertEq(source.introductionScript, introducer.script);
|
|
||||||
assertEq(source.introductionOffset, introducer.offset);
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.eval('\n\n(0,eval)("\\n\\ndebugger;");');
|
|
||||||
assertEq(log, 'd');
|
|
||||||
|
|
||||||
// Indirect eval, after the frame has been popped.
|
|
||||||
var introducer, introduced;
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'de1';
|
|
||||||
introducer = frame.script;
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'de2';
|
|
||||||
introduced = frame.script.source;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.evaluate('debugger; (0,eval)("\\n\\ndebugger;");', { lineNumber: 1066 });
|
|
||||||
assertEq(log, 'de1de2');
|
|
||||||
assertEq(introduced.introductionScript, introducer);
|
|
||||||
assertEq(introducer.getOffsetLine(introduced.introductionOffset), 1066);
|
|
||||||
|
|
||||||
// Function constructor.
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'o';
|
|
||||||
var outerScript = frame.script;
|
|
||||||
var outerOffset = frame.offset;
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'i';
|
|
||||||
var source = frame.script.source;
|
|
||||||
assertEq(source.introductionScript, outerScript);
|
|
||||||
assertEq(outerScript.getOffsetLine(source.introductionOffset),
|
|
||||||
outerScript.getOffsetLine(outerOffset));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.eval('\n\n\ndebugger; Function("debugger;")()');
|
|
||||||
assertEq(log, 'oi');
|
|
||||||
|
|
||||||
// Function constructor, after the the introduction call's frame has been
|
|
||||||
// popped.
|
|
||||||
var introducer;
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'F2';
|
|
||||||
introducer = frame.script;
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
var fDO = gDO.evalInGlobal('debugger; Function("origami;")', { lineNumber: 1685 }).return;
|
|
||||||
var source = fDO.script.source;
|
|
||||||
assertEq(log, 'F2');
|
|
||||||
assertEq(source.introductionScript, introducer);
|
|
||||||
assertEq(introducer.getOffsetLine(source.introductionOffset), 1685);
|
|
||||||
|
|
||||||
// If the introduction script is in a different global from the script it
|
|
||||||
// introduced, we don't record it.
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'x';
|
|
||||||
var source = frame.script.source;
|
|
||||||
assertEq(source.introductionScript, undefined);
|
|
||||||
assertEq(source.introductionOffset, undefined);
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.eval('debugger;'); // introduction script is this top-level script
|
|
||||||
assertEq(log, 'x');
|
|
||||||
|
|
||||||
// If the code is introduced by a function that doesn't provide
|
|
||||||
// introduction information, that shouldn't be a problem.
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'x';
|
|
||||||
var source = frame.script.source;
|
|
||||||
assertEq(source.introductionScript, undefined);
|
|
||||||
assertEq(source.introductionOffset, undefined);
|
|
||||||
};
|
|
||||||
log = '';
|
|
||||||
g.eval('evaluate("debugger;", { lineNumber: 1729 });');
|
|
||||||
assertEq(log, 'x');
|
|
@ -1,31 +0,0 @@
|
|||||||
// Calls to 'eval', etc. by JS primitives get attributed to the point of
|
|
||||||
// the primitive's call.
|
|
||||||
|
|
||||||
var g = newGlobal();
|
|
||||||
var dbg = new Debugger;
|
|
||||||
var gDO = dbg.addDebuggee(g);
|
|
||||||
var log = '';
|
|
||||||
|
|
||||||
function outerHandler(frame) {
|
|
||||||
log += 'o';
|
|
||||||
var outerScript = frame.script;
|
|
||||||
|
|
||||||
dbg.onDebuggerStatement = function (frame) {
|
|
||||||
log += 'i';
|
|
||||||
var source = frame.script.source;
|
|
||||||
var introScript = source.introductionScript;
|
|
||||||
assertEq(introScript, outerScript);
|
|
||||||
assertEq(introScript.getOffsetLine(source.introductionOffset), 1234);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
log = '';
|
|
||||||
dbg.onDebuggerStatement = outerHandler;
|
|
||||||
g.evaluate('debugger; ["debugger;"].map(eval)', { lineNumber: 1234 });
|
|
||||||
assertEq(log, 'oi');
|
|
||||||
|
|
||||||
log = '';
|
|
||||||
dbg.onDebuggerStatement = outerHandler;
|
|
||||||
g.evaluate('debugger; "debugger;".replace(/.*/, eval);',
|
|
||||||
{ lineNumber: 1234 });
|
|
||||||
assertEq(log, 'oi');
|
|
@ -4326,8 +4326,7 @@ JS::OwningCompileOptions::OwningCompileOptions(JSContext *cx)
|
|||||||
: ReadOnlyCompileOptions(),
|
: ReadOnlyCompileOptions(),
|
||||||
runtime(GetRuntime(cx)),
|
runtime(GetRuntime(cx)),
|
||||||
elementRoot(cx),
|
elementRoot(cx),
|
||||||
elementAttributeNameRoot(cx),
|
elementAttributeNameRoot(cx)
|
||||||
introductionScriptRoot(cx)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4353,7 +4352,6 @@ JS::OwningCompileOptions::copy(JSContext *cx, const ReadOnlyCompileOptions &rhs)
|
|||||||
setOriginPrincipals(rhs.originPrincipals());
|
setOriginPrincipals(rhs.originPrincipals());
|
||||||
setElement(rhs.element());
|
setElement(rhs.element());
|
||||||
setElementAttributeName(rhs.elementAttributeName());
|
setElementAttributeName(rhs.elementAttributeName());
|
||||||
setIntroductionScript(rhs.introductionScript());
|
|
||||||
|
|
||||||
return (setFileAndLine(cx, rhs.filename(), rhs.lineno) &&
|
return (setFileAndLine(cx, rhs.filename(), rhs.lineno) &&
|
||||||
setSourceMapURL(cx, rhs.sourceMapURL()) &&
|
setSourceMapURL(cx, rhs.sourceMapURL()) &&
|
||||||
@ -4430,23 +4428,11 @@ JS::OwningCompileOptions::wrap(JSContext *cx, JSCompartment *compartment)
|
|||||||
if (!compartment->wrap(cx, elementAttributeNameRoot.address()))
|
if (!compartment->wrap(cx, elementAttributeNameRoot.address()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no equivalent of cross-compartment wrappers for scripts. If
|
|
||||||
// the introduction script would be in a different compartment from the
|
|
||||||
// compiled code, we would be creating a cross-compartment script
|
|
||||||
// reference, which would be bogus. In that case, just don't bother to
|
|
||||||
// retain the introduction script.
|
|
||||||
if (introductionScriptRoot) {
|
|
||||||
if (introductionScriptRoot->compartment() != compartment)
|
|
||||||
introductionScriptRoot = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
|
JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
|
||||||
: ReadOnlyCompileOptions(), elementRoot(cx), elementAttributeNameRoot(cx),
|
: ReadOnlyCompileOptions(), elementRoot(cx), elementAttributeNameRoot(cx)
|
||||||
introductionScriptRoot(cx)
|
|
||||||
{
|
{
|
||||||
this->version = (version != JSVERSION_UNKNOWN) ? version : cx->findVersion();
|
this->version = (version != JSVERSION_UNKNOWN) ? version : cx->findVersion();
|
||||||
|
|
||||||
@ -4467,17 +4453,6 @@ JS::CompileOptions::wrap(JSContext *cx, JSCompartment *compartment)
|
|||||||
if (!compartment->wrap(cx, elementAttributeNameRoot.address()))
|
if (!compartment->wrap(cx, elementAttributeNameRoot.address()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no equivalent of cross-compartment wrappers for scripts. If
|
|
||||||
// the introduction script would be in a different compartment from the
|
|
||||||
// compiled code, we would be creating a cross-compartment script
|
|
||||||
// reference, which would be bogus. In that case, just don't bother to
|
|
||||||
// retain the introduction script.
|
|
||||||
if (introductionScriptRoot) {
|
|
||||||
if (introductionScriptRoot->compartment() != compartment)
|
|
||||||
introductionScriptRoot = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3511,7 +3511,6 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
|
|||||||
const jschar *sourceMapURL() const { return sourceMapURL_; }
|
const jschar *sourceMapURL() const { return sourceMapURL_; }
|
||||||
virtual JSObject *element() const = 0;
|
virtual JSObject *element() const = 0;
|
||||||
virtual JSString *elementAttributeName() const = 0;
|
virtual JSString *elementAttributeName() const = 0;
|
||||||
virtual JSScript *introductionScript() const = 0;
|
|
||||||
|
|
||||||
// POD options.
|
// POD options.
|
||||||
JSVersion version;
|
JSVersion version;
|
||||||
@ -3569,7 +3568,6 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
|
|||||||
JSRuntime *runtime;
|
JSRuntime *runtime;
|
||||||
PersistentRootedObject elementRoot;
|
PersistentRootedObject elementRoot;
|
||||||
PersistentRootedString elementAttributeNameRoot;
|
PersistentRootedString elementAttributeNameRoot;
|
||||||
PersistentRootedScript introductionScriptRoot;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// A minimal constructor, for use with OwningCompileOptions::copy. This
|
// A minimal constructor, for use with OwningCompileOptions::copy. This
|
||||||
@ -3581,7 +3579,6 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
|
|||||||
|
|
||||||
JSObject *element() const MOZ_OVERRIDE { return elementRoot; }
|
JSObject *element() const MOZ_OVERRIDE { return elementRoot; }
|
||||||
JSString *elementAttributeName() const MOZ_OVERRIDE { return elementAttributeNameRoot; }
|
JSString *elementAttributeName() const MOZ_OVERRIDE { return elementAttributeNameRoot; }
|
||||||
JSScript *introductionScript() const MOZ_OVERRIDE { return introductionScriptRoot; }
|
|
||||||
|
|
||||||
// Set this to a copy of |rhs|. Return false on OOM.
|
// Set this to a copy of |rhs|. Return false on OOM.
|
||||||
bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs);
|
bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs);
|
||||||
@ -3602,10 +3599,6 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
|
|||||||
elementAttributeNameRoot = p;
|
elementAttributeNameRoot = p;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
OwningCompileOptions &setIntroductionScript(JSScript *s) {
|
|
||||||
introductionScriptRoot = s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
OwningCompileOptions &setPrincipals(JSPrincipals *p) {
|
OwningCompileOptions &setPrincipals(JSPrincipals *p) {
|
||||||
if (p) JS_HoldPrincipals(p);
|
if (p) JS_HoldPrincipals(p);
|
||||||
if (principals_) JS_DropPrincipals(runtime, principals_);
|
if (principals_) JS_DropPrincipals(runtime, principals_);
|
||||||
@ -3633,13 +3626,12 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
|
|||||||
OwningCompileOptions &setSourcePolicy(SourcePolicy sp) { sourcePolicy = sp; return *this; }
|
OwningCompileOptions &setSourcePolicy(SourcePolicy sp) { sourcePolicy = sp; return *this; }
|
||||||
OwningCompileOptions &setIntroductionType(const char *t) { introductionType = t; return *this; }
|
OwningCompileOptions &setIntroductionType(const char *t) { introductionType = t; return *this; }
|
||||||
bool setIntroductionInfo(JSContext *cx, const char *introducerFn, const char *intro,
|
bool setIntroductionInfo(JSContext *cx, const char *introducerFn, const char *intro,
|
||||||
unsigned line, JSScript *script, uint32_t offset)
|
unsigned line, uint32_t offset)
|
||||||
{
|
{
|
||||||
if (!setIntroducerFilename(cx, introducerFn))
|
if (!setIntroducerFilename(cx, introducerFn))
|
||||||
return false;
|
return false;
|
||||||
introductionType = intro;
|
introductionType = intro;
|
||||||
introductionLineno = line;
|
introductionLineno = line;
|
||||||
introductionScriptRoot = script;
|
|
||||||
introductionOffset = offset;
|
introductionOffset = offset;
|
||||||
hasIntroductionInfo = true;
|
hasIntroductionInfo = true;
|
||||||
return true;
|
return true;
|
||||||
@ -3659,13 +3651,11 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
|
|||||||
{
|
{
|
||||||
RootedObject elementRoot;
|
RootedObject elementRoot;
|
||||||
RootedString elementAttributeNameRoot;
|
RootedString elementAttributeNameRoot;
|
||||||
RootedScript introductionScriptRoot;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CompileOptions(JSContext *cx, JSVersion version = JSVERSION_UNKNOWN);
|
explicit CompileOptions(JSContext *cx, JSVersion version = JSVERSION_UNKNOWN);
|
||||||
CompileOptions(js::ContextFriendFields *cx, const ReadOnlyCompileOptions &rhs)
|
CompileOptions(js::ContextFriendFields *cx, const ReadOnlyCompileOptions &rhs)
|
||||||
: ReadOnlyCompileOptions(), elementRoot(cx), elementAttributeNameRoot(cx),
|
: ReadOnlyCompileOptions(), elementRoot(cx), elementAttributeNameRoot(cx)
|
||||||
introductionScriptRoot(cx)
|
|
||||||
{
|
{
|
||||||
copyPODOptions(rhs);
|
copyPODOptions(rhs);
|
||||||
|
|
||||||
@ -3675,12 +3665,10 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
|
|||||||
sourceMapURL_ = rhs.sourceMapURL();
|
sourceMapURL_ = rhs.sourceMapURL();
|
||||||
elementRoot = rhs.element();
|
elementRoot = rhs.element();
|
||||||
elementAttributeNameRoot = rhs.elementAttributeName();
|
elementAttributeNameRoot = rhs.elementAttributeName();
|
||||||
introductionScriptRoot = rhs.introductionScript();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject *element() const MOZ_OVERRIDE { return elementRoot; }
|
JSObject *element() const MOZ_OVERRIDE { return elementRoot; }
|
||||||
JSString *elementAttributeName() const MOZ_OVERRIDE { return elementAttributeNameRoot; }
|
JSString *elementAttributeName() const MOZ_OVERRIDE { return elementAttributeNameRoot; }
|
||||||
JSScript *introductionScript() const MOZ_OVERRIDE { return introductionScriptRoot; }
|
|
||||||
|
|
||||||
CompileOptions &setFile(const char *f) { filename_ = f; return *this; }
|
CompileOptions &setFile(const char *f) { filename_ = f; return *this; }
|
||||||
CompileOptions &setLine(unsigned l) { lineno = l; return *this; }
|
CompileOptions &setLine(unsigned l) { lineno = l; return *this; }
|
||||||
@ -3693,10 +3681,6 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
|
|||||||
elementAttributeNameRoot = p;
|
elementAttributeNameRoot = p;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
CompileOptions &setIntroductionScript(JSScript *s) {
|
|
||||||
introductionScriptRoot = s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
CompileOptions &setPrincipals(JSPrincipals *p) {
|
CompileOptions &setPrincipals(JSPrincipals *p) {
|
||||||
principals_ = p;
|
principals_ = p;
|
||||||
return *this;
|
return *this;
|
||||||
@ -3720,12 +3704,11 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
|
|||||||
CompileOptions &setSourcePolicy(SourcePolicy sp) { sourcePolicy = sp; return *this; }
|
CompileOptions &setSourcePolicy(SourcePolicy sp) { sourcePolicy = sp; return *this; }
|
||||||
CompileOptions &setIntroductionType(const char *t) { introductionType = t; return *this; }
|
CompileOptions &setIntroductionType(const char *t) { introductionType = t; return *this; }
|
||||||
CompileOptions &setIntroductionInfo(const char *introducerFn, const char *intro,
|
CompileOptions &setIntroductionInfo(const char *introducerFn, const char *intro,
|
||||||
unsigned line, JSScript *script, uint32_t offset)
|
unsigned line, uint32_t offset)
|
||||||
{
|
{
|
||||||
introducerFilename_ = introducerFn;
|
introducerFilename_ = introducerFn;
|
||||||
introductionType = intro;
|
introductionType = intro;
|
||||||
introductionLineno = line;
|
introductionLineno = line;
|
||||||
introductionScriptRoot = script;
|
|
||||||
introductionOffset = offset;
|
introductionOffset = offset;
|
||||||
hasIntroductionInfo = true;
|
hasIntroductionInfo = true;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -1532,7 +1532,7 @@ FunctionConstructor(JSContext *cx, unsigned argc, Value *vp, GeneratorKind gener
|
|||||||
.setFileAndLine(filename, 1)
|
.setFileAndLine(filename, 1)
|
||||||
.setNoScriptRval(false)
|
.setNoScriptRval(false)
|
||||||
.setCompileAndGo(true)
|
.setCompileAndGo(true)
|
||||||
.setIntroductionInfo(introducerFilename, introductionType, lineno, script, pcOffset);
|
.setIntroductionInfo(introducerFilename, introductionType, lineno, pcOffset);
|
||||||
|
|
||||||
unsigned n = args.length() ? args.length() - 1 : 0;
|
unsigned n = args.length() ? args.length() - 1 : 0;
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
|
@ -1269,31 +1269,6 @@ ScriptSourceObject::elementAttributeName() const
|
|||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ScriptSourceObject::initIntroductionScript(JSScript *script)
|
|
||||||
{
|
|
||||||
JS_ASSERT(!getReservedSlot(INTRODUCTION_SCRIPT_SLOT).toPrivate());
|
|
||||||
|
|
||||||
// There is no equivalent of cross-compartment wrappers for scripts. If
|
|
||||||
// the introduction script would be in a different compartment from the
|
|
||||||
// compiled code, we would be creating a cross-compartment script
|
|
||||||
// reference, which would be bogus. In that case, just don't bother to
|
|
||||||
// retain the introduction script.
|
|
||||||
if (script && script->compartment() == compartment())
|
|
||||||
setReservedSlot(INTRODUCTION_SCRIPT_SLOT, PrivateValue(script));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ScriptSourceObject::trace(JSTracer *trc, JSObject *obj)
|
|
||||||
{
|
|
||||||
ScriptSourceObject *sso = static_cast<ScriptSourceObject *>(obj);
|
|
||||||
|
|
||||||
if (JSScript *script = sso->introductionScript()) {
|
|
||||||
MarkScriptUnbarriered(trc, &script, "ScriptSourceObject introductionScript");
|
|
||||||
sso->setReservedSlot(INTRODUCTION_SCRIPT_SLOT, PrivateValue(script));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScriptSourceObject::finalize(FreeOp *fop, JSObject *obj)
|
ScriptSourceObject::finalize(FreeOp *fop, JSObject *obj)
|
||||||
{
|
{
|
||||||
@ -1312,11 +1287,7 @@ const Class ScriptSourceObject::class_ = {
|
|||||||
JS_EnumerateStub,
|
JS_EnumerateStub,
|
||||||
JS_ResolveStub,
|
JS_ResolveStub,
|
||||||
JS_ConvertStub,
|
JS_ConvertStub,
|
||||||
finalize,
|
ScriptSourceObject::finalize
|
||||||
nullptr, /* call */
|
|
||||||
nullptr, /* hasInstance */
|
|
||||||
nullptr, /* construct */
|
|
||||||
trace
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptSourceObject *
|
ScriptSourceObject *
|
||||||
@ -1336,9 +1307,6 @@ ScriptSourceObject::create(ExclusiveContext *cx, ScriptSource *source,
|
|||||||
else
|
else
|
||||||
sourceObject->initSlot(ELEMENT_PROPERTY_SLOT, UndefinedValue());
|
sourceObject->initSlot(ELEMENT_PROPERTY_SLOT, UndefinedValue());
|
||||||
|
|
||||||
sourceObject->initSlot(INTRODUCTION_SCRIPT_SLOT, PrivateValue(nullptr));
|
|
||||||
sourceObject->initIntroductionScript(options.introductionScript());
|
|
||||||
|
|
||||||
return sourceObject;
|
return sourceObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1826,7 +1794,7 @@ ScriptSource::initFromOptions(ExclusiveContext *cx, const ReadOnlyCompileOptions
|
|||||||
JS_HoldPrincipals(originPrincipals_);
|
JS_HoldPrincipals(originPrincipals_);
|
||||||
|
|
||||||
introductionType_ = options.introductionType;
|
introductionType_ = options.introductionType;
|
||||||
setIntroductionOffset(options.introductionOffset);
|
introductionOffset_ = options.introductionOffset;
|
||||||
|
|
||||||
if (options.hasIntroductionInfo) {
|
if (options.hasIntroductionInfo) {
|
||||||
JS_ASSERT(options.introductionType != nullptr);
|
JS_ASSERT(options.introductionType != nullptr);
|
||||||
|
@ -557,7 +557,6 @@ class ScriptSourceObject : public JSObject
|
|||||||
public:
|
public:
|
||||||
static const Class class_;
|
static const Class class_;
|
||||||
|
|
||||||
static void trace(JSTracer *trc, JSObject *obj);
|
|
||||||
static void finalize(FreeOp *fop, JSObject *obj);
|
static void finalize(FreeOp *fop, JSObject *obj);
|
||||||
static ScriptSourceObject *create(ExclusiveContext *cx, ScriptSource *source,
|
static ScriptSourceObject *create(ExclusiveContext *cx, ScriptSource *source,
|
||||||
const ReadOnlyCompileOptions &options);
|
const ReadOnlyCompileOptions &options);
|
||||||
@ -572,18 +571,11 @@ class ScriptSourceObject : public JSObject
|
|||||||
void initElement(HandleObject element);
|
void initElement(HandleObject element);
|
||||||
const Value &elementAttributeName() const;
|
const Value &elementAttributeName() const;
|
||||||
|
|
||||||
JSScript *introductionScript() const {
|
|
||||||
void *untyped = getReservedSlot(INTRODUCTION_SCRIPT_SLOT).toPrivate();
|
|
||||||
return static_cast<JSScript *>(untyped);
|
|
||||||
}
|
|
||||||
void initIntroductionScript(JSScript *script);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint32_t SOURCE_SLOT = 0;
|
static const uint32_t SOURCE_SLOT = 0;
|
||||||
static const uint32_t ELEMENT_SLOT = 1;
|
static const uint32_t ELEMENT_SLOT = 1;
|
||||||
static const uint32_t ELEMENT_PROPERTY_SLOT = 2;
|
static const uint32_t ELEMENT_PROPERTY_SLOT = 2;
|
||||||
static const uint32_t INTRODUCTION_SCRIPT_SLOT = 3;
|
static const uint32_t RESERVED_SLOTS = 3;
|
||||||
static const uint32_t RESERVED_SLOTS = 4;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GeneratorKind { NotGenerator, LegacyGenerator, StarGenerator };
|
enum GeneratorKind { NotGenerator, LegacyGenerator, StarGenerator };
|
||||||
|
@ -177,9 +177,8 @@ ParseTask::ParseTask(ExclusiveContext *cx, JSObject *exclusiveContextGlobal, JSC
|
|||||||
JS::OffThreadCompileCallback callback, void *callbackData)
|
JS::OffThreadCompileCallback callback, void *callbackData)
|
||||||
: cx(cx), options(initCx), chars(chars), length(length),
|
: cx(cx), options(initCx), chars(chars), length(length),
|
||||||
alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), scopeChain(initCx, scopeChain),
|
alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), scopeChain(initCx, scopeChain),
|
||||||
exclusiveContextGlobal(initCx, exclusiveContextGlobal), optionsElement(initCx),
|
exclusiveContextGlobal(initCx, exclusiveContextGlobal), optionsElement(initCx), callback(callback),
|
||||||
optionsIntroductionScript(initCx), callback(callback), callbackData(callbackData),
|
callbackData(callbackData), script(nullptr), errors(cx), overRecursed(false)
|
||||||
script(nullptr), errors(cx), overRecursed(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,8 +192,6 @@ ParseTask::init(JSContext *cx, const ReadOnlyCompileOptions &options)
|
|||||||
// point at while it's in the compilation's temporary compartment.
|
// point at while it's in the compilation's temporary compartment.
|
||||||
optionsElement = this->options.element();
|
optionsElement = this->options.element();
|
||||||
this->options.setElement(nullptr);
|
this->options.setElement(nullptr);
|
||||||
optionsIntroductionScript = this->options.introductionScript();
|
|
||||||
this->options.setIntroductionScript(nullptr);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -214,7 +211,6 @@ ParseTask::finish()
|
|||||||
// was in the temporary compartment.
|
// was in the temporary compartment.
|
||||||
ScriptSourceObject &sso = script->sourceObject()->as<ScriptSourceObject>();
|
ScriptSourceObject &sso = script->sourceObject()->as<ScriptSourceObject>();
|
||||||
sso.initElement(optionsElement);
|
sso.initElement(optionsElement);
|
||||||
sso.initIntroductionScript(optionsIntroductionScript);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +405,6 @@ struct ParseTask
|
|||||||
// at that point would create cross-compartment references. Instead we
|
// at that point would create cross-compartment references. Instead we
|
||||||
// hold them here, and install them after merging the compartments.
|
// hold them here, and install them after merging the compartments.
|
||||||
PersistentRootedObject optionsElement;
|
PersistentRootedObject optionsElement;
|
||||||
PersistentRootedScript optionsIntroductionScript;
|
|
||||||
|
|
||||||
// Callback invoked off the main thread when the parse finishes.
|
// Callback invoked off the main thread when the parse finishes.
|
||||||
JS::OffThreadCompileCallback callback;
|
JS::OffThreadCompileCallback callback;
|
||||||
|
@ -3920,33 +3920,13 @@ DebuggerSource_getElementProperty(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
return Debugger::fromChildJSObject(obj)->wrapDebuggeeValue(cx, args.rval());
|
return Debugger::fromChildJSObject(obj)->wrapDebuggeeValue(cx, args.rval());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
DebuggerSource_getIntroductionScript(JSContext *cx, unsigned argc, Value *vp)
|
|
||||||
{
|
|
||||||
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get introductionScript)", args, obj, sourceObject);
|
|
||||||
|
|
||||||
RootedScript script(cx, sourceObject->introductionScript());
|
|
||||||
if (script) {
|
|
||||||
RootedObject scriptDO(cx, Debugger::fromChildJSObject(obj)->wrapScript(cx, script));
|
|
||||||
if (!scriptDO)
|
|
||||||
return false;
|
|
||||||
args.rval().setObject(*scriptDO);
|
|
||||||
} else {
|
|
||||||
args.rval().setUndefined();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
DebuggerSource_getIntroductionOffset(JSContext *cx, unsigned argc, Value *vp)
|
DebuggerSource_getIntroductionOffset(JSContext *cx, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get introductionOffset)", args, obj, sourceObject);
|
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get introductionOffset)", args, obj, sourceObject);
|
||||||
|
|
||||||
// Regardless of what's recorded in the ScriptSourceObject and
|
|
||||||
// ScriptSource, only hand out the introduction offset if we also have
|
|
||||||
// the script within which it applies.
|
|
||||||
ScriptSource *ss = sourceObject->source();
|
ScriptSource *ss = sourceObject->source();
|
||||||
if (ss->hasIntroductionOffset() && sourceObject->introductionScript())
|
if (ss->hasIntroductionOffset())
|
||||||
args.rval().setInt32(ss->introductionOffset());
|
args.rval().setInt32(ss->introductionOffset());
|
||||||
else
|
else
|
||||||
args.rval().setUndefined();
|
args.rval().setUndefined();
|
||||||
@ -3956,7 +3936,7 @@ DebuggerSource_getIntroductionOffset(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
static bool
|
static bool
|
||||||
DebuggerSource_getIntroductionType(JSContext *cx, unsigned argc, Value *vp)
|
DebuggerSource_getIntroductionType(JSContext *cx, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get introductionType)", args, obj, sourceObject);
|
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get introductionOffset)", args, obj, sourceObject);
|
||||||
|
|
||||||
ScriptSource *ss = sourceObject->source();
|
ScriptSource *ss = sourceObject->source();
|
||||||
if (ss->hasIntroductionType()) {
|
if (ss->hasIntroductionType()) {
|
||||||
@ -3975,7 +3955,6 @@ static const JSPropertySpec DebuggerSource_properties[] = {
|
|||||||
JS_PSG("url", DebuggerSource_getUrl, 0),
|
JS_PSG("url", DebuggerSource_getUrl, 0),
|
||||||
JS_PSG("element", DebuggerSource_getElement, 0),
|
JS_PSG("element", DebuggerSource_getElement, 0),
|
||||||
JS_PSG("displayURL", DebuggerSource_getDisplayURL, 0),
|
JS_PSG("displayURL", DebuggerSource_getDisplayURL, 0),
|
||||||
JS_PSG("introductionScript", DebuggerSource_getIntroductionScript, 0),
|
|
||||||
JS_PSG("introductionOffset", DebuggerSource_getIntroductionOffset, 0),
|
JS_PSG("introductionOffset", DebuggerSource_getIntroductionOffset, 0),
|
||||||
JS_PSG("introductionType", DebuggerSource_getIntroductionType, 0),
|
JS_PSG("introductionType", DebuggerSource_getIntroductionType, 0),
|
||||||
JS_PSG("elementAttributeName", DebuggerSource_getElementProperty, 0),
|
JS_PSG("elementAttributeName", DebuggerSource_getElementProperty, 0),
|
||||||
|
@ -12,7 +12,6 @@ support-files =
|
|||||||
Debugger.Source.prototype.element-2.js
|
Debugger.Source.prototype.element-2.js
|
||||||
Debugger.Source.prototype.element.html
|
Debugger.Source.prototype.element.html
|
||||||
|
|
||||||
[test_Debugger.Source.prototype.introductionScript.html]
|
|
||||||
[test_Debugger.Source.prototype.introductionType.html]
|
[test_Debugger.Source.prototype.introductionType.html]
|
||||||
[test_Debugger.Source.prototype.element.html]
|
[test_Debugger.Source.prototype.element.html]
|
||||||
[test_Debugger.Script.prototype.global.html]
|
[test_Debugger.Script.prototype.global.html]
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=969786
|
|
||||||
|
|
||||||
Debugger.Source.prototype.introductionScript and .introductionOffset should
|
|
||||||
behave when 'eval' is called with no scripted frames active at all.
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Debugger.Source.prototype.introductionScript with no caller</title>
|
|
||||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<pre id="test">
|
|
||||||
<script>
|
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
|
||||||
addDebuggerToGlobal(this);
|
|
||||||
|
|
||||||
window.onload = function () {
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
var dbg, iframeDO, doc, script2DO;
|
|
||||||
|
|
||||||
// Create an iframe to debug.
|
|
||||||
var iframe = document.createElement("iframe");
|
|
||||||
iframe.src = "data:text/html,<div>Hi!</div>";
|
|
||||||
iframe.onload = onLoadHandler;
|
|
||||||
document.body.appendChild(iframe);
|
|
||||||
|
|
||||||
function onLoadHandler() {
|
|
||||||
// Now that the iframe's window has been created, we can add
|
|
||||||
// it as a debuggee.
|
|
||||||
dbg = new Debugger;
|
|
||||||
iframeDO = dbg.addDebuggee(iframe.contentWindow);
|
|
||||||
|
|
||||||
doc = iframe.contentWindow.document;
|
|
||||||
var script = doc.createElement('script');
|
|
||||||
script.text = "setTimeout(eval.bind(null, 'debugger;'), 0);";
|
|
||||||
dbg.onDebuggerStatement = timerHandler;
|
|
||||||
doc.body.appendChild(script);
|
|
||||||
}
|
|
||||||
|
|
||||||
function timerHandler(frame) {
|
|
||||||
// The top stack frame's source should have an undefined
|
|
||||||
// introduction script and introduction offset.
|
|
||||||
var source = frame.script.source;
|
|
||||||
ok(source.introductionScript === undefined,
|
|
||||||
"setTimeout eval introductionScript is undefined");
|
|
||||||
ok(source.introductionOffset === undefined,
|
|
||||||
"setTimeout eval introductionOffset is undefined");
|
|
||||||
|
|
||||||
// Check that the above isn't just some quirk of iframes, or the
|
|
||||||
// browser milieu destroying information: an eval script should indeed
|
|
||||||
// have proper introduction information.
|
|
||||||
var script2 = doc.createElement('script');
|
|
||||||
script2.text = "eval('debugger;');";
|
|
||||||
script2DO = iframeDO.makeDebuggeeValue(script2);
|
|
||||||
dbg.onDebuggerStatement = evalHandler;
|
|
||||||
doc.body.appendChild(script2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function evalHandler(frame) {
|
|
||||||
// The top stack frame's source should be introduced by the script that
|
|
||||||
// called eval.
|
|
||||||
var source = frame.script.source;
|
|
||||||
var frame2 = frame.older;
|
|
||||||
|
|
||||||
ok(source.introductionType === 'eval',
|
|
||||||
"top frame's source was introduced by 'eval'");
|
|
||||||
ok(source.introductionScript === frame2.script,
|
|
||||||
"eval frame's introduction script is the older frame's script");
|
|
||||||
ok(source.introductionOffset === frame2.offset,
|
|
||||||
"eval frame's introduction offset is current offset in older frame");
|
|
||||||
ok(source.introductionScript.source.element === script2DO,
|
|
||||||
"eval frame's introducer belongs to script2 element");
|
|
||||||
|
|
||||||
// The frame that called eval, in turn, should have no introduction
|
|
||||||
// information. (In the future, we certainly could point at the call
|
|
||||||
// that inserted the script element into the document; if that happens,
|
|
||||||
// we can update this test.)
|
|
||||||
ok(frame2.script.source.introductionType === undefined,
|
|
||||||
"older frame has no introduction type");
|
|
||||||
ok(frame2.script.source.introductionScript === undefined,
|
|
||||||
"older frame has no introduction script");
|
|
||||||
ok(frame2.script.source.introductionOffset === null,
|
|
||||||
"older frame has no introduction offset");
|
|
||||||
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user