Loading js/src/doc/Debugger/Debugger.Script.md +6 −2 Original line number Diff line number Diff line Loading @@ -125,8 +125,12 @@ from its prototype: `url` : **If the instance refers to a `JSScript`**, the filename or URL from which this script's code was loaded. If the `source` property is non-`null`, then this is equal to `source.url`. this script's code was loaded. For scripts created by `eval` or the `Function` constructor, this may be a synthesized filename, starting with a valid URL and followed by information tracking how the code was introduced into the system; the entire string is not a valid URL. For `Function.prototype`'s script, this is `null`. If this `Debugger.Script`'s `source` property is non-`null`, then this is equal to `source.url`. **If the instance refers to WebAssembly code**, throw a `TypeError`. Loading js/src/doc/Debugger/Debugger.Source.md +7 −3 Original line number Diff line number Diff line Loading @@ -85,9 +85,13 @@ from its prototype: WebAssembly bytecode. `url` : **If the instance refers to JavaScript source**, the URL from which this source was loaded, if this source was loaded from a URL. Otherwise, this is `undefined`. Source may be loaded from a URL in the following ways: : **If the instance refers to JavaScript source**, the filename or URL from which this script's code was loaded. For scripts created by `eval` or the `Function` constructor, this may be a synthesized filename, starting with a valid URL and followed by information tracking how the code was introduced into the system; the entire string is not a valid URL. For `Function.prototype`'s script, this is `null`. Source may be loaded from a URL in the following ways: * The URL may appear as the `src` attribute of a `<script>` element in markup text. Loading js/src/jit-test/tests/debug/Source-url-01.js 0 → 100644 +10 −0 Original line number Diff line number Diff line // Source.prototype.url returns a synthesized URL for eval code. var g = newGlobal(); g.eval('function double() { return 2*x }'); var dbg = new Debugger; var gw = dbg.addDebuggee(g); var fw = gw.getOwnPropertyDescriptor('double').value; assertEq(!!fw.script.source.url.match(/Source-url-01.js line [0-9]+ > eval/), true); js/src/jit-test/tests/debug/Source-url-02.js 0 → 100644 +11 −0 Original line number Diff line number Diff line // Source.prototype.url returns a synthesized URL for Function code. var g = newGlobal(); g.eval('var double = Function("x", "return 2*x;");'); var dbg = new Debugger; var gw = dbg.addDebuggee(g); var fw = gw.getOwnPropertyDescriptor('double').value; print(fw.script.source.url); assertEq(!!fw.script.source.url.match(/Source-url-02.js .* > Function/), true); js/src/jit-test/tests/debug/Source-url-03.js 0 → 100644 +11 −0 Original line number Diff line number Diff line // Source.prototype.url is null for Function.prototype. var g = newGlobal(); var dbg = new Debugger; var gw = dbg.addDebuggee(g); var Fpw = gw.getOwnPropertyDescriptor('Function').value.proto; assertEq(Fpw.script.source.url, null); Loading
js/src/doc/Debugger/Debugger.Script.md +6 −2 Original line number Diff line number Diff line Loading @@ -125,8 +125,12 @@ from its prototype: `url` : **If the instance refers to a `JSScript`**, the filename or URL from which this script's code was loaded. If the `source` property is non-`null`, then this is equal to `source.url`. this script's code was loaded. For scripts created by `eval` or the `Function` constructor, this may be a synthesized filename, starting with a valid URL and followed by information tracking how the code was introduced into the system; the entire string is not a valid URL. For `Function.prototype`'s script, this is `null`. If this `Debugger.Script`'s `source` property is non-`null`, then this is equal to `source.url`. **If the instance refers to WebAssembly code**, throw a `TypeError`. Loading
js/src/doc/Debugger/Debugger.Source.md +7 −3 Original line number Diff line number Diff line Loading @@ -85,9 +85,13 @@ from its prototype: WebAssembly bytecode. `url` : **If the instance refers to JavaScript source**, the URL from which this source was loaded, if this source was loaded from a URL. Otherwise, this is `undefined`. Source may be loaded from a URL in the following ways: : **If the instance refers to JavaScript source**, the filename or URL from which this script's code was loaded. For scripts created by `eval` or the `Function` constructor, this may be a synthesized filename, starting with a valid URL and followed by information tracking how the code was introduced into the system; the entire string is not a valid URL. For `Function.prototype`'s script, this is `null`. Source may be loaded from a URL in the following ways: * The URL may appear as the `src` attribute of a `<script>` element in markup text. Loading
js/src/jit-test/tests/debug/Source-url-01.js 0 → 100644 +10 −0 Original line number Diff line number Diff line // Source.prototype.url returns a synthesized URL for eval code. var g = newGlobal(); g.eval('function double() { return 2*x }'); var dbg = new Debugger; var gw = dbg.addDebuggee(g); var fw = gw.getOwnPropertyDescriptor('double').value; assertEq(!!fw.script.source.url.match(/Source-url-01.js line [0-9]+ > eval/), true);
js/src/jit-test/tests/debug/Source-url-02.js 0 → 100644 +11 −0 Original line number Diff line number Diff line // Source.prototype.url returns a synthesized URL for Function code. var g = newGlobal(); g.eval('var double = Function("x", "return 2*x;");'); var dbg = new Debugger; var gw = dbg.addDebuggee(g); var fw = gw.getOwnPropertyDescriptor('double').value; print(fw.script.source.url); assertEq(!!fw.script.source.url.match(/Source-url-02.js .* > Function/), true);
js/src/jit-test/tests/debug/Source-url-03.js 0 → 100644 +11 −0 Original line number Diff line number Diff line // Source.prototype.url is null for Function.prototype. var g = newGlobal(); var dbg = new Debugger; var gw = dbg.addDebuggee(g); var Fpw = gw.getOwnPropertyDescriptor('Function').value.proto; assertEq(Fpw.script.source.url, null);