WebAssembly JS API: simple Module test
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 21:48:19 +0000 (21:48 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 21:48:19 +0000 (21:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163963

Reviewed by Filip Pizlo.

* wasm/LowLevelBinary.js:
(export.default.LowLevelBinary.prototype.get return): get the ArrayBuffer
(export.default.LowLevelBinary.prototype.hexdump): Deleted.
(export.default.LowLevelBinary.prototype._maybeGrow): Deleted.
* wasm/js-api/test_Module.js: Added.
(EmptyModule): The most basic module possible

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207846 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/wasm/LowLevelBinary.js
JSTests/wasm/js-api/test_Module.js [new file with mode: 0644]

index 8d52629..b6e87c0 100644 (file)
@@ -1,5 +1,19 @@
 2016-10-25  JF Bastien  <jfbastien@apple.com>
 
+        WebAssembly JS API: simple Module test
+        https://bugs.webkit.org/show_bug.cgi?id=163963
+
+        Reviewed by Filip Pizlo.
+
+        * wasm/LowLevelBinary.js:
+        (export.default.LowLevelBinary.prototype.get return): get the ArrayBuffer
+        (export.default.LowLevelBinary.prototype.hexdump): Deleted.
+        (export.default.LowLevelBinary.prototype._maybeGrow): Deleted.
+        * wasm/js-api/test_Module.js: Added.
+        (EmptyModule): The most basic module possible
+
+2016-10-25  JF Bastien  <jfbastien@apple.com>
+
         WebAssembly JS API: implement Module
 
         This implementation allows us to:
index b5ab61f..0a833c1 100644 (file)
@@ -72,6 +72,7 @@ export default class LowLevelBinary {
     newPatchable(type) { return new PatchableLowLevelBinary(type, this); }
 
     // Utilities.
+    get() { return this._buf; }
     hexdump() { return _hexdump(this._buf, this._used); }
     _maybeGrow(bytes) {
         const allocated = this._buf.length;
diff --git a/JSTests/wasm/js-api/test_Module.js b/JSTests/wasm/js-api/test_Module.js
new file mode 100644 (file)
index 0000000..821da84
--- /dev/null
@@ -0,0 +1,9 @@
+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+(function EmptyModule() {
+    const builder = new Builder();
+    const bin = builder.WebAssembly().get();
+    const module = new WebAssembly.Module(bin);
+    assert.instanceof(module, WebAssembly.Module);
+})();