Bug 739694 - Fix script filename saving in exception traces (r=luke)

This commit is contained in:
Bill McCloskey 2012-03-27 14:41:50 -07:00
parent fc115012d7
commit ee49c9a7eb
5 changed files with 28 additions and 6 deletions

View File

@ -0,0 +1,12 @@
function newFunc(x) { new Function(x)(); }; try { newFunc("\
var g = newGlobal('new-compartment');\
g.h = function () {\
names = foo.blaaaaaaaaaaaaah().environment.names();\
};\
g.eval('var obj = {a: 1};' + \"with ({a: 1, '0xcafe': 2, ' ': 3, '': 4, '0': 5}) h();\");\
");
} catch(exc1) {}
function newFunc(x) { new Function(x)(); }; newFunc("\
gczeal(2);\
a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this);\
");

View File

@ -0,0 +1,8 @@
try {
({
f: evalcx("evalcx(\"e\",newGlobal('new-compartment'))",
newGlobal('new-compartment'))
})
} catch (e) {}
gc()
gc()

View File

@ -374,7 +374,9 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message,
frame.argc = 0;
}
if (fp->isScriptFrame()) {
frame.filename = fp->script()->filename;
frame.filename = SaveScriptFilename(cx, fp->script()->filename);
if (!frame.filename)
return false;
frame.ulineno = PCToLineNumber(fp->script(), i.pc());
} else {
frame.ulineno = 0;

View File

@ -389,9 +389,6 @@ XDRScriptConst(XDRState<mode> *xdr, HeapValue *vp)
return true;
}
static const char *
SaveScriptFilename(JSContext *cx, const char *filename);
template<XDRMode mode>
bool
js::XDRScript(XDRState<mode> *xdr, JSScript **scriptp, JSScript *parentScript)
@ -836,8 +833,8 @@ JSScript::destroyCounts(JSContext *cx)
* Shared script filename management.
*/
static const char *
SaveScriptFilename(JSContext *cx, const char *filename)
const char *
js::SaveScriptFilename(JSContext *cx, const char *filename)
{
JSCompartment *comp = cx->compartment;

View File

@ -801,6 +801,9 @@ js_CallDestroyScriptHook(JSContext *cx, JSScript *script);
namespace js {
extern const char *
SaveScriptFilename(JSContext *cx, const char *filename);
extern void
MarkScriptFilename(const char *filename);