Bugzilla
Quick Search
Browse
Advanced Search
Reports
Quick Search Help
Documentation
New Account
Log In
Login with GitHub
Remember
Forgot Password
Mozilla Home
Privacy
Cookies
Legal
Attachment 8729334 Details for
Bug 1254893
[patch]
Tests for perfunctory functionality of wasm Debugger.Scripts and Debugger.Sources.
Bug-1254893---Tests-for-perfunctory-functionality-.patch (text/plain), 4.39 KB, created by
Shu-yu Guo [:shu]
(
hide
)
Description:
Tests for perfunctory functionality of wasm Debugger.Scripts and Debugger.Sources.
Filename:
MIME Type:
Creator:
Shu-yu Guo [:shu]
Size:
4.39 KB
patch
obsolete
># HG changeset patch ># User Shu-yu Guo <shu@rfrn.org> > >Bug 1254893 - Tests for perfunctory functionality of wasm Debugger.Scripts and Debugger.Sources. > >diff --git a/js/src/jit-test/tests/debug/wasm-01.js b/js/src/jit-test/tests/debug/wasm-01.js >new file mode 100644 >index 0000000..72728e4 >--- /dev/null >+++ b/js/src/jit-test/tests/debug/wasm-01.js >@@ -0,0 +1,25 @@ >+// Tests that wasm module scripts are available via findScripts. >+ >+if (!wasmIsSupported()) >+ quit(); >+ >+var g = newGlobal(); >+g.eval(`o = Wasm.instantiateModule(wasmTextToBinary('(module (func) (export "" 0))'));`); >+ >+var dbg = new Debugger(g); >+var found; >+for (var script of dbg.findScripts()) { >+ if (script.format === "wasm") { >+ found = script; >+ break; >+ } >+} >+ >+print(dbg.findScripts().length); >+assertEq(!!found, true); >+ >+// We should be able to find the same script via its source. >+var scriptsFromSource = dbg.findScripts({ source: found.source }); >+assertEq(scriptsFromSource.length, 1); >+assertEq(scriptsFromSource[0], found); >+ >diff --git a/js/src/jit-test/tests/debug/wasm-02.js b/js/src/jit-test/tests/debug/wasm-02.js >new file mode 100644 >index 0000000..8ae346d >--- /dev/null >+++ b/js/src/jit-test/tests/debug/wasm-02.js >@@ -0,0 +1,15 @@ >+// Tests that wasm module scripts are available via onNewScript. >+ >+if (!wasmIsSupported()) >+ quit(); >+ >+var g = newGlobal(); >+var dbg = new Debugger(g); >+ >+var s; >+dbg.onNewScript = (script) => { >+ s = script; >+} >+ >+g.eval(`o = Wasm.instantiateModule(wasmTextToBinary('(module (func) (export "" 0))'));`); >+assertEq(s.format, "wasm"); >diff --git a/js/src/jit-test/tests/debug/wasm-03.js b/js/src/jit-test/tests/debug/wasm-03.js >new file mode 100644 >index 0000000..0bc9922 >--- /dev/null >+++ b/js/src/jit-test/tests/debug/wasm-03.js >@@ -0,0 +1,40 @@ >+// Tests that wasm module scripts have synthesized sources. >+ >+load(libdir + "asserts.js"); >+ >+if (!wasmIsSupported()) >+ quit(); >+ >+var g = newGlobal(); >+var dbg = new Debugger(g); >+ >+var s; >+dbg.onNewScript = (script) => { >+ s = script; >+} >+ >+g.eval(`o = Wasm.instantiateModule(wasmTextToBinary('(module (func) (export "" 0))'));`); >+assertEq(s.format, "wasm"); >+ >+var source = s.source; >+ >+assertEq(s.source, source); >+assertEq(source.introductionType, "wasm"); >+assertEq(source.introductionScript, s); >+// Wasm sources shouldn't be considered source mapped. >+assertEq(!source.sourceMapURL, true); >+assertThrowsInstanceOf(() => source.sourceMapURL = 'foo', Error); >+// We must have some text. >+assertEq(!!source.text, true); >+ >+// TODOshu: Wasm is moving very fast and what we return for these values is >+// currently not interesting to test. Instead, test that they do not throw. >+source.url; >+source.element; >+source.displayURL; >+source.introductionOffset; >+source.elementAttributeName; >+ >+// canonicalId doesn't make sense since wasm sources aren't backed by >+// ScriptSource. >+assertThrowsInstanceOf(() => source.canonicalId, Error); >diff --git a/js/src/jit-test/tests/debug/wasm-04.js b/js/src/jit-test/tests/debug/wasm-04.js >new file mode 100644 >index 0000000..09eb528 >--- /dev/null >+++ b/js/src/jit-test/tests/debug/wasm-04.js >@@ -0,0 +1,35 @@ >+// Tests that wasm module scripts throw for everything except text. >+ >+load(libdir + "asserts.js"); >+ >+if (!wasmIsSupported()) >+ quit(); >+ >+var g = newGlobal(); >+var dbg = new Debugger(g); >+ >+var s; >+dbg.onNewScript = (script) => { >+ s = script; >+} >+ >+g.eval(`o = Wasm.instantiateModule(wasmTextToBinary('(module (func) (export "" 0))'));`); >+assertEq(s.format, "wasm"); >+ >+assertThrowsInstanceOf(() => s.displayName, Error); >+assertThrowsInstanceOf(() => s.url, Error); >+assertThrowsInstanceOf(() => s.startLine, Error); >+assertThrowsInstanceOf(() => s.lineCount, Error); >+assertThrowsInstanceOf(() => s.sourceStart, Error); >+assertThrowsInstanceOf(() => s.sourceLength, Error); >+assertThrowsInstanceOf(() => s.global, Error); >+assertThrowsInstanceOf(() => s.getChildScripts(), Error); >+assertThrowsInstanceOf(() => s.getAllOffsets(), Error); >+assertThrowsInstanceOf(() => s.getAllColumnOffsets(), Error); >+assertThrowsInstanceOf(() => s.getLineOffsets(0), Error); >+assertThrowsInstanceOf(() => s.setBreakpoint(0, { hit: () => {} }), Error); >+assertThrowsInstanceOf(() => s.getBreakpoint(0), Error); >+assertThrowsInstanceOf(() => s.clearBreakpoint({}), Error); >+assertThrowsInstanceOf(() => s.clearAllBreakpoints(), Error); >+assertThrowsInstanceOf(() => s.isInCatchScope(0), Error); >+assertThrowsInstanceOf(() => s.getOffsetsCoverage(), Error); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
jimb
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 1254893
:
8728295
|
8728296
|
8728297
|
8728298
|
8728299
|
8728300
|
8728301
|
8728903
|
8728904
|
8728905
|
8728907
|
8728908
|
8728909
|
8728910
|
8728912
|
8729333
| 8729334 |
8729359
|
8729683
|
8729748
|
8729759
|
8729812