Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Unified Diff: test/mjsunit/wasm/instantiate-module-basic.js

Issue 2384513002: [wasm] Implement WebAssembly.validate() (Closed)
Patch Set: Address review comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/mjsunit/wasm/wasm-object-api.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/instantiate-module-basic.js
diff --git a/test/mjsunit/wasm/instantiate-module-basic.js b/test/mjsunit/wasm/instantiate-module-basic.js
index b83e8131890a3f929165d42820178d0cb2054226..a0c11bdaddd3403f2932ef181c16a3dc973c5910 100644
--- a/test/mjsunit/wasm/instantiate-module-basic.js
+++ b/test/mjsunit/wasm/instantiate-module-basic.js
@@ -62,6 +62,10 @@ CheckInstance(new WebAssembly.Instance(module));
let promise = WebAssembly.compile(buffer);
promise.then(module => CheckInstance(new WebAssembly.Instance(module)));
+// Check that validate works correctly for a module.
+assertTrue(WebAssembly.validate(buffer));
+assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
+
// Negative tests.
(function InvalidModules() {
print("InvalidModules...");
@@ -69,7 +73,7 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module)));
let len = invalid_cases.length;
for (var i = 0; i < len; ++i) {
try {
- let instance = new WebAssembly.Instance(1);
+ let instance = new WebAssembly.Instance(invalid_cases[i]);
assertUnreachable("should not be able to instantiate invalid modules.");
} catch (e) {
assertContains("Argument 0", e.toString());
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/mjsunit/wasm/wasm-object-api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698