mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 637572 - Implement Debugger.Source.prototype.url; r=jimb
--HG-- rename : js/src/jit-test/tests/debug/Script-url.js => js/src/jit-test/tests/debug/Source-url.js
This commit is contained in:
parent
24eca4433d
commit
070460ebdf
10
js/src/jit-test/tests/debug/Source-url.js
Normal file
10
js/src/jit-test/tests/debug/Source-url.js
Normal file
@ -0,0 +1,10 @@
|
||||
// Source.prototype.url can be a string or null.
|
||||
|
||||
var g = newGlobal('new-compartment');
|
||||
var dbg = new Debugger;
|
||||
var gw = dbg.addDebuggee(g);
|
||||
for (var fileName of ['file:///var/foo.js', null]) {
|
||||
g.evaluate("function f(x) { return 2*x; }", {fileName: fileName});
|
||||
var fw = gw.getOwnPropertyDescriptor('f').value;
|
||||
assertEq(fw.script.source.url, fileName);
|
||||
}
|
@ -3656,8 +3656,26 @@ DebuggerSource_getText(JSContext *cx, unsigned argc, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
DebuggerSource_getUrl(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get url)", args, obj, sourceObject);
|
||||
|
||||
ScriptSource *ss = sourceObject->source();
|
||||
if (ss->filename()) {
|
||||
JSString *str = js_NewStringCopyZ<CanGC>(cx, ss->filename());
|
||||
if (!str)
|
||||
return false;
|
||||
args.rval().setString(str);
|
||||
} else {
|
||||
args.rval().setNull();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const JSPropertySpec DebuggerSource_properties[] = {
|
||||
JS_PSG("text", DebuggerSource_getText, 0),
|
||||
JS_PSG("url", DebuggerSource_getUrl, 0),
|
||||
JS_PS_END
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user