WebAssembly: sections with the same name are allowed
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jan 2017 02:49:51 +0000 (02:49 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jan 2017 02:49:51 +0000 (02:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166708

Reviewed by Saam Barati.

* wasm/self-test/test_BuilderJSON.js:
(SectionsWithSameCustomName):

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

JSTests/ChangeLog
JSTests/wasm/self-test/test_BuilderJSON.js

index 557a6ca..6847d91 100644 (file)
@@ -1,3 +1,13 @@
+2017-01-04  JF Bastien  <jfbastien@apple.com>
+
+        WebAssembly: sections with the same name are allowed
+        https://bugs.webkit.org/show_bug.cgi?id=166708
+
+        Reviewed by Saam Barati.
+
+        * wasm/self-test/test_BuilderJSON.js:
+        (SectionsWithSameCustomName):
+
 2017-01-04  Saam Barati  <sbarati@apple.com>
 
         stress/spread-calling.js timing out on the bots
index 623f0f2..2132039 100644 (file)
@@ -80,8 +80,15 @@ const assertOpThrows = (opFn, message) => {
 })();
 
 (function SectionsWithSameCustomName() {
-    const b = (new Builder()).Unknown("foo").End();
-    assert.throws(() => b.Unknown("foo"), Error, `Expected falsy: Cannot have two sections with the same name "foo" and ID 0`);
+    const b = (new Builder()).Unknown("foo").Byte(42).End().Unknown("foo").Byte(100).End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section.length, 2);
+    assert.eq(j.section[0].name, "foo");
+    assert.eq(j.section[0].data.length, 1);
+    assert.eq(j.section[0].data[0], 42);
+    assert.eq(j.section[1].name, "foo");
+    assert.eq(j.section[1].data.length, 1);
+    assert.eq(j.section[1].data[0], 100);
 })();
 
 (function EmptyTypeSection() {