<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[247440] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/247440">247440</a></dd>
<dt>Author</dt> <dd>ysuzuki@apple.com</dd>
<dt>Date</dt> <dd>2019-07-15 12:26:56 -0700 (Mon, 15 Jul 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[JSC] Improve wasm wpt test results by fixing miscellaneous issues
https://bugs.webkit.org/show_bug.cgi?id=199783

Reviewed by Mark Lam.

JSTests:

Fix our spec tests.

* wasm/js-api/Module-compile.js:
* wasm/js-api/test_basic_api.js:
(const.c.in.constructorProperties.switch):
* wasm/js-api/validate.js:
* wasm/js-api/web-assembly-instantiate.js:
* wasm/spec-tests/jsapi.js:
(testJSAPI.get test):
(testJSAPI.set test):

LayoutTests/imported/w3c:

Import web-platform-tests/wasm/jsapi. Some of tests are failing just because imported wpt tests are old.
They are fixed in the upstream. When upgrading wpt tests, we can mark them PASS.

* resources/import-expectations.json:
* web-platform-tests/wasm/jsapi/assertions.js: Added.
(assert_function_name):
(assert_function_length):
* web-platform-tests/wasm/jsapi/bad-imports.js: Added.
(test_bad_imports):
* web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html: Added.
* web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js: Added.
(test_bad_imports):
* web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/constructor/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/constructor.any.html: Added.
* web-platform-tests/wasm/jsapi/global/constructor.any.js: Added.
(assert_Global):
(test):
(test.get assert_array_equals):
(string_appeared_here.test):
(string_appeared_here.toString):
(string_appeared_here.valueOf):
(string_appeared_here.name.format_value):
* web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/constructor.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/global/toString.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/toString.any.html: Added.
* web-platform-tests/wasm/jsapi/global/toString.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/toString.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/value-set.any.html: Added.
* web-platform-tests/wasm/jsapi/global/value-set.any.js: Added.
(test):
(string_appeared_here.name.of.immutableOptions.test):
(string_appeared_here.name.of.mutableOptions.test):
* web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/value-set.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/valueOf.any.html: Added.
* web-platform-tests/wasm/jsapi/global/valueOf.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/global/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html: Added.
* web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js: Added.
(test_bad_imports):
* web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/constructor.any.html: Added.
* web-platform-tests/wasm/jsapi/instance/constructor.any.js: Added.
(assert_exported_function):
* web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/exports.any.html: Added.
* web-platform-tests/wasm/jsapi/instance/exports.any.js: Added.
(setup):
(test):
* web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/exports.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/toString.any.html: Added.
* web-platform-tests/wasm/jsapi/instance/toString.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/instance/toString.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/instance/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/interface.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/interface.any.html: Added.
* web-platform-tests/wasm/jsapi/interface.any.js: Added.
(test_operations):
(test):
(const.name.of.interfaces.test):
* web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/interface.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/buffer.any.html: Added.
* web-platform-tests/wasm/jsapi/memory/buffer.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/constructor.any.html: Added.
* web-platform-tests/wasm/jsapi/memory/constructor.any.js: Added.
(assert_Memory):
(test):
(const.value.of.outOfRangeValues.test):
(test.get new):
(test.get assert_array_equals):
* web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/grow.any.html: Added.
* web-platform-tests/wasm/jsapi/memory/grow.any.js: Added.
(assert_ArrayBuffer):
(test):
(valueOf):
(const.value.of.outOfRangeValues.test):
* web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/grow.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/toString.any.html: Added.
* web-platform-tests/wasm/jsapi/memory/toString.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/toString.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/memory/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/constructor.any.html: Added.
* web-platform-tests/wasm/jsapi/module/constructor.any.js: Added.
(setup):
(test):
* web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/constructor.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/customSections.any.html: Added.
* web-platform-tests/wasm/jsapi/module/customSections.any.js: Added.
(assert_ArrayBuffer):
(assert_sections):
(setup):
(test):
* web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/customSections.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/module/exports.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/exports.any.html: Added.
* web-platform-tests/wasm/jsapi/module/exports.any.js: Added.
(setup):
(assert_ModuleExportDescriptor):
(assert_exports):
(test):
* web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/exports.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/module/imports.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/imports.any.html: Added.
* web-platform-tests/wasm/jsapi/module/imports.any.js: Added.
(assert_ModuleImportDescriptor):
(assert_imports):
(setup):
(test):
* web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/imports.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/module/toString.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/toString.any.html: Added.
* web-platform-tests/wasm/jsapi/module/toString.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/module/toString.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/module/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/table/assertions.js: Added.
(assert_equal_to_array):
* web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/constructor.any.html: Added.
* web-platform-tests/wasm/jsapi/table/constructor.any.js: Added.
(assert_Table):
(test):
(const.value.of.outOfRangeValues.test):
(test.get const):
* web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/constructor.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/get-set.any.html: Added.
* web-platform-tests/wasm/jsapi/table/get-set.any.js: Added.
(setup):
(test):
(test.set assert_equal_to_array):
(test.const.fn):
(valueOf):
(const.value.of.outOfRangeValues.test):
* web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/get-set.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/grow.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/grow.any.html: Added.
* web-platform-tests/wasm/jsapi/table/grow.any.js: Added.
(nulls):
(test):
(valueOf):
(const.value.of.outOfRangeValues.test):
* web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/grow.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/length.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/length.any.html: Added.
* web-platform-tests/wasm/jsapi/table/length.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/length.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/toString.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/toString.any.html: Added.
* web-platform-tests/wasm/jsapi/table/toString.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/toString.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/w3c-import.log: Added.
* web-platform-tests/wasm/jsapi/wasm-constants.js: Added.
(bytes):
(bytesWithHeader):
(makeSig):
(makeSig_v_x):
(makeSig_v_xx):
(makeSig_r_v):
(makeSig_r_x):
(makeSig_r_xx):
(assertTraps):
(assertWasmThrows):
* web-platform-tests/wasm/jsapi/wasm-module-builder.js: Added.
(Binary.prototype.emit_u8):
(Binary.prototype.emit_u16):
(Binary.prototype.emit_u32):
(Binary.prototype.emit_u32v):
(Binary.prototype.emit_bytes):
(Binary.prototype.emit_string):
(Binary.prototype.emit_header):
(Binary.prototype.emit_section):
(Binary):
(WasmFunctionBuilder):
(WasmFunctionBuilder.prototype.exportAs):
(WasmFunctionBuilder.prototype.exportFunc):
(WasmFunctionBuilder.prototype.addBody):
(WasmFunctionBuilder.prototype.addLocals):
(WasmFunctionBuilder.prototype.end):
(WasmGlobalBuilder):
(WasmGlobalBuilder.prototype.exportAs):
(WasmModuleBuilder):
(WasmModuleBuilder.prototype.addStart):
(WasmModuleBuilder.prototype.addMemory):
(WasmModuleBuilder.prototype.addExplicitSection):
(WasmModuleBuilder.prototype.addType):
(WasmModuleBuilder.prototype.addGlobal):
(WasmModuleBuilder.prototype.addFunction):
(WasmModuleBuilder.prototype.addImport):
(WasmModuleBuilder.prototype.addImportedGlobal):
(WasmModuleBuilder.prototype.addImportedMemory):
(WasmModuleBuilder.prototype.addImportedTable):
(WasmModuleBuilder.prototype.addExport):
(WasmModuleBuilder.prototype.addExportOfKind):
(WasmModuleBuilder.prototype.addDataSegment):
(WasmModuleBuilder.prototype.exportMemoryAs):
(WasmModuleBuilder.prototype.addFunctionTableInit):
(WasmModuleBuilder.prototype.appendToTable):
(WasmModuleBuilder.prototype.setFunctionTableLength):
(WasmModuleBuilder.prototype.toArray):
(WasmModuleBuilder.prototype.toBuffer):
(WasmModuleBuilder.prototype.instantiate):

Source/JavaScriptCore:

This patch fixes miscellaneous issues in our Wasm JS API implementation to improve WPT score.
I picked trivial ones in this patch to make this easily reviewable.

1. Remove WebAssemblyPrototype. It does not exist in the spec. Merging WebAssemblyPrototype into JSWebAssembly.
2. Fix various attributes. It does not match to the usual JSC builtin's convention. But this change
   is correct because they are changed to be matched against WebIDL definition, and WebAssembly implementation
   follows WebIDL. In the future, we could move WebCore WebIDL things into WTF layer and even use (or leverage
   some of utility functions) in our WebAssembly JS API implementation.
3. Fix how we interpret "present" in WebAssembly spec. This does not mean [[HasProperty]] result. It follows to
   WebIDL spec, and it means that [[Get]] result is not undefined.
4. Add argument count check to Module.customSections, which is required because the method is defined in WebIDL.
5. Fix toNonWrappingUint32 to match it to WebIDL's conversion rule.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* builtins/WebAssembly.js: Renamed from Source/JavaScriptCore/builtins/WebAssemblyPrototype.js.
* jit/Repatch.cpp:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSModuleLoader.cpp:
(JSC::moduleLoaderParseModule):
* wasm/js/JSWebAssembly.cpp:
(JSC::JSWebAssembly::create):
(JSC::JSWebAssembly::finishCreation):
(JSC::reject):
(JSC::webAssemblyModuleValidateAsyncInternal):
(JSC::webAssemblyCompileFunc):
(JSC::resolve):
(JSC::JSWebAssembly::webAssemblyModuleValidateAsync):
(JSC::instantiate):
(JSC::compileAndInstantiate):
(JSC::JSWebAssembly::instantiate):
(JSC::webAssemblyModuleInstantinateAsyncInternal):
(JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync):
(JSC::webAssemblyInstantiateFunc):
(JSC::webAssemblyValidateFunc):
(JSC::webAssemblyCompileStreamingInternal):
(JSC::webAssemblyInstantiateStreamingInternal):
* wasm/js/JSWebAssembly.h:
* wasm/js/JSWebAssemblyHelpers.h:
(JSC::toNonWrappingUint32):
* wasm/js/WebAssemblyCompileErrorConstructor.cpp:
(JSC::WebAssemblyCompileErrorConstructor::finishCreation):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::WebAssemblyInstanceConstructor::finishCreation):
* wasm/js/WebAssemblyInstancePrototype.cpp:
* wasm/js/WebAssemblyLinkErrorConstructor.cpp:
(JSC::WebAssemblyLinkErrorConstructor::finishCreation):
* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::constructJSWebAssemblyMemory):
(JSC::WebAssemblyMemoryConstructor::finishCreation):
* wasm/js/WebAssemblyMemoryPrototype.cpp:
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::webAssemblyModuleCustomSections):
(JSC::WebAssemblyModuleConstructor::finishCreation):
* wasm/js/WebAssemblyPrototype.cpp: Removed.
* wasm/js/WebAssemblyPrototype.h: Removed.
* wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
(JSC::WebAssemblyRuntimeErrorConstructor::finishCreation):
* wasm/js/WebAssemblyTableConstructor.cpp:
(JSC::constructJSWebAssemblyTable):
(JSC::WebAssemblyTableConstructor::finishCreation):
* wasm/js/WebAssemblyTablePrototype.cpp:

Source/WebCore:

Remove WebAssemblyPrototype.

Tests: imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html
       imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::compileStreaming):
(WebCore::JSDOMWindowBase::instantiateStreaming):

LayoutTests:

* platform/ios-simulator/TestExpectations:
* platform/win/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmjsapiModulecompilejs">trunk/JSTests/wasm/js-api/Module-compile.js</a></li>
<li><a href="#trunkJSTestswasmjsapitest_basic_apijs">trunk/JSTests/wasm/js-api/test_basic_api.js</a></li>
<li><a href="#trunkJSTestswasmjsapivalidatejs">trunk/JSTests/wasm/js-api/validate.js</a></li>
<li><a href="#trunkJSTestswasmjsapiwebassemblyinstantiatejs">trunk/JSTests/wasm/js-api/web-assembly-instantiate.js</a></li>
<li><a href="#trunkJSTestswasmspectestsjsapijs">trunk/JSTests/wasm/spec-tests/jsapi.js</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cresourcesimportexpectationsjson">trunk/LayoutTests/imported/w3c/resources/import-expectations.json</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreDerivedSourcesinputxcfilelist">trunk/Source/JavaScriptCore/DerivedSources-input.xcfilelist</a></li>
<li><a href="#trunkSourceJavaScriptCoreDerivedSourcesoutputxcfilelist">trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist</a></li>
<li><a href="#trunkSourceJavaScriptCoreDerivedSourcesmake">trunk/Source/JavaScriptCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreSourcestxt">trunk/Source/JavaScriptCore/Sources.txt</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRepatchcpp">trunk/Source/JavaScriptCore/jit/Repatch.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp">trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblycpp">trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyHelpersh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyCompileErrorConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyInstancePrototypecpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstancePrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyMemoryConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyMemoryPrototypecpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModuleConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyRuntimeErrorConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyTableConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyTablePrototypecpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowBasecpp">trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiassertionsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/assertions.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapibadimportsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/bad-imports.js</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableassertionsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/assertions.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiwasmconstantsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-constants.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiwasmmodulebuilderjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsWebAssemblyjs">trunk/Source/JavaScriptCore/builtins/WebAssembly.js</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorebuiltinsWebAssemblyPrototypejs">trunk/Source/JavaScriptCore/builtins/WebAssemblyPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyPrototypecpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyPrototypeh">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog  2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/JSTests/ChangeLog     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Improve wasm wpt test results by fixing miscellaneous issues
+        https://bugs.webkit.org/show_bug.cgi?id=199783
+
+        Reviewed by Mark Lam.
+
+        Fix our spec tests.
+
+        * wasm/js-api/Module-compile.js:
+        * wasm/js-api/test_basic_api.js:
+        (const.c.in.constructorProperties.switch):
+        * wasm/js-api/validate.js:
+        * wasm/js-api/web-assembly-instantiate.js:
+        * wasm/spec-tests/jsapi.js:
+        (testJSAPI.get test):
+        (testJSAPI.set test):
+
</ins><span class="cx"> 2019-07-12  Justin Michaud  <justin_michaud@apple.com>
</span><span class="cx"> 
</span><span class="cx">         B3 should reduce (integer) Sub(Neg(x), y) to Neg(Add(x, y))
</span></span></pre></div>
<a id="trunkJSTestswasmjsapiModulecompilejs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/js-api/Module-compile.js (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/js-api/Module-compile.js      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/JSTests/wasm/js-api/Module-compile.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> import Builder from '../Builder.js';
</span><span class="cx"> 
</span><span class="cx"> assert.isFunction(WebAssembly.compile);
</span><del>-assert.isFunction(WebAssembly.__proto__.compile);
</del><ins>+assert.truthy(WebAssembly.hasOwnProperty('compile'));
</ins><span class="cx"> assert.eq(WebAssembly.compile.length, 1);
</span><span class="cx"> 
</span><span class="cx"> async function testPromiseAPI() {
</span></span></pre></div>
<a id="trunkJSTestswasmjsapitest_basic_apijs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/js-api/test_basic_api.js (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/js-api/test_basic_api.js      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/JSTests/wasm/js-api/test_basic_api.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">         for (const invalid of invalidInstanceImports)
</span><span class="cx">             assert.throws(() => new WebAssembly[c](new WebAssembly.Module(emptyModuleArray), invalid), TypeError, `second argument to WebAssembly.Instance must be undefined or an Object (evaluating 'new WebAssembly[c](new WebAssembly.Module(emptyModuleArray), invalid)')`);
</span><span class="cx">         assert.isNotUndef(instance.exports);
</span><del>-        checkAccessorOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports", { configurable: true, enumerable: false });
</del><ins>+        checkAccessorOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports", { configurable: true, enumerable: true });
</ins><span class="cx">         assert.throws(() => WebAssembly.Instance.prototype.exports = undefined, TypeError, `Attempted to assign to readonly property.`);
</span><span class="cx">         assert.throws(() => WebAssembly.Instance.prototype.exports, TypeError, `expected |this| value to be an instance of WebAssembly.Instance`);
</span><span class="cx">         assert.isUndef(instance.exports.__proto__);
</span></span></pre></div>
<a id="trunkJSTestswasmjsapivalidatejs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/js-api/validate.js (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/js-api/validate.js    2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/JSTests/wasm/js-api/validate.js       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> import Builder from '../Builder.js';
</span><span class="cx"> 
</span><span class="cx"> assert.isFunction(WebAssembly.validate);
</span><del>-assert.isFunction(WebAssembly.__proto__.validate);
</del><ins>+assert.truthy(WebAssembly.hasOwnProperty('validate'));
</ins><span class="cx"> assert.eq(WebAssembly.validate.length, 1);
</span><span class="cx"> 
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkJSTestswasmjsapiwebassemblyinstantiatejs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/js-api/web-assembly-instantiate.js (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/js-api/web-assembly-instantiate.js    2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/JSTests/wasm/js-api/web-assembly-instantiate.js       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> import Builder from '../Builder.js';
</span><span class="cx"> 
</span><span class="cx"> assert.isFunction(WebAssembly.instantiate);
</span><del>-assert.isFunction(WebAssembly.__proto__.instantiate);
</del><ins>+assert.truthy(WebAssembly.hasOwnProperty('instantiate'));
</ins><span class="cx"> assert.eq(WebAssembly.instantiate.length, 1);
</span><span class="cx"> 
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkJSTestswasmspectestsjsapijs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/spec-tests/jsapi.js (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/spec-tests/jsapi.js   2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/JSTests/wasm/spec-tests/jsapi.js      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx">     const moduleImportsDesc = Object.getOwnPropertyDescriptor(Module, 'imports');
</span><span class="cx">     assert_equals(typeof moduleImportsDesc.value, "function");
</span><span class="cx">     assert_equals(moduleImportsDesc.writable, true);
</span><del>-    assert_equals(moduleImportsDesc.enumerable, false);
</del><ins>+    assert_equals(moduleImportsDesc.enumerable, true);
</ins><span class="cx">     assert_equals(moduleImportsDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Module.imports' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -265,7 +265,7 @@
</span><span class="cx">     const moduleExportsDesc = Object.getOwnPropertyDescriptor(Module, 'exports');
</span><span class="cx">     assert_equals(typeof moduleExportsDesc.value, "function");
</span><span class="cx">     assert_equals(moduleExportsDesc.writable, true);
</span><del>-    assert_equals(moduleExportsDesc.enumerable, false);
</del><ins>+    assert_equals(moduleExportsDesc.enumerable, true);
</ins><span class="cx">     assert_equals(moduleExportsDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Module.exports' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -296,7 +296,7 @@
</span><span class="cx">     const customSectionsDesc = Object.getOwnPropertyDescriptor(Module, 'customSections');
</span><span class="cx">     assert_equals(typeof customSectionsDesc.value, "function");
</span><span class="cx">     assert_equals(customSectionsDesc.writable, true);
</span><del>-    assert_equals(customSectionsDesc.enumerable, false);
</del><ins>+    assert_equals(customSectionsDesc.enumerable, true);
</ins><span class="cx">     assert_equals(customSectionsDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Module.customSections' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx">     assertThrows(() => moduleCustomSections(), TypeError);
</span><span class="cx">     assertThrows(() => moduleCustomSections(undefined), TypeError);
</span><span class="cx">     assertThrows(() => moduleCustomSections({}), TypeError);
</span><del>-    var arr = moduleCustomSections(emptyModule);
</del><ins>+    var arr = moduleCustomSections(emptyModule, undefined);
</ins><span class="cx">     assert_equals(arr instanceof Array, true);
</span><span class="cx">     assert_equals(arr.length, 0);
</span><span class="cx"> }, "'WebAssembly.Module.customSections' method");
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx">     const exportsDesc = Object.getOwnPropertyDescriptor(instanceProto, 'exports');
</span><span class="cx">     assert_equals(typeof exportsDesc.get, "function");
</span><span class="cx">     assert_equals(exportsDesc.set, undefined);
</span><del>-    assert_equals(exportsDesc.enumerable, false);
</del><ins>+    assert_equals(exportsDesc.enumerable, true);
</ins><span class="cx">     assert_equals(exportsDesc.configurable, true);
</span><span class="cx">     const exportsGetter = exportsDesc.get;
</span><span class="cx">     assertThrows(() => exportsGetter.call(), TypeError);
</span><span class="lines">@@ -415,11 +415,11 @@
</span><span class="cx">     assertThrows(() => Memory(), TypeError);
</span><span class="cx">     assertThrows(() => new Memory(1), TypeError);
</span><span class="cx">     assertThrows(() => new Memory({initial:{valueOf() { throw new Error("here")}}}), Error);
</span><del>-    assertThrows(() => new Memory({initial:-1}), RangeError);
-    assertThrows(() => new Memory({initial:Math.pow(2,32)}), RangeError);
</del><ins>+    assertThrows(() => new Memory({initial:-1}), TypeError);
+    assertThrows(() => new Memory({initial:Math.pow(2,32)}), TypeError);
</ins><span class="cx">     assertThrows(() => new Memory({initial:1, maximum: Math.pow(2,32)/Math.pow(2,14) }), RangeError);
</span><span class="cx">     assertThrows(() => new Memory({initial:2, maximum:1 }), RangeError);
</span><del>-    assertThrows(() => new Memory({maximum: -1 }), RangeError);
</del><ins>+    assertThrows(() => new Memory({maximum: -1 }), TypeError);
</ins><span class="cx">     assert_equals(new Memory({initial:1}) instanceof Memory, true);
</span><span class="cx">     assert_equals(new Memory({initial:1.5}).buffer.byteLength, WasmPage);
</span><span class="cx"> }, "'WebAssembly.Memory' constructor function");
</span><span class="lines">@@ -451,7 +451,7 @@
</span><span class="cx">     const bufferDesc = Object.getOwnPropertyDescriptor(memoryProto, 'buffer');
</span><span class="cx">     assert_equals(typeof bufferDesc.get, "function");
</span><span class="cx">     assert_equals(bufferDesc.set, undefined);
</span><del>-    assert_equals(bufferDesc.enumerable, false);
</del><ins>+    assert_equals(bufferDesc.enumerable, true);
</ins><span class="cx">     assert_equals(bufferDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Memory.prototype.buffer' accessor property");
</span><span class="cx"> 
</span><span class="lines">@@ -467,7 +467,7 @@
</span><span class="cx"> test(() => {
</span><span class="cx">     const memGrowDesc = Object.getOwnPropertyDescriptor(memoryProto, 'grow');
</span><span class="cx">     assert_equals(typeof memGrowDesc.value, "function");
</span><del>-    assert_equals(memGrowDesc.enumerable, false);
</del><ins>+    assert_equals(memGrowDesc.enumerable, true);
</ins><span class="cx">     assert_equals(memGrowDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Memory.prototype.grow' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -477,8 +477,8 @@
</span><span class="cx">     assert_equals(memGrow.length, 1);
</span><span class="cx">     assertThrows(() => memGrow.call(), TypeError);
</span><span class="cx">     assertThrows(() => memGrow.call({}), TypeError);
</span><del>-    assertThrows(() => memGrow.call(mem1, -1), RangeError);
-    assertThrows(() => memGrow.call(mem1, Math.pow(2,32)), RangeError);
</del><ins>+    assertThrows(() => memGrow.call(mem1, -1), TypeError);
+    assertThrows(() => memGrow.call(mem1, Math.pow(2,32)), TypeError);
</ins><span class="cx">     var mem = new Memory({initial:1, maximum:2});
</span><span class="cx">     var buf = mem.buffer;
</span><span class="cx">     assert_equals(buf.byteLength, WasmPage);
</span><span class="lines">@@ -516,10 +516,10 @@
</span><span class="cx">     assertThrows(() => new Table({initial:1, element:"any"}), TypeError);
</span><span class="cx">     assertThrows(() => new Table({initial:1, element:{valueOf() { return "funcref" }}}), TypeError);
</span><span class="cx">     assertThrows(() => new Table({initial:{valueOf() { throw new Error("here")}}, element:"funcref"}), Error);
</span><del>-    assertThrows(() => new Table({initial:-1, element:"funcref"}), RangeError);
-    assertThrows(() => new Table({initial:Math.pow(2,32), element:"funcref"}), RangeError);
</del><ins>+    assertThrows(() => new Table({initial:-1, element:"funcref"}), TypeError);
+    assertThrows(() => new Table({initial:Math.pow(2,32), element:"funcref"}), TypeError);
</ins><span class="cx">     assertThrows(() => new Table({initial:2, maximum:1, element:"funcref"}), RangeError);
</span><del>-    assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:"funcref"}), RangeError);
</del><ins>+    assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:"funcref"}), TypeError);
</ins><span class="cx">     assert_equals(new Table({initial:1, element:"funcref"}) instanceof Table, true);
</span><span class="cx">     assert_equals(new Table({initial:1.5, element:"funcref"}) instanceof Table, true);
</span><span class="cx">     assert_equals(new Table({initial:1, maximum:1.5, element:"funcref"}) instanceof Table, true);
</span><span class="lines">@@ -553,7 +553,7 @@
</span><span class="cx">     const lengthDesc = Object.getOwnPropertyDescriptor(tableProto, 'length');
</span><span class="cx">     assert_equals(typeof lengthDesc.get, "function");
</span><span class="cx">     assert_equals(lengthDesc.set, undefined);
</span><del>-    assert_equals(lengthDesc.enumerable, false);
</del><ins>+    assert_equals(lengthDesc.enumerable, true);
</ins><span class="cx">     assert_equals(lengthDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Table.prototype.length' accessor data property");
</span><span class="cx"> 
</span><span class="lines">@@ -570,7 +570,7 @@
</span><span class="cx"> test(() => {
</span><span class="cx">     const getDesc = Object.getOwnPropertyDescriptor(tableProto, 'get');
</span><span class="cx">     assert_equals(typeof getDesc.value, "function");
</span><del>-    assert_equals(getDesc.enumerable, false);
</del><ins>+    assert_equals(getDesc.enumerable, true);
</ins><span class="cx">     assert_equals(getDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Table.prototype.get' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -585,8 +585,8 @@
</span><span class="cx">     assert_equals(get.call(tbl1, 1.5), null);
</span><span class="cx">     assertThrows(() => get.call(tbl1, 2), RangeError);
</span><span class="cx">     assertThrows(() => get.call(tbl1, 2.5), RangeError);
</span><del>-    assertThrows(() => get.call(tbl1, -1), RangeError);
-    assertThrows(() => get.call(tbl1, Math.pow(2,33)), RangeError);
</del><ins>+    assertThrows(() => get.call(tbl1, -1), TypeError);
+    assertThrows(() => get.call(tbl1, Math.pow(2,33)), TypeError);
</ins><span class="cx">     assertThrows(() => get.call(tbl1, {valueOf() { throw new Error("hi") }}), Error);
</span><span class="cx"> }, "'WebAssembly.Table.prototype.get' method");
</span><span class="cx"> 
</span><span class="lines">@@ -593,7 +593,7 @@
</span><span class="cx"> test(() => {
</span><span class="cx">     const setDesc = Object.getOwnPropertyDescriptor(tableProto, 'set');
</span><span class="cx">     assert_equals(typeof setDesc.value, "function");
</span><del>-    assert_equals(setDesc.enumerable, false);
</del><ins>+    assert_equals(setDesc.enumerable, true);
</ins><span class="cx">     assert_equals(setDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Table.prototype.set' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -605,8 +605,8 @@
</span><span class="cx">     assertThrows(() => set.call({}), TypeError);
</span><span class="cx">     assertThrows(() => set.call(tbl1, 0), TypeError);
</span><span class="cx">     assertThrows(() => set.call(tbl1, 2, null), RangeError);
</span><del>-    assertThrows(() => set.call(tbl1, -1, null), RangeError);
-    assertThrows(() => set.call(tbl1, Math.pow(2,33), null), RangeError);
</del><ins>+    assertThrows(() => set.call(tbl1, -1, null), TypeError);
+    assertThrows(() => set.call(tbl1, Math.pow(2,33), null), TypeError);
</ins><span class="cx">     assertThrows(() => set.call(tbl1, 0, undefined), TypeError);
</span><span class="cx">     assertThrows(() => set.call(tbl1, 0, {}), TypeError);
</span><span class="cx">     assertThrows(() => set.call(tbl1, 0, function() {}), TypeError);
</span><span class="lines">@@ -619,7 +619,7 @@
</span><span class="cx"> test(() => {
</span><span class="cx">     const tblGrowDesc = Object.getOwnPropertyDescriptor(tableProto, 'grow');
</span><span class="cx">     assert_equals(typeof tblGrowDesc.value, "function");
</span><del>-    assert_equals(tblGrowDesc.enumerable, false);
</del><ins>+    assert_equals(tblGrowDesc.enumerable, true);
</ins><span class="cx">     assert_equals(tblGrowDesc.configurable, true);
</span><span class="cx"> }, "'WebAssembly.Table.prototype.grow' data property");
</span><span class="cx"> 
</span><span class="lines">@@ -629,8 +629,8 @@
</span><span class="cx">     assert_equals(tblGrow.length, 1);
</span><span class="cx">     assertThrows(() => tblGrow.call(), TypeError);
</span><span class="cx">     assertThrows(() => tblGrow.call({}), TypeError);
</span><del>-    assertThrows(() => tblGrow.call(tbl1, -1), RangeError);
-    assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), RangeError);
</del><ins>+    assertThrows(() => tblGrow.call(tbl1, -1), TypeError);
+    assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), TypeError);
</ins><span class="cx">     var tbl = new Table({element:"funcref", initial:1, maximum:2});
</span><span class="cx">     assert_equals(tbl.length, 1);
</span><span class="cx">     assert_equals(tbl.grow(0), 1);
</span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/LayoutTests/ChangeLog 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Improve wasm wpt test results by fixing miscellaneous issues
+        https://bugs.webkit.org/show_bug.cgi?id=199783
+
+        Reviewed by Mark Lam.
+
+        * platform/ios-simulator/TestExpectations:
+        * platform/win/TestExpectations:
+
</ins><span class="cx"> 2019-07-15  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Enable a debug WebRTC mode without any encryption
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/LayoutTests/imported/w3c/ChangeLog    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,3 +1,262 @@
</span><ins>+2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Improve wasm wpt test results by fixing miscellaneous issues
+        https://bugs.webkit.org/show_bug.cgi?id=199783
+
+        Reviewed by Mark Lam.
+
+        Import web-platform-tests/wasm/jsapi. Some of tests are failing just because imported wpt tests are old.
+        They are fixed in the upstream. When upgrading wpt tests, we can mark them PASS.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/wasm/jsapi/assertions.js: Added.
+        (assert_function_name):
+        (assert_function_length):
+        * web-platform-tests/wasm/jsapi/bad-imports.js: Added.
+        (test_bad_imports):
+        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html: Added.
+        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js: Added.
+        (test_bad_imports):
+        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/constructor/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/constructor.any.html: Added.
+        * web-platform-tests/wasm/jsapi/global/constructor.any.js: Added.
+        (assert_Global):
+        (test):
+        (test.get assert_array_equals):
+        (string_appeared_here.test):
+        (string_appeared_here.toString):
+        (string_appeared_here.valueOf):
+        (string_appeared_here.name.format_value):
+        * web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/constructor.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/global/toString.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/toString.any.html: Added.
+        * web-platform-tests/wasm/jsapi/global/toString.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/toString.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/value-set.any.html: Added.
+        * web-platform-tests/wasm/jsapi/global/value-set.any.js: Added.
+        (test):
+        (string_appeared_here.name.of.immutableOptions.test):
+        (string_appeared_here.name.of.mutableOptions.test):
+        * web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/value-set.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/valueOf.any.html: Added.
+        * web-platform-tests/wasm/jsapi/global/valueOf.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/global/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js: Added.
+        (test_bad_imports):
+        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor.any.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor.any.js: Added.
+        (assert_exported_function):
+        * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/exports.any.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/exports.any.js: Added.
+        (setup):
+        (test):
+        * web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/exports.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/toString.any.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/toString.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/instance/toString.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/instance/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/interface.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/interface.any.html: Added.
+        * web-platform-tests/wasm/jsapi/interface.any.js: Added.
+        (test_operations):
+        (test):
+        (const.name.of.interfaces.test):
+        * web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/interface.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/buffer.any.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/buffer.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/constructor.any.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/constructor.any.js: Added.
+        (assert_Memory):
+        (test):
+        (const.value.of.outOfRangeValues.test):
+        (test.get new):
+        (test.get assert_array_equals):
+        * web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/grow.any.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/grow.any.js: Added.
+        (assert_ArrayBuffer):
+        (test):
+        (valueOf):
+        (const.value.of.outOfRangeValues.test):
+        * web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/grow.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/toString.any.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/toString.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/toString.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/constructor.any.html: Added.
+        * web-platform-tests/wasm/jsapi/module/constructor.any.js: Added.
+        (setup):
+        (test):
+        * web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/constructor.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/customSections.any.html: Added.
+        * web-platform-tests/wasm/jsapi/module/customSections.any.js: Added.
+        (assert_ArrayBuffer):
+        (assert_sections):
+        (setup):
+        (test):
+        * web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/customSections.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/module/exports.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/exports.any.html: Added.
+        * web-platform-tests/wasm/jsapi/module/exports.any.js: Added.
+        (setup):
+        (assert_ModuleExportDescriptor):
+        (assert_exports):
+        (test):
+        * web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/exports.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/module/imports.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/imports.any.html: Added.
+        * web-platform-tests/wasm/jsapi/module/imports.any.js: Added.
+        (assert_ModuleImportDescriptor):
+        (assert_imports):
+        (setup):
+        (test):
+        * web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/imports.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/module/toString.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/toString.any.html: Added.
+        * web-platform-tests/wasm/jsapi/module/toString.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/module/toString.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/module/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/table/assertions.js: Added.
+        (assert_equal_to_array):
+        * web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/constructor.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/constructor.any.js: Added.
+        (assert_Table):
+        (test):
+        (const.value.of.outOfRangeValues.test):
+        (test.get const):
+        * web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/constructor.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/get-set.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/get-set.any.js: Added.
+        (setup):
+        (test):
+        (test.set assert_equal_to_array):
+        (test.const.fn):
+        (valueOf):
+        (const.value.of.outOfRangeValues.test):
+        * web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/get-set.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/grow.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/grow.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/grow.any.js: Added.
+        (nulls):
+        (test):
+        (valueOf):
+        (const.value.of.outOfRangeValues.test):
+        * web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/grow.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/length.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/length.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/length.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/length.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/toString.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/toString.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/toString.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/toString.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/w3c-import.log: Added.
+        * web-platform-tests/wasm/jsapi/wasm-constants.js: Added.
+        (bytes):
+        (bytesWithHeader):
+        (makeSig):
+        (makeSig_v_x):
+        (makeSig_v_xx):
+        (makeSig_r_v):
+        (makeSig_r_x):
+        (makeSig_r_xx):
+        (assertTraps):
+        (assertWasmThrows):
+        * web-platform-tests/wasm/jsapi/wasm-module-builder.js: Added.
+        (Binary.prototype.emit_u8):
+        (Binary.prototype.emit_u16):
+        (Binary.prototype.emit_u32):
+        (Binary.prototype.emit_u32v):
+        (Binary.prototype.emit_bytes):
+        (Binary.prototype.emit_string):
+        (Binary.prototype.emit_header):
+        (Binary.prototype.emit_section):
+        (Binary):
+        (WasmFunctionBuilder):
+        (WasmFunctionBuilder.prototype.exportAs):
+        (WasmFunctionBuilder.prototype.exportFunc):
+        (WasmFunctionBuilder.prototype.addBody):
+        (WasmFunctionBuilder.prototype.addLocals):
+        (WasmFunctionBuilder.prototype.end):
+        (WasmGlobalBuilder):
+        (WasmGlobalBuilder.prototype.exportAs):
+        (WasmModuleBuilder):
+        (WasmModuleBuilder.prototype.addStart):
+        (WasmModuleBuilder.prototype.addMemory):
+        (WasmModuleBuilder.prototype.addExplicitSection):
+        (WasmModuleBuilder.prototype.addType):
+        (WasmModuleBuilder.prototype.addGlobal):
+        (WasmModuleBuilder.prototype.addFunction):
+        (WasmModuleBuilder.prototype.addImport):
+        (WasmModuleBuilder.prototype.addImportedGlobal):
+        (WasmModuleBuilder.prototype.addImportedMemory):
+        (WasmModuleBuilder.prototype.addImportedTable):
+        (WasmModuleBuilder.prototype.addExport):
+        (WasmModuleBuilder.prototype.addExportOfKind):
+        (WasmModuleBuilder.prototype.addDataSegment):
+        (WasmModuleBuilder.prototype.exportMemoryAs):
+        (WasmModuleBuilder.prototype.addFunctionTableInit):
+        (WasmModuleBuilder.prototype.appendToTable):
+        (WasmModuleBuilder.prototype.setFunctionTableLength):
+        (WasmModuleBuilder.prototype.toArray):
+        (WasmModuleBuilder.prototype.toBuffer):
+        (WasmModuleBuilder.prototype.instantiate):
+
</ins><span class="cx"> 2019-07-09  Cathie Chen  <cathiechen@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Support writing-mode and direction for scrollIntoViewOptions.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cresourcesimportexpectationsjson"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json        2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -343,6 +343,7 @@
</span><span class="cx">     "web-platform-tests/visual-viewport": "import", 
</span><span class="cx">     "web-platform-tests/wai-aria": "skip", 
</span><span class="cx">     "web-platform-tests/wasm": "skip", 
</span><ins>+    "web-platform-tests/wasm/jsapi": "import", 
</ins><span class="cx">     "web-platform-tests/web-animations": "skip", 
</span><span class="cx">     "web-platform-tests/web-nfc": "skip", 
</span><span class="cx">     "web-platform-tests/webaudio": "import", 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiassertionsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/assertions.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/assertions.js                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/assertions.js  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+function assert_function_name(fn, name, description) {
+  const propdesc = Object.getOwnPropertyDescriptor(fn, "name");
+  assert_equals(typeof propdesc, "object", `${description} should have name property`);
+  assert_false(propdesc.writable, "writable", `${description} name should not be writable`);
+  assert_false(propdesc.enumerable, "enumerable", `${description} name should not be enumerable`);
+  assert_true(propdesc.configurable, "configurable", `${description} name should be configurable`);
+  assert_equals(propdesc.value, name, `${description} name should be ${name}`);
+}
+
+function assert_function_length(fn, length, description) {
+  const propdesc = Object.getOwnPropertyDescriptor(fn, "length");
+  assert_equals(typeof propdesc, "object", `${description} should have length property`);
+  assert_false(propdesc.writable, "writable", `${description} length should not be writable`);
+  assert_false(propdesc.enumerable, "enumerable", `${description} length should not be enumerable`);
+  assert_true(propdesc.configurable, "configurable", `${description} length should be configurable`);
+  assert_equals(propdesc.value, length, `${description} length should be ${length}`);
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapibadimportsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/bad-imports.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/bad-imports.js                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/bad-imports.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,140 @@
</span><ins>+function test_bad_imports(t) {
+  for (const value of [null, true, "", Symbol(), 1, 0.1, NaN]) {
+    t(`Non-object imports argument: ${format_value(value)}`,
+      new TypeError(),
+      builder => {},
+      value);
+  }
+
+  for (const value of [undefined, null, true, "", Symbol(), 1, 0.1, NaN]) {
+    const imports = {
+      "module": value,
+    };
+    t(`Non-object module: ${format_value(value)}`,
+      new TypeError(),
+      builder => {
+        builder.addImport("module", "fn", kSig_v_v);
+      },
+      value);
+  }
+
+  t(`Missing imports argument`,
+    new TypeError(),
+    builder => {
+      builder.addImport("module", "fn", kSig_v_v);
+    });
+
+  for (const [value, name] of [[undefined, "undefined"], [{}, "empty object"], [{ "module\0": null }, "wrong property"]]) {
+    t(`Imports argument with missing property: ${name}`,
+      new TypeError(),
+      builder => {
+        builder.addImport("module", "fn", kSig_v_v);
+      },
+      value);
+  }
+
+  t(`Importing an i64 global`,
+    new WebAssembly.LinkError(),
+    builder => {
+      builder.addImportedGlobal("module", "global", kWasmI64);
+    },
+    {
+      "module": {
+        "global": 0,
+      },
+    });
+
+  for (const value of [undefined, null, true, "", Symbol(), 1, 0.1, NaN, {}]) {
+    t(`Importing a function with an incorrectly-typed value: ${format_value(value)}`,
+      new WebAssembly.LinkError(),
+      builder => {
+        builder.addImport("module", "fn", kSig_v_v);
+      },
+      {
+        "module": {
+          "fn": value,
+        },
+      });
+  }
+
+  const nonGlobals = [
+    [undefined],
+    [null],
+    [true],
+    [""],
+    [Symbol()],
+    [{}, "plain object"],
+    [WebAssembly.Global, "WebAssembly.Global"],
+    [WebAssembly.Global.prototype, "WebAssembly.Global.prototype"],
+    [Object.create(WebAssembly.Global.prototype), "Object.create(WebAssembly.Global.prototype)"],
+  ];
+
+  for (const [value, name = format_value(value)] of nonGlobals) {
+    t(`Importing a global with an incorrectly-typed value: ${name}`,
+      new WebAssembly.LinkError(),
+      builder => {
+        builder.addImportedGlobal("module", "global", kWasmI32);
+      },
+      {
+        "module": {
+          "global": value,
+        },
+      });
+  }
+
+  const nonMemories = [
+    [undefined],
+    [null],
+    [true],
+    [""],
+    [Symbol()],
+    [1],
+    [0.1],
+    [NaN],
+    [{}, "plain object"],
+    [WebAssembly.Memory, "WebAssembly.Memory"],
+    [WebAssembly.Memory.prototype, "WebAssembly.Memory.prototype"],
+    [Object.create(WebAssembly.Memory.prototype), "Object.create(WebAssembly.Memory.prototype)"],
+  ];
+
+  for (const [value, name = format_value(value)] of nonMemories) {
+    t(`Importing memory with an incorrectly-typed value: ${name}`,
+      new WebAssembly.LinkError(),
+      builder => {
+        builder.addImportedMemory("module", "memory", 0, 128);
+      },
+      {
+        "module": {
+          "memory": value,
+        },
+      });
+  }
+
+  const nonTables = [
+    [undefined],
+    [null],
+    [true],
+    [""],
+    [Symbol()],
+    [1],
+    [0.1],
+    [NaN],
+    [{}, "plain object"],
+    [WebAssembly.Table, "WebAssembly.Table"],
+    [WebAssembly.Table.prototype, "WebAssembly.Table.prototype"],
+    [Object.create(WebAssembly.Table.prototype), "Object.create(WebAssembly.Table.prototype)"],
+  ];
+
+  for (const [value, name = format_value(value)] of nonTables) {
+    t(`Importing table with an incorrectly-typed value: ${name}`,
+      new WebAssembly.LinkError(),
+      builder => {
+        builder.addImportedTable("module", "table", 0, 128);
+      },
+      {
+        "module": {
+          "table": value,
+        },
+      });
+  }
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+CONSOLE MESSAGE: line 68: TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+PASS WebAssembly.instantiate(module): Non-object imports argument: null 
+PASS WebAssembly.instantiate(module): Non-object imports argument: true 
+PASS WebAssembly.instantiate(module): Non-object imports argument: "" 
+PASS WebAssembly.instantiate(module): Non-object imports argument: symbol "Symbol()" 
+PASS WebAssembly.instantiate(module): Non-object imports argument: 1 
+PASS WebAssembly.instantiate(module): Non-object imports argument: 0.1 
+PASS WebAssembly.instantiate(module): Non-object imports argument: NaN 
+PASS WebAssembly.instantiate(module): Non-object module: undefined 
+PASS WebAssembly.instantiate(module): Non-object module: null 
+PASS WebAssembly.instantiate(module): Non-object module: true 
+PASS WebAssembly.instantiate(module): Non-object module: "" 
+PASS WebAssembly.instantiate(module): Non-object module: symbol "Symbol()" 
+PASS WebAssembly.instantiate(module): Non-object module: 1 
+PASS WebAssembly.instantiate(module): Non-object module: 0.1 
+PASS WebAssembly.instantiate(module): Non-object module: NaN 
+PASS WebAssembly.instantiate(module): Missing imports argument 
+PASS WebAssembly.instantiate(module): Imports argument with missing property: undefined 
+PASS WebAssembly.instantiate(module): Imports argument with missing property: empty object 
+PASS WebAssembly.instantiate(module): Imports argument with missing property: wrong property 
+PASS WebAssembly.instantiate(module): Importing an i64 global 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: undefined 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: null 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: true 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: "" 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: symbol "Symbol()" 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 1 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 0.1 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: NaN 
+PASS WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+// META: script=/wasm/jsapi/bad-imports.js
+
+test_bad_imports((name, error, build, ...arguments) => {
+  promise_test(t => {
+    const builder = new WasmModuleBuilder();
+    build(builder);
+    const buffer = builder.toBuffer();
+    const module = new WebAssembly.Module(buffer);
+    return promise_rejects(t, error, WebAssembly.instantiate(module, ...arguments));
+  }, `WebAssembly.instantiate(module): ${name}`);
+});
+
+test_bad_imports((name, error, build, ...arguments) => {
+  promise_test(t => {
+    const builder = new WasmModuleBuilder();
+    build(builder);
+    const buffer = builder.toBuffer();
+    return promise_rejects(t, error, WebAssembly.instantiate(buffer, ...arguments));
+  }, `WebAssembly.instantiate(buffer): ${name}`);
+});
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+
+Harness Error (FAIL), message = Error in remote http://localhost:8800/wasm/jsapi/bad-imports.js: TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+PASS WebAssembly.instantiate(module): Non-object imports argument: null 
+PASS WebAssembly.instantiate(module): Non-object imports argument: true 
+PASS WebAssembly.instantiate(module): Non-object imports argument: "" 
+PASS WebAssembly.instantiate(module): Non-object imports argument: symbol "Symbol()" 
+PASS WebAssembly.instantiate(module): Non-object imports argument: 1 
+PASS WebAssembly.instantiate(module): Non-object imports argument: 0.1 
+PASS WebAssembly.instantiate(module): Non-object imports argument: NaN 
+PASS WebAssembly.instantiate(module): Non-object module: undefined 
+PASS WebAssembly.instantiate(module): Non-object module: null 
+PASS WebAssembly.instantiate(module): Non-object module: true 
+PASS WebAssembly.instantiate(module): Non-object module: "" 
+PASS WebAssembly.instantiate(module): Non-object module: symbol "Symbol()" 
+PASS WebAssembly.instantiate(module): Non-object module: 1 
+PASS WebAssembly.instantiate(module): Non-object module: 0.1 
+PASS WebAssembly.instantiate(module): Non-object module: NaN 
+PASS WebAssembly.instantiate(module): Missing imports argument 
+PASS WebAssembly.instantiate(module): Imports argument with missing property: undefined 
+TIMEOUT WebAssembly.instantiate(module): Imports argument with missing property: empty object Test timed out
+NOTRUN WebAssembly.instantiate(module): Imports argument with missing property: wrong property 
+NOTRUN WebAssembly.instantiate(module): Importing an i64 global 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: undefined 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: null 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: true 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: "" 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: symbol "Symbol()" 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 1 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: 0.1 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: NaN 
+NOTRUN WebAssembly.instantiate(module): Importing a function with an incorrectly-typed value: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorinstantiatebadimportsanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiconstructorw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/w3c-import.log                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/w3c-import.log     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+
+FAIL name undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(fn, "name")')
+FAIL length undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(fn, "length")')
+PASS No arguments 
+PASS Calling 
+FAIL Order of evaluation undefined is not a constructor (evaluating 'new WebAssembly.Global')
+PASS Invalid descriptor argument 
+PASS Invalid type argument 
+FAIL i64 with default undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Default value for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Explicit value undefined for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value null for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value true for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value false for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value 2 for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value "3" for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with toString for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with valueOf for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Default value for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Explicit value undefined for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value null for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value true for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value false for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value 2 for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value "3" for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with toString for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with valueOf for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Default value for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Explicit value undefined for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value null for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value true for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value false for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value 2 for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value "3" for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with toString for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with valueOf for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.js                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.js      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,121 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/assertions.js
+
+function assert_Global(actual, expected) {
+  assert_equals(Object.getPrototypeOf(actual), WebAssembly.Global.prototype,
+                "prototype");
+  assert_true(Object.isExtensible(actual), "extensible");
+
+  assert_equals(actual.value, expected, "value");
+  assert_equals(actual.valueOf(), expected, "valueOf");
+}
+
+test(() => {
+  assert_function_name(WebAssembly.Global, "Global", "WebAssembly.Global");
+}, "name");
+
+test(() => {
+  assert_function_length(WebAssembly.Global, 1, "WebAssembly.Global");
+}, "length");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Global());
+}, "No arguments");
+
+test(() => {
+  const argument = { "value": "i32" };
+  assert_throws(new TypeError(), () => WebAssembly.Global(argument));
+}, "Calling");
+
+test(() => {
+  const order = [];
+
+  new WebAssembly.Global({
+    get value() {
+      order.push("descriptor value");
+      return {
+        toString() {
+          order.push("descriptor value toString");
+          return "f64";
+        },
+      };
+    },
+
+    get mutable() {
+      order.push("descriptor mutable");
+      return false;
+    },
+  }, {
+    valueOf() {
+      order.push("value valueOf()");
+    }
+  });
+
+  assert_array_equals(order, [
+    "descriptor mutable",
+    "descriptor value",
+    "descriptor value toString",
+    "value valueOf()",
+  ]);
+}, "Order of evaluation");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    false,
+    true,
+    "",
+    "test",
+    Symbol(),
+    1,
+    NaN,
+    {},
+  ];
+  for (const invalidArgument of invalidArguments) {
+    assert_throws(new TypeError(),
+                  () => new WebAssembly.Global(invalidArgument),
+                  `new Global(${format_value(invalidArgument)})`);
+  }
+}, "Invalid descriptor argument");
+
+test(() => {
+  const invalidTypes = ["i16", "i128", "f16", "f128", "u32", "u64", "i32\0"];
+  for (const value of invalidTypes) {
+    const argument = { value };
+    assert_throws(new TypeError(), () => new WebAssembly.Global(argument));
+  }
+}, "Invalid type argument");
+
+test(() => {
+  const argument = { "value": "i64" };
+  const global = new WebAssembly.Global(argument);
+  assert_throws(new TypeError(), () => global.value);
+  assert_throws(new TypeError(), () => global.valueOf());
+}, "i64 with default");
+
+for (const type of ["i32", "f32", "f64"]) {
+  test(() => {
+    const argument = { "value": type };
+    const global = new WebAssembly.Global(argument);
+    assert_Global(global, 0);
+  }, `Default value for type ${type}`);
+
+  const valueArguments = [
+    [undefined, 0],
+    [null, 0],
+    [true, 1],
+    [false, 0],
+    [2, 2],
+    ["3", 3],
+    [{ toString() { return "5" } }, 5, "object with toString"],
+    [{ valueOf() { return "8" } }, 8, "object with valueOf"],
+  ];
+  for (const [value, expected, name = format_value(value)] of valueArguments) {
+    test(() => {
+      const argument = { "value": type };
+      const global = new WebAssembly.Global(argument, value);
+      assert_Global(global, expected);
+    }, `Explicit value ${name} for type ${type}`);
+  }
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+
+FAIL name undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(fn, "name")')
+FAIL length undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(fn, "length")')
+PASS No arguments 
+PASS Calling 
+FAIL Order of evaluation undefined is not a constructor (evaluating 'new WebAssembly.Global')
+PASS Invalid descriptor argument 
+PASS Invalid type argument 
+FAIL i64 with default undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Default value for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Explicit value undefined for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value null for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value true for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value false for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value 2 for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value "3" for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with toString for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with valueOf for type i32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Default value for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Explicit value undefined for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value null for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value true for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value false for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value 2 for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value "3" for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with toString for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with valueOf for type f32 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Default value for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Explicit value undefined for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value null for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value true for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value false for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value 2 for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value "3" for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with toString for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+FAIL Explicit value object with valueOf for type f64 undefined is not a constructor (evaluating 'new WebAssembly.Global(argument, value)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalconstructoranyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any-expected.txt                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any-expected.txt       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+FAIL Object.prototype.toString on an Global undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.js                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const argument = { "value": "i32" };
+  const global = new WebAssembly.Global(argument);
+  assert_class_string(global, "WebAssembly.Global");
+}, "Object.prototype.toString on an Global");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+FAIL Object.prototype.toString on an Global undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobaltoStringanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+
+FAIL Branding undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+FAIL Immutable i32 (missing) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (undefined) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (null) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (false) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (empty string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (zero) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (true) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (one) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (true on prototype) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (missing) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (undefined) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (null) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (false) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (empty string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (zero) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (true) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (one) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (true on prototype) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (missing) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (undefined) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (null) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (false) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (empty string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (zero) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (true) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (one) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (true on prototype) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL i64 with default undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Calling setter without argument undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.js                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.js        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Global,
+    WebAssembly.Global.prototype,
+  ];
+
+  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Global.prototype, "value");
+  assert_equals(typeof desc, "object");
+
+  const getter = desc.get;
+  assert_equals(typeof getter, "function");
+
+  const setter = desc.set;
+  assert_equals(typeof setter, "function");
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => getter.call(thisValue), `getter with this=${format_value(thisValue)}`);
+    assert_throws(new TypeError(), () => setter.call(thisValue, 1), `setter with this=${format_value(thisValue)}`);
+  }
+}, "Branding");
+
+for (const type of ["i32", "f32", "f64"]) {
+  const immutableOptions = [
+    [{}, "missing"],
+    [{ "mutable": undefined }, "undefined"],
+    [{ "mutable": null }, "null"],
+    [{ "mutable": false }, "false"],
+    [{ "mutable": "" }, "empty string"],
+    [{ "mutable": 0 }, "zero"],
+  ];
+  for (const [opts, name] of immutableOptions) {
+    test(() => {
+      opts.value = type;
+      const global = new WebAssembly.Global(opts);
+      assert_equals(global.value, 0, "initial value");
+      assert_equals(global.valueOf(), 0, "initial valueOf");
+
+      assert_throws(new TypeError(), () => global.value = 1);
+
+      assert_equals(global.value, 0, "post-set value");
+      assert_equals(global.valueOf(), 0, "post-set valueOf");
+    }, `Immutable ${type} (${name})`);
+  }
+
+  const mutableOptions = [
+    [{ "mutable": true }, "true"],
+    [{ "mutable": 1 }, "one"],
+    [{ "mutable": "x" }, "string"],
+    [Object.create({ "mutable": true }), "true on prototype"],
+  ];
+  for (const [opts, name] of mutableOptions) {
+    test(() => {
+      opts.value = type;
+      const global = new WebAssembly.Global(opts);
+      assert_equals(global.value, 0, "initial value");
+      assert_equals(global.valueOf(), 0, "initial valueOf");
+
+      global.value = 1;
+
+      assert_equals(global.value, 1, "post-set value");
+      assert_equals(global.valueOf(), 1, "post-set valueOf");
+    }, `Mutable ${type} (${name})`);
+  }
+}
+
+test(() => {
+  const argument = { "value": "i64", "mutable": true };
+  const global = new WebAssembly.Global(argument);
+  assert_throws(new TypeError(), () => global.value);
+  assert_throws(new TypeError(), () => global.value = 0);
+  assert_throws(new TypeError(), () => global.valueOf());
+}, "i64 with default");
+
+
+test(() => {
+  const argument = { "value": "i32", "mutable": true };
+  const global = new WebAssembly.Global(argument);
+  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Global.prototype, "value");
+  assert_equals(typeof desc, "object");
+
+  const setter = desc.set;
+  assert_equals(typeof setter, "function");
+
+  assert_throws(new TypeError(), () => setter.call(global));
+}, "Calling setter without argument");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+
+FAIL Branding undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+FAIL Immutable i32 (missing) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (undefined) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (null) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (false) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (empty string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable i32 (zero) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (true) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (one) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable i32 (true on prototype) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (missing) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (undefined) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (null) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (false) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (empty string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f32 (zero) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (true) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (one) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f32 (true on prototype) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (missing) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (undefined) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (null) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (false) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (empty string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Immutable f64 (zero) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (true) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (one) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (string) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL Mutable f64 (true on prototype) undefined is not a constructor (evaluating 'new WebAssembly.Global(opts)')
+FAIL i64 with default undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+FAIL Calling setter without argument undefined is not a constructor (evaluating 'new WebAssembly.Global(argument)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvaluesetanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+FAIL Branding undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.js                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.js  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const argument = { "value": "i32" };
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Global,
+    WebAssembly.Global.prototype,
+  ];
+
+  const fn = WebAssembly.Global.prototype.valueOf;
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => fn.call(thisValue), `this=${format_value(thisValue)}`);
+  }
+}, "Branding");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+FAIL Branding undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalvalueOfanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiglobalw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+CONSOLE MESSAGE: line 68: TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+PASS new WebAssembly.Instance(module): Non-object imports argument: null 
+PASS new WebAssembly.Instance(module): Non-object imports argument: true 
+PASS new WebAssembly.Instance(module): Non-object imports argument: "" 
+PASS new WebAssembly.Instance(module): Non-object imports argument: symbol "Symbol()" 
+PASS new WebAssembly.Instance(module): Non-object imports argument: 1 
+PASS new WebAssembly.Instance(module): Non-object imports argument: 0.1 
+PASS new WebAssembly.Instance(module): Non-object imports argument: NaN 
+PASS new WebAssembly.Instance(module): Non-object module: undefined 
+PASS new WebAssembly.Instance(module): Non-object module: null 
+PASS new WebAssembly.Instance(module): Non-object module: true 
+PASS new WebAssembly.Instance(module): Non-object module: "" 
+PASS new WebAssembly.Instance(module): Non-object module: symbol "Symbol()" 
+PASS new WebAssembly.Instance(module): Non-object module: 1 
+PASS new WebAssembly.Instance(module): Non-object module: 0.1 
+PASS new WebAssembly.Instance(module): Non-object module: NaN 
+PASS new WebAssembly.Instance(module): Missing imports argument 
+PASS new WebAssembly.Instance(module): Imports argument with missing property: undefined 
+PASS new WebAssembly.Instance(module): Imports argument with missing property: empty object 
+PASS new WebAssembly.Instance(module): Imports argument with missing property: wrong property 
+PASS new WebAssembly.Instance(module): Importing an i64 global 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: undefined 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: null 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: true 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: "" 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: symbol "Symbol()" 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: 1 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: 0.1 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: NaN 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+// META: script=/wasm/jsapi/bad-imports.js
+
+test_bad_imports((name, error, build, ...arguments) => {
+  test(() => {
+    const builder = new WasmModuleBuilder();
+    build(builder);
+    const buffer = builder.toBuffer();
+    const module = new WebAssembly.Module(buffer);
+    assert_throws(error, () => new WebAssembly.Instance(module, ...arguments));
+  }, `new WebAssembly.Instance(module): ${name}`);
+});
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
+CONSOLE MESSAGE: line 68: TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+PASS new WebAssembly.Instance(module): Non-object imports argument: null 
+PASS new WebAssembly.Instance(module): Non-object imports argument: true 
+PASS new WebAssembly.Instance(module): Non-object imports argument: "" 
+PASS new WebAssembly.Instance(module): Non-object imports argument: symbol "Symbol()" 
+PASS new WebAssembly.Instance(module): Non-object imports argument: 1 
+PASS new WebAssembly.Instance(module): Non-object imports argument: 0.1 
+PASS new WebAssembly.Instance(module): Non-object imports argument: NaN 
+PASS new WebAssembly.Instance(module): Non-object module: undefined 
+PASS new WebAssembly.Instance(module): Non-object module: null 
+PASS new WebAssembly.Instance(module): Non-object module: true 
+PASS new WebAssembly.Instance(module): Non-object module: "" 
+PASS new WebAssembly.Instance(module): Non-object module: symbol "Symbol()" 
+PASS new WebAssembly.Instance(module): Non-object module: 1 
+PASS new WebAssembly.Instance(module): Non-object module: 0.1 
+PASS new WebAssembly.Instance(module): Non-object module: NaN 
+PASS new WebAssembly.Instance(module): Missing imports argument 
+PASS new WebAssembly.Instance(module): Imports argument with missing property: undefined 
+PASS new WebAssembly.Instance(module): Imports argument with missing property: empty object 
+PASS new WebAssembly.Instance(module): Imports argument with missing property: wrong property 
+PASS new WebAssembly.Instance(module): Importing an i64 global 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: undefined 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: null 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: true 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: "" 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: symbol "Symbol()" 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: 1 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: 0.1 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: NaN 
+PASS new WebAssembly.Instance(module): Importing a function with an incorrectly-typed value: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructorbadimportsanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Non-Module arguments 
+PASS Non-object imports 
+PASS Calling 
+PASS Empty module 
+PASS getter order for imports object 
+PASS imports 
+FAIL exports WebAssembly.Module doesn't parse at byte 87: 3th Export isn't immutable, named 'global' (evaluating 'new WebAssembly.Module(buffer)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.js                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.js    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,227 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+// META: script=/wasm/jsapi/assertions.js
+
+function assert_exported_function(fn, { name, length }, description) {
+  assert_equals(Object.getPrototypeOf(fn), Function.prototype,
+                `${description}: prototype`);
+
+  assert_function_name(fn, name, description);
+  assert_function_length(fn, length, description);
+}
+
+function assert_Instance(instance, expected_exports) {
+  assert_equals(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype,
+                "prototype");
+  assert_true(Object.isExtensible(instance), "extensible");
+
+  assert_equals(instance.exports, instance.exports, "exports should be idempotent");
+  const exports = instance.exports;
+
+  assert_equals(Object.getPrototypeOf(exports), null, "exports prototype");
+  assert_false(Object.isExtensible(exports), "extensible exports");
+  for (const [key, expected] of Object.entries(expected_exports)) {
+    const property = Object.getOwnPropertyDescriptor(exports, key);
+    assert_equals(typeof property, "object", `${key} should be present`);
+    assert_false(property.writable, `${key}: writable`);
+    assert_true(property.enumerable, `${key}: enumerable`);
+    assert_false(property.configurable, `${key}: configurable`);
+    const actual = property.value;
+    assert_true(Object.isExtensible(actual), `${key}: extensible`);
+
+    switch (expected.kind) {
+    case "function":
+      assert_exported_function(actual, expected, `value of ${key}`);
+      break;
+    case "global":
+      assert_equals(Object.getPrototypeOf(actual), WebAssembly.Global.prototype,
+                    `value of ${key}: prototype`);
+      assert_equals(actual.value, expected.value, `value of ${key}: value`);
+      assert_equals(actual.valueOf(), expected.value, `value of ${key}: valueOf()`);
+      break;
+    case "memory":
+      assert_equals(Object.getPrototypeOf(actual), WebAssembly.Memory.prototype,
+                    `value of ${key}: prototype`);
+      assert_equals(Object.getPrototypeOf(actual.buffer), ArrayBuffer.prototype,
+                    `value of ${key}: prototype of buffer`);
+      assert_equals(actual.buffer.byteLength, 0x10000 * expected.size, `value of ${key}: size of buffer`);
+      const array = new Uint8Array(actual.buffer);
+      assert_equals(array[0], 0, `value of ${key}: first element of buffer`);
+      assert_equals(array[array.byteLength - 1], 0, `value of ${key}: last element of buffer`);
+      break;
+    case "table":
+      assert_equals(Object.getPrototypeOf(actual), WebAssembly.Table.prototype,
+                    `value of ${key}: prototype`);
+      assert_equals(actual.length, expected.length, `value of ${key}: length of table`);
+      break;
+    }
+  }
+}
+
+let emptyModuleBinary;
+setup(() => {
+  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+});
+
+test(() => {
+  assert_function_name(WebAssembly.Instance, "Instance", "WebAssembly.Instance");
+}, "name");
+
+test(() => {
+  assert_function_length(WebAssembly.Instance, 1, "WebAssembly.Instance");
+}, "length");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Instance());
+}, "No arguments");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => new WebAssembly.Instance(argument),
+                  `new Instance(${format_value(argument)})`);
+  }
+}, "Non-Module arguments");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const invalidArguments = [
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => new WebAssembly.Instance(module, argument),
+                  `new Instance(module, ${format_value(argument)})`);
+  }
+}, "Non-object imports");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_throws(new TypeError(), () => WebAssembly.Instance(module));
+}, "Calling");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const arguments = [
+    [],
+    [undefined],
+    [{}],
+  ];
+  for (const value of arguments) {
+    const instance = new WebAssembly.Instance(module, ...arguments);
+    assert_Instance(instance, {});
+  }
+}, "Empty module");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+  builder.addImportedGlobal("module", "global1", kWasmI32);
+  builder.addImportedGlobal("module", "global2", kWasmI32);
+  const buffer = builder.toBuffer();
+  const module = new WebAssembly.Module(buffer);
+  const order = [];
+  const imports = {
+    get module() {
+      order.push("module getter");
+      return {
+        get global1() {
+          order.push("global1 getter");
+          return 0;
+        },
+        get global2() {
+          order.push("global2 getter");
+          return 0;
+        },
+      }
+    },
+  };
+  new WebAssembly.Instance(module, imports);
+  const expected = [
+    "module getter",
+    "global1 getter",
+    "module getter",
+    "global2 getter",
+  ];
+  assert_array_equals(order, expected);
+}, "getter order for imports object");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.addImport("module", "fn", kSig_v_v);
+  builder.addImportedGlobal("module", "global", kWasmI32);
+  builder.addImportedMemory("module", "memory", 0, 128);
+  builder.addImportedTable("module", "table", 0, 128);
+
+  const buffer = builder.toBuffer();
+  const module = new WebAssembly.Module(buffer);
+  const instance = new WebAssembly.Instance(module, {
+    "module": {
+      "fn": function() {},
+      "global": 0,
+      "memory": new WebAssembly.Memory({ "initial": 64, maximum: 128 }),
+      "table": new WebAssembly.Table({ "element": "anyfunc", "initial": 64, maximum: 128 }),
+    },
+    get "module2"() {
+      assert_unreached("Should not get modules that are not imported");
+    },
+  });
+  assert_Instance(instance, {});
+}, "imports");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder
+    .addFunction("fn", kSig_v_d)
+    .addBody([
+        kExprEnd
+    ])
+    .exportFunc();
+  builder
+    .addFunction("fn2", kSig_v_v)
+    .addBody([
+        kExprEnd
+    ])
+    .exportFunc();
+
+  builder.setFunctionTableLength(1);
+  builder.addExportOfKind("table", kExternalTable, 0);
+
+  builder.addGlobal(kWasmI32, true)
+    .exportAs("global")
+    .init = 7;
+  builder.addGlobal(kWasmF64, true)
+    .exportAs("global2")
+    .init = 1.2;
+
+  builder.addMemory(4, 8, true);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+
+  const instance = new WebAssembly.Instance(module, {});
+  const expected = {
+    "fn": { "kind": "function", "name": "0", "length": 1 },
+    "fn2": { "kind": "function", "name": "1", "length": 0 },
+    "table": { "kind": "table", "length": 1 },
+    "global": { "kind": "global", "value": 7 },
+    "global2": { "kind": "global", "value": 1.2 },
+    "memory": { "kind": "memory", "size": 4 },
+  };
+  assert_Instance(instance, expected);
+}, "exports");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Non-Module arguments 
+PASS Non-object imports 
+PASS Calling 
+PASS Empty module 
+PASS getter order for imports object 
+PASS imports 
+FAIL exports WebAssembly.Module doesn't parse at byte 87: 3th Export isn't immutable, named 'global' (evaluating 'new WebAssembly.Module(buffer)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceconstructoranyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Branding 
+PASS Setting (sloppy mode) 
+PASS Setting (strict mode) 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.js                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.js        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+let emptyModuleBinary;
+setup(() => {
+  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+});
+
+test(() => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Instance,
+    WebAssembly.Instance.prototype,
+  ];
+
+  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports");
+  assert_equals(typeof desc, "object");
+
+  const getter = desc.get;
+  assert_equals(typeof getter, "function");
+
+  assert_equals(typeof desc.set, "undefined");
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`);
+  }
+}, "Branding");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const instance = new WebAssembly.Instance(module);
+  const exports = instance.exports;
+  instance.exports = {};
+  assert_equals(instance.exports, exports, "Should not change the exports");
+}, "Setting (sloppy mode)");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const instance = new WebAssembly.Instance(module);
+  const exports = instance.exports;
+  assert_throws(new TypeError(), () => {
+    "use strict";
+    instance.exports = {};
+  });
+  assert_equals(instance.exports, exports, "Should not change the exports");
+}, "Setting (strict mode)");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Branding 
+PASS Setting (sloppy mode) 
+PASS Setting (strict mode) 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstanceexportsanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Instance 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+test(() => {
+  const emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const instance = new WebAssembly.Instance(module);
+  assert_class_string(instance, "WebAssembly.Instance");
+}, "Object.prototype.toString on an Instance");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Instance 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancetoStringanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinstancew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/w3c-import.log                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/w3c-import.log        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+CONSOLE MESSAGE: line 154: TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+PASS WebAssembly: property descriptor 
+PASS WebAssembly: calling 
+PASS WebAssembly: constructing 
+PASS WebAssembly.Module: property descriptor 
+PASS WebAssembly.Module: prototype 
+PASS WebAssembly.Module: prototype.constructor 
+PASS WebAssembly.Instance: property descriptor 
+PASS WebAssembly.Instance: prototype 
+PASS WebAssembly.Instance: prototype.constructor 
+PASS WebAssembly.Memory: property descriptor 
+PASS WebAssembly.Memory: prototype 
+PASS WebAssembly.Memory: prototype.constructor 
+PASS WebAssembly.Table: property descriptor 
+PASS WebAssembly.Table: prototype 
+PASS WebAssembly.Table: prototype.constructor 
+FAIL WebAssembly.Global: property descriptor assert_equals: expected "object" but got "undefined"
+FAIL WebAssembly.Global: prototype undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(interface_object, "prototype")')
+FAIL WebAssembly.Global: prototype.constructor undefined is not an object (evaluating 'interface_object.prototype')
+PASS WebAssembly.CompileError: property descriptor 
+PASS WebAssembly.CompileError: prototype 
+PASS WebAssembly.CompileError: prototype.constructor 
+PASS WebAssembly.LinkError: property descriptor 
+PASS WebAssembly.LinkError: prototype 
+PASS WebAssembly.LinkError: prototype.constructor 
+PASS WebAssembly.RuntimeError: property descriptor 
+PASS WebAssembly.RuntimeError: prototype 
+PASS WebAssembly.RuntimeError: prototype.constructor 
+PASS WebAssembly.validate 
+PASS WebAssembly.validate: name 
+PASS WebAssembly.validate: length 
+PASS WebAssembly.compile 
+PASS WebAssembly.compile: name 
+PASS WebAssembly.compile: length 
+PASS WebAssembly.instantiate 
+PASS WebAssembly.instantiate: name 
+PASS WebAssembly.instantiate: length 
+FAIL WebAssembly.Module.exports assert_equals: expected (undefined) undefined but got (function) function "function exports() {
+    [native code]
+}"
+PASS WebAssembly.Module.exports: name 
+PASS WebAssembly.Module.exports: length 
+FAIL WebAssembly.Module.imports assert_equals: expected (undefined) undefined but got (function) function "function imports() {
+    [native code]
+}"
+PASS WebAssembly.Module.imports: name 
+PASS WebAssembly.Module.imports: length 
+FAIL WebAssembly.Module.customSections assert_equals: expected (undefined) undefined but got (function) function "function customSections() {
+    [native code]
+}"
+PASS WebAssembly.Module.customSections: name 
+PASS WebAssembly.Module.customSections: length 
+PASS WebAssembly.Instance.exports 
+PASS WebAssembly.Instance.exports: getter 
+PASS WebAssembly.Instance.exports: setter 
+FAIL WebAssembly.Memory.grow assert_equals: expected (undefined) undefined but got (function) function "function grow() {
+    [native code]
+}"
+PASS WebAssembly.Memory.grow: name 
+PASS WebAssembly.Memory.grow: length 
+PASS WebAssembly.Memory.buffer 
+PASS WebAssembly.Memory.buffer: getter 
+PASS WebAssembly.Memory.buffer: setter 
+FAIL WebAssembly.Table.grow assert_equals: expected (undefined) undefined but got (function) function "function grow() {
+    [native code]
+}"
+PASS WebAssembly.Table.grow: name 
+PASS WebAssembly.Table.grow: length 
+FAIL WebAssembly.Table.get assert_equals: expected (undefined) undefined but got (function) function "function get() {
+    [native code]
+}"
+PASS WebAssembly.Table.get: name 
+PASS WebAssembly.Table.get: length 
+FAIL WebAssembly.Table.set assert_equals: expected (undefined) undefined but got (function) function "function set() {
+    [native code]
+}"
+PASS WebAssembly.Table.set: name 
+PASS WebAssembly.Table.set: length 
+PASS WebAssembly.Table.length 
+PASS WebAssembly.Table.length: getter 
+PASS WebAssembly.Table.length: setter 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.js                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.js       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/assertions.js
+
+function test_operations(object, object_name, operations) {
+  for (const [name, length] of operations) {
+    test(() => {
+      const propdesc = Object.getOwnPropertyDescriptor(object, name);
+      assert_equals(typeof propdesc, "object");
+      assert_true(propdesc.writable, "writable");
+      assert_true(propdesc.enumerable, "enumerable");
+      assert_true(propdesc.configurable, "configurable");
+      assert_equals(propdesc.value, WebAssembly[name]);
+    }, `${object_name}.${name}`);
+
+    test(() => {
+      assert_function_name(object[name], name, `${object_name}.${name}`);
+    }, `${object_name}.${name}: name`);
+
+    test(() => {
+      assert_function_length(object[name], length, `${object_name}.${name}`);
+    }, `${object_name}.${name}: length`);
+  }
+}
+
+function test_attributes(object, object_name, attributes) {
+  for (const [name, mutable] of attributes) {
+    test(() => {
+      const propdesc = Object.getOwnPropertyDescriptor(object, name);
+      assert_equals(typeof propdesc, "object");
+      assert_true(propdesc.enumerable, "enumerable");
+      assert_true(propdesc.configurable, "configurable");
+    }, `${object_name}.${name}`);
+
+    test(() => {
+      const propdesc = Object.getOwnPropertyDescriptor(object, name);
+      assert_equals(typeof propdesc, "object");
+      assert_equals(typeof propdesc.get, "function");
+      assert_function_name(propdesc.get, "get " + name, `getter for "${name}"`);
+      assert_function_length(propdesc.get, 0, `getter for "${name}"`);
+    }, `${object_name}.${name}: getter`);
+
+    test(() => {
+      const propdesc = Object.getOwnPropertyDescriptor(object, name);
+      assert_equals(typeof propdesc, "object");
+      if (mutable) {
+        assert_equals(typeof propdesc.set, "function");
+        assert_function_name(propdesc.set, "set " + name, `setter for "${name}"`);
+        assert_function_length(propdesc.set, 1, `setter for "${name}"`);
+      } else {
+        assert_equals(typeof propdesc.set, "undefined");
+      }
+    }, `${object_name}.${name}: setter`);
+  }
+}
+
+test(() => {
+  const propdesc = Object.getOwnPropertyDescriptor(this, "WebAssembly");
+  assert_equals(typeof propdesc, "object");
+  assert_true(propdesc.writable, "writable");
+  assert_false(propdesc.enumerable, "enumerable");
+  assert_true(propdesc.configurable, "configurable");
+  assert_equals(propdesc.value, this.WebAssembly);
+}, "WebAssembly: property descriptor");
+
+test(() => {
+  assert_throws(new TypeError(), () => WebAssembly());
+}, "WebAssembly: calling");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly());
+}, "WebAssembly: constructing");
+
+const interfaces = [
+  "Module",
+  "Instance",
+  "Memory",
+  "Table",
+  "Global",
+  "CompileError",
+  "LinkError",
+  "RuntimeError",
+];
+
+for (const name of interfaces) {
+  test(() => {
+    const propdesc = Object.getOwnPropertyDescriptor(WebAssembly, name);
+    assert_equals(typeof propdesc, "object");
+    assert_true(propdesc.writable, "writable");
+    assert_false(propdesc.enumerable, "enumerable");
+    assert_true(propdesc.configurable, "configurable");
+    assert_equals(propdesc.value, WebAssembly[name]);
+  }, `WebAssembly.${name}: property descriptor`);
+
+  test(() => {
+    const interface_object = WebAssembly[name];
+    const propdesc = Object.getOwnPropertyDescriptor(interface_object, "prototype");
+    assert_equals(typeof propdesc, "object");
+    assert_false(propdesc.writable, "writable");
+    assert_false(propdesc.enumerable, "enumerable");
+    assert_false(propdesc.configurable, "configurable");
+  }, `WebAssembly.${name}: prototype`);
+
+  test(() => {
+    const interface_object = WebAssembly[name];
+    const interface_prototype_object = interface_object.prototype;
+    const propdesc = Object.getOwnPropertyDescriptor(interface_prototype_object, "constructor");
+    assert_equals(typeof propdesc, "object");
+    assert_true(propdesc.writable, "writable");
+    assert_false(propdesc.enumerable, "enumerable");
+    assert_true(propdesc.configurable, "configurable");
+    assert_equals(propdesc.value, interface_object);
+  }, `WebAssembly.${name}: prototype.constructor`);
+}
+
+test_operations(WebAssembly, "WebAssembly", [
+  ["validate", 1],
+  ["compile", 1],
+  ["instantiate", 1],
+]);
+
+
+test_operations(WebAssembly.Module, "WebAssembly.Module", [
+  ["exports", 1],
+  ["imports", 1],
+  ["customSections", 2],
+]);
+
+
+test_attributes(WebAssembly.Instance.prototype, "WebAssembly.Instance", [
+  ["exports", false],
+]);
+
+
+test_operations(WebAssembly.Memory.prototype, "WebAssembly.Memory", [
+  ["grow", 1],
+]);
+
+test_attributes(WebAssembly.Memory.prototype, "WebAssembly.Memory", [
+  ["buffer", false],
+]);
+
+
+test_operations(WebAssembly.Table.prototype, "WebAssembly.Table", [
+  ["grow", 1],
+  ["get", 1],
+  ["set", 2],
+]);
+
+test_attributes(WebAssembly.Table.prototype, "WebAssembly.Table", [
+  ["length", false],
+]);
+
+
+test_operations(WebAssembly.Global.prototype, "WebAssembly.Global", [
+  ["valueOf", 0],
+]);
+
+test_attributes(WebAssembly.Global.prototype, "WebAssembly.Global", [
+  ["value", true],
+]);
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
+CONSOLE MESSAGE: line 154: TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'WebAssembly.Global.prototype')
+
+PASS WebAssembly: property descriptor 
+PASS WebAssembly: calling 
+PASS WebAssembly: constructing 
+PASS WebAssembly.Module: property descriptor 
+PASS WebAssembly.Module: prototype 
+PASS WebAssembly.Module: prototype.constructor 
+PASS WebAssembly.Instance: property descriptor 
+PASS WebAssembly.Instance: prototype 
+PASS WebAssembly.Instance: prototype.constructor 
+PASS WebAssembly.Memory: property descriptor 
+PASS WebAssembly.Memory: prototype 
+PASS WebAssembly.Memory: prototype.constructor 
+PASS WebAssembly.Table: property descriptor 
+PASS WebAssembly.Table: prototype 
+PASS WebAssembly.Table: prototype.constructor 
+FAIL WebAssembly.Global: property descriptor assert_equals: expected "object" but got "undefined"
+FAIL WebAssembly.Global: prototype undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(interface_object, "prototype")')
+FAIL WebAssembly.Global: prototype.constructor undefined is not an object (evaluating 'interface_object.prototype')
+PASS WebAssembly.CompileError: property descriptor 
+PASS WebAssembly.CompileError: prototype 
+PASS WebAssembly.CompileError: prototype.constructor 
+PASS WebAssembly.LinkError: property descriptor 
+PASS WebAssembly.LinkError: prototype 
+PASS WebAssembly.LinkError: prototype.constructor 
+PASS WebAssembly.RuntimeError: property descriptor 
+PASS WebAssembly.RuntimeError: prototype 
+PASS WebAssembly.RuntimeError: prototype.constructor 
+PASS WebAssembly.validate 
+PASS WebAssembly.validate: name 
+PASS WebAssembly.validate: length 
+PASS WebAssembly.compile 
+PASS WebAssembly.compile: name 
+PASS WebAssembly.compile: length 
+PASS WebAssembly.instantiate 
+PASS WebAssembly.instantiate: name 
+PASS WebAssembly.instantiate: length 
+FAIL WebAssembly.Module.exports assert_equals: expected (undefined) undefined but got (function) function "function exports() {
+    [native code]
+}"
+PASS WebAssembly.Module.exports: name 
+PASS WebAssembly.Module.exports: length 
+FAIL WebAssembly.Module.imports assert_equals: expected (undefined) undefined but got (function) function "function imports() {
+    [native code]
+}"
+PASS WebAssembly.Module.imports: name 
+PASS WebAssembly.Module.imports: length 
+FAIL WebAssembly.Module.customSections assert_equals: expected (undefined) undefined but got (function) function "function customSections() {
+    [native code]
+}"
+PASS WebAssembly.Module.customSections: name 
+PASS WebAssembly.Module.customSections: length 
+PASS WebAssembly.Instance.exports 
+PASS WebAssembly.Instance.exports: getter 
+PASS WebAssembly.Instance.exports: setter 
+FAIL WebAssembly.Memory.grow assert_equals: expected (undefined) undefined but got (function) function "function grow() {
+    [native code]
+}"
+PASS WebAssembly.Memory.grow: name 
+PASS WebAssembly.Memory.grow: length 
+PASS WebAssembly.Memory.buffer 
+PASS WebAssembly.Memory.buffer: getter 
+PASS WebAssembly.Memory.buffer: setter 
+FAIL WebAssembly.Table.grow assert_equals: expected (undefined) undefined but got (function) function "function grow() {
+    [native code]
+}"
+PASS WebAssembly.Table.grow: name 
+PASS WebAssembly.Table.grow: length 
+FAIL WebAssembly.Table.get assert_equals: expected (undefined) undefined but got (function) function "function get() {
+    [native code]
+}"
+PASS WebAssembly.Table.get: name 
+PASS WebAssembly.Table.get: length 
+FAIL WebAssembly.Table.set assert_equals: expected (undefined) undefined but got (function) function "function set() {
+    [native code]
+}"
+PASS WebAssembly.Table.set: name 
+PASS WebAssembly.Table.set: length 
+PASS WebAssembly.Table.length 
+PASS WebAssembly.Table.length: getter 
+PASS WebAssembly.Table.length: setter 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiinterfaceanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Branding 
+PASS Setting (sloppy mode) 
+PASS Setting (strict mode) 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.js   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Memory,
+    WebAssembly.Memory.prototype,
+  ];
+
+  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Memory.prototype, "buffer");
+  assert_equals(typeof desc, "object");
+
+  const getter = desc.get;
+  assert_equals(typeof getter, "function");
+
+  assert_equals(typeof desc.set, "undefined");
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`);
+  }
+}, "Branding");
+
+test(() => {
+  const argument = { "initial": 0 };
+  const memory = new WebAssembly.Memory(argument);
+  const memory2 = new WebAssembly.Memory(argument);
+  const buffer = memory.buffer;
+  assert_not_equals(buffer, memory2.buffer, "Need two distinct buffers");
+  memory.buffer = memory2.buffer;
+  assert_equals(memory.buffer, buffer, "Should not change the buffer");
+}, "Setting (sloppy mode)");
+
+test(() => {
+  const argument = { "initial": 0 };
+  const memory = new WebAssembly.Memory(argument);
+  const memory2 = new WebAssembly.Memory(argument);
+  const buffer = memory.buffer;
+  assert_not_equals(buffer, memory2.buffer, "Need two distinct buffers");
+  assert_throws(new TypeError(), () => {
+    "use strict";
+    memory.buffer = memory2.buffer;
+  });
+  assert_equals(memory.buffer, buffer, "Should not change the buffer");
+}, "Setting (strict mode)");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Branding 
+PASS Setting (sloppy mode) 
+PASS Setting (strict mode) 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorybufferanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Calling 
+PASS Invalid descriptor argument 
+PASS Undefined initial value in descriptor 
+PASS Out-of-range initial value in descriptor: NaN 
+PASS Out-of-range maximum value in descriptor: NaN 
+PASS Out-of-range initial value in descriptor: Infinity 
+PASS Out-of-range maximum value in descriptor: Infinity 
+PASS Out-of-range initial value in descriptor: -Infinity 
+PASS Out-of-range maximum value in descriptor: -Infinity 
+PASS Out-of-range initial value in descriptor: -1 
+PASS Out-of-range maximum value in descriptor: -1 
+PASS Out-of-range initial value in descriptor: 4294967296 
+PASS Out-of-range maximum value in descriptor: 4294967296 
+PASS Out-of-range initial value in descriptor: 68719476736 
+PASS Out-of-range maximum value in descriptor: 68719476736 
+PASS Proxy descriptor 
+PASS Order of evaluation for descriptor 
+PASS Zero initial 
+PASS Non-zero initial 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.js                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.js      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,137 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/assertions.js
+
+function assert_Memory(memory, expected) {
+  assert_equals(Object.getPrototypeOf(memory), WebAssembly.Memory.prototype,
+                "prototype");
+  assert_true(Object.isExtensible(memory), "extensible");
+
+  // https://github.com/WebAssembly/spec/issues/840
+  assert_equals(memory.buffer, memory.buffer, "buffer should be idempotent");
+  assert_equals(Object.getPrototypeOf(memory.buffer), ArrayBuffer.prototype,
+                "prototype of buffer");
+  assert_true(Object.isExtensible(memory.buffer), "buffer extensibility");
+  assert_equals(memory.buffer.byteLength, 0x10000 * expected.size, "size of buffer");
+  if (expected.size > 0) {
+    const array = new Uint8Array(memory.buffer);
+    assert_equals(array[0], 0, "first element of buffer");
+    assert_equals(array[array.byteLength - 1], 0, "last element of buffer");
+  }
+}
+
+test(() => {
+  assert_function_name(WebAssembly.Memory, "Memory", "WebAssembly.Memory");
+}, "name");
+
+test(() => {
+  assert_function_length(WebAssembly.Memory, 1, "WebAssembly.Memory");
+}, "length");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Memory());
+}, "No arguments");
+
+test(() => {
+  const argument = { "initial": 0 };
+  assert_throws(new TypeError(), () => WebAssembly.Memory(argument));
+}, "Calling");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    false,
+    true,
+    "",
+    "test",
+    Symbol(),
+    1,
+    NaN,
+    {},
+  ];
+  for (const invalidArgument of invalidArguments) {
+    assert_throws(new TypeError(),
+                  () => new WebAssembly.Memory(invalidArgument),
+                  `new Memory(${format_value(invalidArgument)})`);
+  }
+}, "Invalid descriptor argument");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": undefined }));
+}, "Undefined initial value in descriptor");
+
+const outOfRangeValues = [
+  NaN,
+  Infinity,
+  -Infinity,
+  -1,
+  0x100000000,
+  0x1000000000,
+];
+
+for (const value of outOfRangeValues) {
+  test(() => {
+    assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": value }));
+  }, `Out-of-range initial value in descriptor: ${format_value(value)}`);
+
+  test(() => {
+    assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": 0, "maximum": value }));
+  }, `Out-of-range maximum value in descriptor: ${format_value(value)}`);
+}
+
+test(() => {
+  const proxy = new Proxy({}, {
+    has(o, x) {
+      assert_unreached(`Should not call [[HasProperty]] with ${x}`);
+    },
+    get(o, x) {
+      return 0;
+    },
+  });
+  new WebAssembly.Memory(proxy);
+}, "Proxy descriptor");
+
+test(() => {
+  const order = [];
+
+  new WebAssembly.Memory({
+    get maximum() {
+      order.push("maximum");
+      return {
+        valueOf() {
+          order.push("maximum valueOf");
+          return 1;
+        },
+      };
+    },
+
+    get initial() {
+      order.push("initial");
+      return {
+        valueOf() {
+          order.push("initial valueOf");
+          return 1;
+        },
+      };
+    },
+  });
+
+  assert_array_equals(order, [
+    "initial",
+    "initial valueOf",
+    "maximum",
+    "maximum valueOf",
+  ]);
+}, "Order of evaluation for descriptor");
+
+test(() => {
+  const argument = { "initial": 0 };
+  const memory = new WebAssembly.Memory(argument);
+  assert_Memory(memory, { "size": 0 });
+}, "Zero initial");
+
+test(() => {
+  const argument = { "initial": 4 };
+  const memory = new WebAssembly.Memory(argument);
+  assert_Memory(memory, { "size": 4 });
+}, "Non-zero initial");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Calling 
+PASS Invalid descriptor argument 
+PASS Undefined initial value in descriptor 
+PASS Out-of-range initial value in descriptor: NaN 
+PASS Out-of-range maximum value in descriptor: NaN 
+PASS Out-of-range initial value in descriptor: Infinity 
+PASS Out-of-range maximum value in descriptor: Infinity 
+PASS Out-of-range initial value in descriptor: -Infinity 
+PASS Out-of-range maximum value in descriptor: -Infinity 
+PASS Out-of-range initial value in descriptor: -1 
+PASS Out-of-range maximum value in descriptor: -1 
+PASS Out-of-range initial value in descriptor: 4294967296 
+PASS Out-of-range maximum value in descriptor: 4294967296 
+PASS Out-of-range initial value in descriptor: 68719476736 
+PASS Out-of-range maximum value in descriptor: 68719476736 
+PASS Proxy descriptor 
+PASS Order of evaluation for descriptor 
+PASS Zero initial 
+PASS Non-zero initial 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryconstructoranyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+
+PASS Missing arguments 
+PASS Branding 
+PASS Zero initial 
+PASS Zero initial with valueOf 
+PASS Non-zero initial 
+PASS Zero initial with respected maximum 
+PASS Zero initial with respected maximum grown twice 
+PASS Zero initial growing too much 
+PASS Out-of-range argument: undefined 
+PASS Out-of-range argument: NaN 
+PASS Out-of-range argument: Infinity 
+PASS Out-of-range argument: -Infinity 
+PASS Out-of-range argument: -1 
+PASS Out-of-range argument: 4294967296 
+PASS Out-of-range argument: 68719476736 
+PASS Out-of-range argument: "0x100000000" 
+PASS Out-of-range argument: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.js                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.js     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,170 @@
</span><ins>+// META: global=jsshell
+
+function assert_ArrayBuffer(actual, expected, message) {
+  // https://github.com/WebAssembly/spec/issues/840
+  assert_equals(Object.getPrototypeOf(actual), ArrayBuffer.prototype,
+                `${message}: prototype`);
+  if (expected.detached) {
+    // https://github.com/tc39/ecma262/issues/678
+    let byteLength;
+    try {
+      byteLength = actual.byteLength;
+    } catch (e) {
+      byteLength = 0;
+    }
+    assert_equals(byteLength, 0, `${message}: detached size`);
+  } else {
+    assert_equals(actual.byteLength, 0x10000 * expected.size, `${message}: size`);
+    if (expected.size > 0) {
+      const array = new Uint8Array(actual);
+      assert_equals(array[0], 0, `${message}: first element`);
+      assert_equals(array[array.byteLength - 1], 0, `${message}: last element`);
+    }
+  }
+}
+
+test(() => {
+  const argument = { "initial": 0 };
+  const memory = new WebAssembly.Memory(argument);
+  assert_throws(new TypeError(), () => memory.grow());
+}, "Missing arguments");
+
+test(t => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Memory,
+    WebAssembly.Memory.prototype,
+  ];
+
+  const argument = {
+    valueOf: t.unreached_func("Should not touch the argument (valueOf)"),
+    toString: t.unreached_func("Should not touch the argument (toString)"),
+  };
+
+  const fn = WebAssembly.Memory.prototype.grow;
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`);
+  }
+}, "Branding");
+
+test(() => {
+  const argument = { "initial": 0 };
+  const memory = new WebAssembly.Memory(argument);
+  const oldMemory = memory.buffer;
+  assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing");
+
+  const result = memory.grow(2);
+  assert_equals(result, 0);
+
+  const newMemory = memory.buffer;
+  assert_not_equals(oldMemory, newMemory);
+  assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing");
+  assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing");
+}, "Zero initial");
+
+test(() => {
+  const argument = { "initial": { valueOf() { return 0 } } };
+  const memory = new WebAssembly.Memory(argument);
+  const oldMemory = memory.buffer;
+  assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing");
+
+  const result = memory.grow({ valueOf() { return 2 } });
+  assert_equals(result, 0);
+
+  const newMemory = memory.buffer;
+  assert_not_equals(oldMemory, newMemory);
+  assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing");
+  assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing");
+}, "Zero initial with valueOf");
+
+test(() => {
+  const argument = { "initial": 3 };
+  const memory = new WebAssembly.Memory(argument);
+  const oldMemory = memory.buffer;
+  assert_ArrayBuffer(oldMemory, { "size": 3 }, "Buffer before growing");
+
+  const result = memory.grow(2);
+  assert_equals(result, 3);
+
+  const newMemory = memory.buffer;
+  assert_not_equals(oldMemory, newMemory);
+  assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing");
+  assert_ArrayBuffer(newMemory, { "size": 5 }, "New buffer after growing");
+}, "Non-zero initial");
+
+test(() => {
+  const argument = { "initial": 0, "maximum": 2 };
+  const memory = new WebAssembly.Memory(argument);
+  const oldMemory = memory.buffer;
+  assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing");
+
+  const result = memory.grow(2);
+  assert_equals(result, 0);
+
+  const newMemory = memory.buffer;
+  assert_not_equals(oldMemory, newMemory);
+  assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing");
+  assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing");
+}, "Zero initial with respected maximum");
+
+test(() => {
+  const argument = { "initial": 0, "maximum": 2 };
+  const memory = new WebAssembly.Memory(argument);
+  const oldMemory = memory.buffer;
+  assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing");
+
+  const result = memory.grow(1);
+  assert_equals(result, 0);
+
+  const newMemory = memory.buffer;
+  assert_not_equals(oldMemory, newMemory);
+  assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing once");
+  assert_ArrayBuffer(newMemory, { "size": 1 }, "New buffer after growing once");
+
+  const result2 = memory.grow(1);
+  assert_equals(result2, 1);
+
+  const newestMemory = memory.buffer;
+  assert_not_equals(newMemory, newestMemory);
+  assert_ArrayBuffer(oldMemory, { "detached": true }, "New buffer after growing twice");
+  assert_ArrayBuffer(newMemory, { "detached": true }, "New buffer after growing twice");
+  assert_ArrayBuffer(newestMemory, { "size": 2 }, "Newest buffer after growing twice");
+}, "Zero initial with respected maximum grown twice");
+
+test(() => {
+  const argument = { "initial": 1, "maximum": 2 };
+  const memory = new WebAssembly.Memory(argument);
+  const oldMemory = memory.buffer;
+  assert_ArrayBuffer(oldMemory, { "size": 1 }, "Buffer before growing");
+
+  assert_throws(new RangeError(), () => memory.grow(2));
+  assert_equals(memory.buffer, oldMemory);
+  assert_ArrayBuffer(memory.buffer, { "size": 1 }, "Buffer before trying to grow");
+}, "Zero initial growing too much");
+
+const outOfRangeValues = [
+  undefined,
+  NaN,
+  Infinity,
+  -Infinity,
+  -1,
+  0x100000000,
+  0x1000000000,
+  "0x100000000",
+  { valueOf() { return 0x100000000; } },
+];
+
+for (const value of outOfRangeValues) {
+  test(() => {
+    const argument = { "initial": 0 };
+    const memory = new WebAssembly.Memory(argument);
+    assert_throws(new TypeError(), () => memory.grow(value));
+  }, `Out-of-range argument: ${format_value(value)}`);
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+
+PASS Missing arguments 
+PASS Branding 
+PASS Zero initial 
+PASS Zero initial with valueOf 
+PASS Non-zero initial 
+PASS Zero initial with respected maximum 
+PASS Zero initial with respected maximum grown twice 
+PASS Zero initial growing too much 
+PASS Out-of-range argument: undefined 
+PASS Out-of-range argument: NaN 
+PASS Out-of-range argument: Infinity 
+PASS Out-of-range argument: -Infinity 
+PASS Out-of-range argument: -1 
+PASS Out-of-range argument: 4294967296 
+PASS Out-of-range argument: 68719476736 
+PASS Out-of-range argument: "0x100000000" 
+PASS Out-of-range argument: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorygrowanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Memory 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const argument = { "initial": 0 };
+  const memory = new WebAssembly.Memory(argument);
+  assert_class_string(memory, "WebAssembly.Memory");
+}, "Object.prototype.toString on an Memory");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Memory 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemorytoStringanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimemoryw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Calling 
+PASS Invalid arguments 
+PASS Empty buffer 
+PASS Prototype 
+PASS Extensibility 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.js                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.js      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+// META: script=/wasm/jsapi/assertions.js
+
+let emptyModuleBinary;
+setup(() => {
+  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+});
+
+test(() => {
+  assert_function_name(WebAssembly.Module, "Module", "WebAssembly.Module");
+}, "name");
+
+test(() => {
+  assert_function_length(WebAssembly.Module, 1, "WebAssembly.Module");
+}, "length");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Module());
+}, "No arguments");
+
+test(() => {
+  assert_throws(new TypeError(), () => WebAssembly.Module(emptyModuleBinary));
+}, "Calling");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    true,
+    "test",
+    Symbol(),
+    7,
+    NaN,
+    {},
+    ArrayBuffer,
+    ArrayBuffer.prototype,
+    Array.from(emptyModuleBinary),
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => new WebAssembly.Module(argument),
+                  `new Module(${format_value(argument)})`);
+  }
+}, "Invalid arguments");
+
+test(() => {
+  const buffer = new Uint8Array();
+  assert_throws(new WebAssembly.CompileError(), () => new WebAssembly.Module(buffer));
+}, "Empty buffer");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_equals(Object.getPrototypeOf(module), WebAssembly.Module.prototype);
+}, "Prototype");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_true(Object.isExtensible(module));
+}, "Extensibility");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Calling 
+PASS Invalid arguments 
+PASS Empty buffer 
+PASS Prototype 
+PASS Extensibility 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleconstructoranyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS Missing arguments 
+PASS Non-Module arguments 
+PASS Branding 
+PASS Empty module 
+PASS Empty module: array caching 
+PASS Custom sections 
+PASS Custom sections with surrogate pairs 
+FAIL Custom sections with U+FFFD assert_equals: expected 1 but got 0
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.js   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,162 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+function assert_ArrayBuffer(buffer, expected) {
+  assert_equals(Object.getPrototypeOf(buffer), ArrayBuffer.prototype, "Prototype");
+  assert_true(Object.isExtensible(buffer), "isExtensible");
+  assert_array_equals(new Uint8Array(buffer), expected);
+}
+
+function assert_sections(sections, expected) {
+  assert_true(Array.isArray(sections), "Should be array");
+  assert_equals(Object.getPrototypeOf(sections), Array.prototype, "Prototype");
+  assert_true(Object.isExtensible(sections), "isExtensible");
+
+  assert_equals(sections.length, expected.length);
+  for (let i = 0; i < expected.length; ++i) {
+    assert_ArrayBuffer(sections[i], expected[i]);
+  }
+}
+
+let emptyModuleBinary;
+setup(() => {
+  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+});
+
+test(() => {
+  assert_throws(new TypeError(), () => WebAssembly.Module.customSections());
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_throws(new TypeError(), () => WebAssembly.Module.customSections(module));
+}, "Missing arguments");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => WebAssembly.Module.customSections(argument, ""),
+                  `customSections(${format_value(argument)})`);
+  }
+}, "Non-Module arguments");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const fn = WebAssembly.Module.customSections;
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const thisValue of thisValues) {
+    assert_sections(fn.call(thisValue, module, ""), []);
+  }
+}, "Branding");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_sections(WebAssembly.Module.customSections(module, ""), []);
+}, "Empty module");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_not_equals(WebAssembly.Module.customSections(module, ""),
+                    WebAssembly.Module.customSections(module, ""));
+}, "Empty module: array caching");
+
+test(() => {
+  const bytes1 = [87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121];
+  const bytes2 = [74, 83, 65, 80, 73];
+
+  const binary = new Binary;
+  binary.emit_section(kUnknownSectionCode, section => {
+    section.emit_string("name");
+    section.emit_bytes(bytes1);
+  });
+  binary.emit_section(kUnknownSectionCode, section => {
+    section.emit_string("name");
+    section.emit_bytes(bytes2);
+  });
+  binary.emit_section(kUnknownSectionCode, section => {
+    section.emit_string("foo");
+    section.emit_bytes(bytes1);
+  });
+
+  const builder = new WasmModuleBuilder();
+  builder.addExplicitSection(binary);
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+
+  assert_sections(WebAssembly.Module.customSections(module, "name"), [
+    bytes1,
+    bytes2,
+  ])
+
+  assert_sections(WebAssembly.Module.customSections(module, "foo"), [
+    bytes1,
+  ])
+
+  assert_sections(WebAssembly.Module.customSections(module, ""), [])
+  assert_sections(WebAssembly.Module.customSections(module, "\0"), [])
+  assert_sections(WebAssembly.Module.customSections(module, "name\0"), [])
+  assert_sections(WebAssembly.Module.customSections(module, "foo\0"), [])
+}, "Custom sections");
+
+test(() => {
+  const bytes = [87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121];
+  const name = "yee\uD801\uDC37eey"
+
+  const binary = new Binary;
+  binary.emit_section(kUnknownSectionCode, section => {
+    section.emit_string(name);
+    section.emit_bytes(bytes);
+  });
+
+  const builder = new WasmModuleBuilder();
+  builder.addExplicitSection(binary);
+  const buffer = builder.toBuffer();
+  const module = new WebAssembly.Module(buffer);
+
+  assert_sections(WebAssembly.Module.customSections(module, name), [
+    bytes,
+  ]);
+  assert_sections(WebAssembly.Module.customSections(module, "yee\uFFFDeey"), []);
+  assert_sections(WebAssembly.Module.customSections(module, "yee\uFFFD\uFFFDeey"), []);
+}, "Custom sections with surrogate pairs");
+
+test(() => {
+  const bytes = [87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121];
+
+  const binary = new Binary;
+  binary.emit_section(kUnknownSectionCode, section => {
+    section.emit_string("na\uFFFDme");
+    section.emit_bytes(bytes);
+  });
+
+  const builder = new WasmModuleBuilder();
+  builder.addExplicitSection(binary);
+  const buffer = builder.toBuffer();
+  const module = new WebAssembly.Module(buffer);
+
+  assert_sections(WebAssembly.Module.customSections(module, "name"), []);
+  assert_sections(WebAssembly.Module.customSections(module, "na\uFFFDme"), [
+    bytes,
+  ]);
+  assert_sections(WebAssembly.Module.customSections(module, "na\uDC01me"), [
+    bytes,
+  ]);
+}, "Custom sections with U+FFFD");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS Missing arguments 
+PASS Non-Module arguments 
+PASS Branding 
+PASS Empty module 
+PASS Empty module: array caching 
+PASS Custom sections 
+PASS Custom sections with surrogate pairs 
+FAIL Custom sections with U+FFFD assert_equals: expected 1 but got 0
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulecustomSectionsanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Missing arguments 
+PASS Non-Module arguments 
+PASS Branding 
+PASS Empty module 
+PASS Empty module: array caching 
+FAIL exports WebAssembly.Module doesn't parse at byte 87: 3th Export isn't immutable, named 'global' (evaluating 'new WebAssembly.Module(buffer)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+let emptyModuleBinary;
+setup(() => {
+  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+});
+
+function assert_ModuleExportDescriptor(export_, expected) {
+  assert_equals(Object.getPrototypeOf(export_), Object.prototype, "Prototype");
+  assert_true(Object.isExtensible(export_), "isExtensible");
+
+  const name = Object.getOwnPropertyDescriptor(export_, "name");
+  assert_true(name.writable, "name: writable");
+  assert_true(name.enumerable, "name: enumerable");
+  assert_true(name.configurable, "name: configurable");
+  assert_equals(name.value, expected.name);
+
+  const kind = Object.getOwnPropertyDescriptor(export_, "kind");
+  assert_true(kind.writable, "kind: writable");
+  assert_true(kind.enumerable, "kind: enumerable");
+  assert_true(kind.configurable, "kind: configurable");
+  assert_equals(kind.value, expected.kind);
+}
+
+function assert_exports(exports, expected) {
+  assert_true(Array.isArray(exports), "Should be array");
+  assert_equals(Object.getPrototypeOf(exports), Array.prototype, "Prototype");
+  assert_true(Object.isExtensible(exports), "isExtensible");
+
+  assert_equals(exports.length, expected.length);
+  for (let i = 0; i < expected.length; ++i) {
+    assert_ModuleExportDescriptor(exports[i], expected[i]);
+  }
+}
+
+test(() => {
+  assert_throws(new TypeError(), () => WebAssembly.Module.exports());
+}, "Missing arguments");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => WebAssembly.Module.exports(argument),
+                  `exports(${format_value(argument)})`);
+  }
+}, "Non-Module arguments");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const fn = WebAssembly.Module.exports;
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const thisValue of thisValues) {
+    assert_array_equals(fn.call(thisValue, module), []);
+  }
+}, "Branding");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const exports = WebAssembly.Module.exports(module);
+  assert_exports(exports, []);
+}, "Empty module");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_not_equals(WebAssembly.Module.exports(module), WebAssembly.Module.exports(module));
+}, "Empty module: array caching");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder
+    .addFunction("fn", kSig_v_v)
+    .addBody([
+        kExprEnd
+    ])
+    .exportFunc();
+  builder
+    .addFunction("fn2", kSig_v_v)
+    .addBody([
+        kExprEnd
+    ])
+    .exportFunc();
+
+  builder.setFunctionTableLength(1);
+  builder.addExportOfKind("table", kExternalTable, 0);
+
+  builder.addGlobal(kWasmI32, true)
+    .exportAs("global")
+    .init = 7;
+  builder.addGlobal(kWasmF64, true)
+    .exportAs("global2")
+    .init = 1.2;
+
+  builder.addMemory(0, 256, true);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const exports = WebAssembly.Module.exports(module);
+  const expected = [
+    { "kind": "function", "name": "fn" },
+    { "kind": "function", "name": "fn2" },
+    { "kind": "table", "name": "table" },
+    { "kind": "global", "name": "global" },
+    { "kind": "global", "name": "global2" },
+    { "kind": "memory", "name": "memory" },
+  ];
+  assert_exports(exports, expected);
+}, "exports");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Missing arguments 
+PASS Non-Module arguments 
+PASS Branding 
+PASS Empty module 
+PASS Empty module: array caching 
+FAIL exports WebAssembly.Module doesn't parse at byte 87: 3th Export isn't immutable, named 'global' (evaluating 'new WebAssembly.Module(buffer)')
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleexportsanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+
+PASS Missing arguments 
+PASS Non-Module arguments 
+PASS Branding 
+PASS Return type 
+PASS Empty module 
+PASS Empty module: array caching 
+PASS imports 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,120 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+function assert_ModuleImportDescriptor(import_, expected) {
+  assert_equals(Object.getPrototypeOf(import_), Object.prototype, "Prototype");
+  assert_true(Object.isExtensible(import_), "isExtensible");
+
+  const module = Object.getOwnPropertyDescriptor(import_, "module");
+  assert_true(module.writable, "module: writable");
+  assert_true(module.enumerable, "module: enumerable");
+  assert_true(module.configurable, "module: configurable");
+  assert_equals(module.value, expected.module);
+
+  const name = Object.getOwnPropertyDescriptor(import_, "name");
+  assert_true(name.writable, "name: writable");
+  assert_true(name.enumerable, "name: enumerable");
+  assert_true(name.configurable, "name: configurable");
+  assert_equals(name.value, expected.name);
+
+  const kind = Object.getOwnPropertyDescriptor(import_, "kind");
+  assert_true(kind.writable, "kind: writable");
+  assert_true(kind.enumerable, "kind: enumerable");
+  assert_true(kind.configurable, "kind: configurable");
+  assert_equals(kind.value, expected.kind);
+}
+
+function assert_imports(imports, expected) {
+  assert_true(Array.isArray(imports), "Should be array");
+  assert_equals(Object.getPrototypeOf(imports), Array.prototype, "Prototype");
+  assert_true(Object.isExtensible(imports), "isExtensible");
+
+  assert_equals(imports.length, expected.length);
+  for (let i = 0; i < expected.length; ++i) {
+    assert_ModuleImportDescriptor(imports[i], expected[i]);
+  }
+}
+
+let emptyModuleBinary;
+setup(() => {
+  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+});
+
+test(() => {
+  assert_throws(new TypeError(), () => WebAssembly.Module.imports());
+}, "Missing arguments");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => WebAssembly.Module.imports(argument),
+                  `imports(${format_value(argument)})`);
+  }
+}, "Non-Module arguments");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const fn = WebAssembly.Module.imports;
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Module,
+    WebAssembly.Module.prototype,
+  ];
+  for (const thisValue of thisValues) {
+    assert_array_equals(fn.call(thisValue, module), []);
+  }
+}, "Branding");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const imports = WebAssembly.Module.imports(module);
+  assert_true(Array.isArray(imports));
+}, "Return type");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const imports = WebAssembly.Module.imports(module);
+  assert_imports(imports, []);
+}, "Empty module");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_not_equals(WebAssembly.Module.imports(module), WebAssembly.Module.imports(module));
+}, "Empty module: array caching");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.addImport("module", "fn", kSig_v_v);
+  builder.addImportedGlobal("module", "global", kWasmI32);
+  builder.addImportedMemory("module", "memory", 0, 128);
+  builder.addImportedTable("module", "table", 0, 128);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const imports = WebAssembly.Module.imports(module);
+  const expected = [
+    { "module": "module", "kind": "function", "name": "fn" },
+    { "module": "module", "kind": "global", "name": "global" },
+    { "module": "module", "kind": "memory", "name": "memory" },
+    { "module": "module", "kind": "table", "name": "table" },
+  ];
+  assert_imports(imports, expected);
+}, "imports");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+
+PASS Missing arguments 
+PASS Non-Module arguments 
+PASS Branding 
+PASS Return type 
+PASS Empty module 
+PASS Empty module: array caching 
+PASS imports 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduleimportsanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any-expected.txt                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any-expected.txt       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Module 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+test(() => {
+  const emptyModuleBinary = new WasmModuleBuilder().toBuffer();
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  assert_class_string(module, "WebAssembly.Module");
+}, "Object.prototype.toString on an Module");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Module 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimoduletoStringanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapimodulew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/w3c-import.log                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/w3c-import.log  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableassertionsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/assertions.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/assertions.js                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/assertions.js    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+function assert_equal_to_array(table, expected, message) {
+  assert_equals(table.length, expected.length, `${message}: length`);
+  assert_throws(new RangeError(), () => table.get(-1), `${message}: table.get(-1)`);
+  for (let i = 0; i < expected.length; ++i) {
+    assert_equals(table.get(i), expected[i], `${message}: table.get(${i} of ${expected.length})`);
+  }
+  assert_throws(new RangeError(), () => table.get(expected.length),
+                `${message}: table.get(${expected.length} of ${expected.length})`);
+  assert_throws(new RangeError(), () => table.get(expected.length + 1),
+                `${message}: table.get(${expected.length + 1} of ${expected.length})`);
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Calling 
+PASS Empty descriptor 
+PASS Invalid descriptor argument 
+PASS Undefined initial value in descriptor 
+PASS Undefined element value in descriptor 
+PASS Out-of-range initial value in descriptor: NaN 
+PASS Out-of-range maximum value in descriptor: NaN 
+PASS Out-of-range initial value in descriptor: Infinity 
+PASS Out-of-range maximum value in descriptor: Infinity 
+PASS Out-of-range initial value in descriptor: -Infinity 
+PASS Out-of-range maximum value in descriptor: -Infinity 
+PASS Out-of-range initial value in descriptor: -1 
+PASS Out-of-range maximum value in descriptor: -1 
+PASS Out-of-range initial value in descriptor: 4294967296 
+PASS Out-of-range maximum value in descriptor: 4294967296 
+PASS Out-of-range initial value in descriptor: 68719476736 
+PASS Out-of-range maximum value in descriptor: 68719476736 
+PASS Initial value exceeds maximum 
+PASS Basic (zero) 
+PASS Basic (non-zero) 
+PASS Proxy descriptor 
+PASS Type conversion for descriptor.element 
+PASS Order of evaluation for descriptor 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.js                            (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.js       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/assertions.js
+
+function assert_Table(actual, expected) {
+  assert_equals(Object.getPrototypeOf(actual), WebAssembly.Table.prototype,
+                "prototype");
+  assert_true(Object.isExtensible(actual), "extensible");
+
+  assert_equals(actual.length, expected.length, "length");
+  for (let i = 0; i < expected.length; ++i) {
+    assert_equals(actual.get(i), null, `actual.get(${i})`);
+  }
+}
+
+test(() => {
+  assert_function_name(WebAssembly.Table, "Table", "WebAssembly.Table");
+}, "name");
+
+test(() => {
+  assert_function_length(WebAssembly.Table, 1, "WebAssembly.Table");
+}, "length");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Table());
+}, "No arguments");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 0 };
+  assert_throws(new TypeError(), () => WebAssembly.Table(argument));
+}, "Calling");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Table({}));
+}, "Empty descriptor");
+
+test(() => {
+  const invalidArguments = [
+    undefined,
+    null,
+    false,
+    true,
+    "",
+    "test",
+    Symbol(),
+    1,
+    NaN,
+    {},
+  ];
+  for (const invalidArgument of invalidArguments) {
+    assert_throws(new TypeError(),
+                  () => new WebAssembly.Table(invalidArgument),
+                  `new Table(${format_value(invalidArgument)})`);
+  }
+}, "Invalid descriptor argument");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": undefined }));
+}, "Undefined initial value in descriptor");
+
+test(() => {
+  assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": undefined, "initial": 0 }));
+}, "Undefined element value in descriptor");
+
+const outOfRangeValues = [
+  NaN,
+  Infinity,
+  -Infinity,
+  -1,
+  0x100000000,
+  0x1000000000,
+];
+
+for (const value of outOfRangeValues) {
+  test(() => {
+    assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": value }));
+  }, `Out-of-range initial value in descriptor: ${format_value(value)}`);
+
+  test(() => {
+    assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": 0, "maximum": value }));
+  }, `Out-of-range maximum value in descriptor: ${format_value(value)}`);
+}
+
+test(() => {
+  assert_throws(new RangeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": 10, "maximum": 9 }));
+}, "Initial value exceeds maximum");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 0 };
+  const table = new WebAssembly.Table(argument);
+  assert_Table(table, { "length": 0 });
+}, "Basic (zero)");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_Table(table, { "length": 5 });
+}, "Basic (non-zero)");
+
+test(() => {
+  const proxy = new Proxy({}, {
+    has(o, x) {
+      assert_unreached(`Should not call [[HasProperty]] with ${x}`);
+    },
+    get(o, x) {
+      switch (x) {
+      case "element":
+        return "anyfunc";
+      case "initial":
+      case "maximum":
+        return 0;
+      default:
+        return undefined;
+      }
+    },
+  });
+  const table = new WebAssembly.Table(proxy);
+  assert_Table(table, { "length": 0 });
+}, "Proxy descriptor");
+
+test(() => {
+  const table = new WebAssembly.Table({
+    "element": {
+      toString() { return "anyfunc"; },
+    },
+    "initial": 1,
+  });
+  assert_Table(table, { "length": 1 });
+}, "Type conversion for descriptor.element");
+
+test(() => {
+  const order = [];
+
+  new WebAssembly.Table({
+    get maximum() {
+      order.push("maximum");
+      return {
+        valueOf() {
+          order.push("maximum valueOf");
+          return 1;
+        },
+      };
+    },
+
+    get initial() {
+      order.push("initial");
+      return {
+        valueOf() {
+          order.push("initial valueOf");
+          return 1;
+        },
+      };
+    },
+
+    get element() {
+      order.push("element");
+      return {
+        toString() {
+          order.push("element toString");
+          return "anyfunc";
+        },
+      };
+    },
+  });
+
+  assert_array_equals(order, [
+    "element",
+    "element toString",
+    "initial",
+    "initial valueOf",
+    "maximum",
+    "maximum valueOf",
+  ]);
+}, "Order of evaluation for descriptor");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+
+PASS name 
+PASS length 
+PASS No arguments 
+PASS Calling 
+PASS Empty descriptor 
+PASS Invalid descriptor argument 
+PASS Undefined initial value in descriptor 
+PASS Undefined element value in descriptor 
+PASS Out-of-range initial value in descriptor: NaN 
+PASS Out-of-range maximum value in descriptor: NaN 
+PASS Out-of-range initial value in descriptor: Infinity 
+PASS Out-of-range maximum value in descriptor: Infinity 
+PASS Out-of-range initial value in descriptor: -Infinity 
+PASS Out-of-range maximum value in descriptor: -Infinity 
+PASS Out-of-range initial value in descriptor: -1 
+PASS Out-of-range maximum value in descriptor: -1 
+PASS Out-of-range initial value in descriptor: 4294967296 
+PASS Out-of-range maximum value in descriptor: 4294967296 
+PASS Out-of-range initial value in descriptor: 68719476736 
+PASS Out-of-range maximum value in descriptor: 68719476736 
+PASS Initial value exceeds maximum 
+PASS Basic (zero) 
+PASS Basic (non-zero) 
+PASS Proxy descriptor 
+PASS Type conversion for descriptor.element 
+PASS Order of evaluation for descriptor 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitableconstructoranyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+
+PASS Missing arguments: get 
+PASS Branding: get 
+PASS Missing arguments: set 
+PASS Branding: set 
+FAIL Basic assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Growing assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting out-of-bounds assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting non-function assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting non-wasm function assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting non-wasm arrow function assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+PASS Getting out-of-range argument: undefined 
+PASS Setting out-of-range argument: undefined 
+PASS Getting out-of-range argument: NaN 
+PASS Setting out-of-range argument: NaN 
+PASS Getting out-of-range argument: Infinity 
+PASS Setting out-of-range argument: Infinity 
+PASS Getting out-of-range argument: -Infinity 
+PASS Setting out-of-range argument: -Infinity 
+PASS Getting out-of-range argument: -1 
+PASS Setting out-of-range argument: -1 
+PASS Getting out-of-range argument: 4294967296 
+PASS Setting out-of-range argument: 4294967296 
+PASS Getting out-of-range argument: 68719476736 
+PASS Setting out-of-range argument: 68719476736 
+PASS Getting out-of-range argument: "0x100000000" 
+PASS Setting out-of-range argument: "0x100000000" 
+PASS Getting out-of-range argument: object "[object Object]" 
+PASS Setting out-of-range argument: object "[object Object]" 
+PASS Order of argument conversion 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.js                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.js   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,220 @@
</span><ins>+// META: global=jsshell
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+// META: script=assertions.js
+
+let functions;
+setup(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder
+    .addFunction("fn", kSig_v_d)
+    .addBody([
+        kExprEnd
+    ])
+    .exportFunc();
+  builder
+    .addFunction("fn2", kSig_v_v)
+    .addBody([
+        kExprEnd
+    ])
+    .exportFunc();
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const instance = new WebAssembly.Instance(module, {});
+  functions = instance.exports;
+});
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_throws(new TypeError(), () => table.get());
+}, "Missing arguments: get");
+
+test(t => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Table,
+    WebAssembly.Table.prototype,
+  ];
+
+  const argument = {
+    valueOf: t.unreached_func("Should not touch the argument (valueOf)"),
+    toString: t.unreached_func("Should not touch the argument (toString)"),
+  };
+
+  const fn = WebAssembly.Table.prototype.get;
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`);
+  }
+}, "Branding: get");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_throws(new TypeError(), () => table.set());
+  assert_throws(new TypeError(), () => table.set(0));
+}, "Missing arguments: set");
+
+test(t => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Table,
+    WebAssembly.Table.prototype,
+  ];
+
+  const argument = {
+    valueOf: t.unreached_func("Should not touch the argument (valueOf)"),
+    toString: t.unreached_func("Should not touch the argument (toString)"),
+  };
+
+  const fn = WebAssembly.Table.prototype.set;
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => fn.call(thisValue, argument, null), `this=${format_value(thisValue)}`);
+  }
+}, "Branding: set");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, [null, null, null, null, null]);
+
+  const {fn, fn2} = functions;
+
+  assert_equals(table.set(0, fn), undefined, "set() returns undefined.");
+  table.set(2, fn2);
+  table.set(4, fn);
+
+  assert_equal_to_array(table, [fn, null, fn2, null, fn]);
+
+  table.set(0, null);
+  assert_equal_to_array(table, [null, null, fn2, null, fn]);
+}, "Basic");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, [null, null, null, null, null]);
+
+  const {fn, fn2} = functions;
+
+  table.set(0, fn);
+  table.set(2, fn2);
+  table.set(4, fn);
+
+  assert_equal_to_array(table, [fn, null, fn2, null, fn]);
+
+  table.grow(4);
+
+  assert_equal_to_array(table, [fn, null, fn2, null, fn, null, null, null, null]);
+}, "Growing");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, [null, null, null, null, null]);
+
+  const {fn} = functions;
+
+  assert_throws(new RangeError(), () => table.set(-1, fn));
+  assert_throws(new RangeError(), () => table.set(5, fn));
+  assert_equal_to_array(table, [null, null, null, null, null]);
+}, "Setting out-of-bounds");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 1 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, [null]);
+
+  const invalidArguments = [
+    undefined,
+    true,
+    false,
+    "test",
+    Symbol(),
+    7,
+    NaN,
+    {},
+  ];
+  for (const argument of invalidArguments) {
+    assert_throws(new TypeError(), () => table.set(0, argument),
+                  `set(${format_value(argument)})`);
+  }
+  assert_equal_to_array(table, [null]);
+}, "Setting non-function");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 1 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, [null]);
+
+  const fn = function() {};
+  assert_throws(new TypeError(), () => table.set(0, fn));
+  assert_equal_to_array(table, [null]);
+}, "Setting non-wasm function");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 1 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, [null]);
+
+  const fn = () => {};
+  assert_throws(new TypeError(), () => table.set(0, fn));
+  assert_equal_to_array(table, [null]);
+}, "Setting non-wasm arrow function");
+
+const outOfRangeValues = [
+  undefined,
+  NaN,
+  Infinity,
+  -Infinity,
+  -1,
+  0x100000000,
+  0x1000000000,
+  "0x100000000",
+  { valueOf() { return 0x100000000; } },
+];
+
+for (const value of outOfRangeValues) {
+  test(() => {
+    const argument = { "element": "anyfunc", "initial": 1 };
+    const table = new WebAssembly.Table(argument);
+    assert_throws(new TypeError(), () => table.get(value));
+  }, `Getting out-of-range argument: ${format_value(value)}`);
+
+  test(() => {
+    const argument = { "element": "anyfunc", "initial": 1 };
+    const table = new WebAssembly.Table(argument);
+    assert_throws(new TypeError(), () => table.set(value, null));
+  }, `Setting out-of-range argument: ${format_value(value)}`);
+}
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 1 };
+  const table = new WebAssembly.Table(argument);
+  let called = 0;
+  const value = {
+    valueOf() {
+      called++;
+      return 0;
+    },
+  };
+  assert_throws(new TypeError(), () => table.set(value, {}));
+  assert_equals(called, 1);
+}, "Order of argument conversion");
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+
+PASS Missing arguments: get 
+PASS Branding: get 
+PASS Missing arguments: set 
+PASS Branding: set 
+FAIL Basic assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Growing assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting out-of-bounds assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting non-function assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting non-wasm function assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Setting non-wasm arrow function assert_throws: undefined: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+PASS Getting out-of-range argument: undefined 
+PASS Setting out-of-range argument: undefined 
+PASS Getting out-of-range argument: NaN 
+PASS Setting out-of-range argument: NaN 
+PASS Getting out-of-range argument: Infinity 
+PASS Setting out-of-range argument: Infinity 
+PASS Getting out-of-range argument: -Infinity 
+PASS Setting out-of-range argument: -Infinity 
+PASS Getting out-of-range argument: -1 
+PASS Setting out-of-range argument: -1 
+PASS Getting out-of-range argument: 4294967296 
+PASS Setting out-of-range argument: 4294967296 
+PASS Getting out-of-range argument: 68719476736 
+PASS Setting out-of-range argument: 68719476736 
+PASS Getting out-of-range argument: "0x100000000" 
+PASS Setting out-of-range argument: "0x100000000" 
+PASS Getting out-of-range argument: object "[object Object]" 
+PASS Setting out-of-range argument: object "[object Object]" 
+PASS Order of argument conversion 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegetsetanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any-expected.txt                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any-expected.txt    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+
+PASS Missing arguments 
+PASS Branding 
+FAIL Basic assert_throws: before: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Reached maximum assert_throws: before: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Exceeded maximum assert_throws: before: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+PASS Out-of-range argument: undefined 
+PASS Out-of-range argument: NaN 
+PASS Out-of-range argument: Infinity 
+PASS Out-of-range argument: -Infinity 
+PASS Out-of-range argument: -1 
+PASS Out-of-range argument: 4294967296 
+PASS Out-of-range argument: 68719476736 
+PASS Out-of-range argument: "0x100000000" 
+PASS Out-of-range argument: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.js                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.js      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+// META: global=jsshell
+// META: script=assertions.js
+
+function nulls(n) {
+  return Array(n).fill(null);
+}
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_throws(new TypeError(), () => table.grow());
+}, "Missing arguments");
+
+test(t => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Table,
+    WebAssembly.Table.prototype,
+  ];
+
+  const argument = {
+    valueOf: t.unreached_func("Should not touch the argument (valueOf)"),
+    toString: t.unreached_func("Should not touch the argument (toString)"),
+  };
+
+  const fn = WebAssembly.Table.prototype.grow;
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`);
+  }
+}, "Branding");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, nulls(5), "before");
+
+  const result = table.grow(3);
+  assert_equals(result, 5);
+  assert_equal_to_array(table, nulls(8), "after");
+}, "Basic");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 3, "maximum": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, nulls(3), "before");
+
+  const result = table.grow(2);
+  assert_equals(result, 3);
+  assert_equal_to_array(table, nulls(5), "after");
+}, "Reached maximum");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 2, "maximum": 5 };
+  const table = new WebAssembly.Table(argument);
+  assert_equal_to_array(table, nulls(2), "before");
+
+  assert_throws(new RangeError(), () => table.grow(4));
+  assert_equal_to_array(table, nulls(2), "after");
+}, "Exceeded maximum");
+
+const outOfRangeValues = [
+  undefined,
+  NaN,
+  Infinity,
+  -Infinity,
+  -1,
+  0x100000000,
+  0x1000000000,
+  "0x100000000",
+  { valueOf() { return 0x100000000; } },
+];
+
+for (const value of outOfRangeValues) {
+  test(() => {
+    const argument = { "element": "anyfunc", "initial": 1 };
+    const table = new WebAssembly.Table(argument);
+    assert_throws(new TypeError(), () => table.grow(value));
+  }, `Out-of-range argument: ${format_value(value)}`);
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+
+PASS Missing arguments 
+PASS Branding 
+FAIL Basic assert_throws: before: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Reached maximum assert_throws: before: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+FAIL Exceeded maximum assert_throws: before: table.get(-1) function "() => table.get(-1)" threw object "TypeError: Expect an integer argument in the range: [0, 2^32 - 1]" ("TypeError") expected object "RangeError" ("RangeError")
+PASS Out-of-range argument: undefined 
+PASS Out-of-range argument: NaN 
+PASS Out-of-range argument: Infinity 
+PASS Out-of-range argument: -Infinity 
+PASS Out-of-range argument: -1 
+PASS Out-of-range argument: 4294967296 
+PASS Out-of-range argument: 68719476736 
+PASS Out-of-range argument: "0x100000000" 
+PASS Out-of-range argument: object "[object Object]" 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablegrowanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html                          (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any-expected.txt                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any-expected.txt  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Branding 
+PASS Setting (sloppy mode) 
+PASS Setting (strict mode) 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.js                         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.js    2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const thisValues = [
+    undefined,
+    null,
+    true,
+    "",
+    Symbol(),
+    1,
+    {},
+    WebAssembly.Table,
+    WebAssembly.Table.prototype,
+  ];
+
+  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Table.prototype, "length");
+  assert_equals(typeof desc, "object");
+
+  const getter = desc.get;
+  assert_equals(typeof getter, "function");
+
+  assert_equals(typeof desc.set, "undefined");
+
+  for (const thisValue of thisValues) {
+    assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`);
+  }
+}, "Branding");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 2 };
+  const table = new WebAssembly.Table(argument);
+  assert_equals(table.length, 2, "Initial length");
+  table.length = 4;
+  assert_equals(table.length, 2, "Should not change the length");
+}, "Setting (sloppy mode)");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 2 };
+  const table = new WebAssembly.Table(argument);
+  assert_equals(table.length, 2, "Initial length");
+  assert_throws(new TypeError(), () => {
+    "use strict";
+    table.length = 4;
+  });
+  assert_equals(table.length, 2, "Should not change the length");
+}, "Setting (strict mode)");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Branding 
+PASS Setting (sloppy mode) 
+PASS Setting (strict mode) 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablelengthanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any-expected.txt                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any-expected.txt        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Table 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html                             (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js                               (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+// META: global=jsshell
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 0 };
+  const table = new WebAssembly.Table(argument);
+  assert_class_string(table, "WebAssembly.Table");
+}, "Object.prototype.toString on an Table");
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Object.prototype.toString on an Table 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitabletoStringanyworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!-- This file is required for WebKit test infrastructure to run the templated test -->
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapitablew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/assertions.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/assertions.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/bad-imports.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/interface.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-constants.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiwasmconstantsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-constants.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-constants.js                           (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-constants.js      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,374 @@
</span><ins>+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-wasm
+
+function bytes() {
+  var buffer = new ArrayBuffer(arguments.length);
+  var view = new Uint8Array(buffer);
+  for (var i = 0; i < arguments.length; i++) {
+    var val = arguments[i];
+    if ((typeof val) == "string") val = val.charCodeAt(0);
+    view[i] = val | 0;
+  }
+  return buffer;
+}
+
+// Header declaration constants
+var kWasmH0 = 0;
+var kWasmH1 = 0x61;
+var kWasmH2 = 0x73;
+var kWasmH3 = 0x6d;
+
+var kWasmV0 = 1;
+var kWasmV1 = 0;
+var kWasmV2 = 0;
+var kWasmV3 = 0;
+
+var kHeaderSize = 8;
+var kPageSize = 65536;
+
+function bytesWithHeader() {
+  var buffer = new ArrayBuffer(kHeaderSize + arguments.length);
+  var view = new Uint8Array(buffer);
+  view[0] = kWasmH0;
+  view[1] = kWasmH1;
+  view[2] = kWasmH2;
+  view[3] = kWasmH3;
+  view[4] = kWasmV0;
+  view[5] = kWasmV1;
+  view[6] = kWasmV2;
+  view[7] = kWasmV3;
+  for (var i = 0; i < arguments.length; i++) {
+    var val = arguments[i];
+    if ((typeof val) == "string") val = val.charCodeAt(0);
+    view[kHeaderSize + i] = val | 0;
+  }
+  return buffer;
+}
+
+let kDeclNoLocals = 0;
+
+// Section declaration constants
+let kUnknownSectionCode = 0;
+let kTypeSectionCode = 1;      // Function signature declarations
+let kImportSectionCode = 2;    // Import declarations
+let kFunctionSectionCode = 3;  // Function declarations
+let kTableSectionCode = 4;     // Indirect function table and other tables
+let kMemorySectionCode = 5;    // Memory attributes
+let kGlobalSectionCode = 6;    // Global declarations
+let kExportSectionCode = 7;    // Exports
+let kStartSectionCode = 8;     // Start function declaration
+let kElementSectionCode = 9;  // Elements section
+let kCodeSectionCode = 10;      // Function code
+let kDataSectionCode = 11;     // Data segments
+let kNameSectionCode = 12;     // Name section (encoded as string)
+
+let kWasmFunctionTypeForm = 0x60;
+let kWasmAnyFunctionTypeForm = 0x70;
+
+let kResizableMaximumFlag = 1;
+
+// Function declaration flags
+let kDeclFunctionName   = 0x01;
+let kDeclFunctionImport = 0x02;
+let kDeclFunctionLocals = 0x04;
+let kDeclFunctionExport = 0x08;
+
+// Local types
+let kWasmStmt = 0x40;
+let kWasmI32 = 0x7f;
+let kWasmI64 = 0x7e;
+let kWasmF32 = 0x7d;
+let kWasmF64 = 0x7c;
+let kWasmS128 = 0x7b;
+
+let kExternalFunction = 0;
+let kExternalTable = 1;
+let kExternalMemory = 2;
+let kExternalGlobal = 3;
+
+let kTableZero = 0;
+let kMemoryZero = 0;
+
+// Useful signatures
+let kSig_i_i = makeSig([kWasmI32], [kWasmI32]);
+let kSig_l_l = makeSig([kWasmI64], [kWasmI64]);
+let kSig_i_l = makeSig([kWasmI64], [kWasmI32]);
+let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]);
+let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]);
+let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]);
+let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]);
+let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]);
+let kSig_v_v = makeSig([], []);
+let kSig_i_v = makeSig([], [kWasmI32]);
+let kSig_l_v = makeSig([], [kWasmI64]);
+let kSig_f_v = makeSig([], [kWasmF64]);
+let kSig_d_v = makeSig([], [kWasmF64]);
+let kSig_v_i = makeSig([kWasmI32], []);
+let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []);
+let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []);
+let kSig_v_l = makeSig([kWasmI64], []);
+let kSig_v_d = makeSig([kWasmF64], []);
+let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []);
+let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []);
+let kSig_s_v = makeSig([], [kWasmS128]);
+
+function makeSig(params, results) {
+  return {params: params, results: results};
+}
+
+function makeSig_v_x(x) {
+  return makeSig([x], []);
+}
+
+function makeSig_v_xx(x) {
+  return makeSig([x, x], []);
+}
+
+function makeSig_r_v(r) {
+  return makeSig([], [r]);
+}
+
+function makeSig_r_x(r, x) {
+  return makeSig([x], [r]);
+}
+
+function makeSig_r_xx(r, x) {
+  return makeSig([x, x], [r]);
+}
+
+// Opcodes
+let kExprUnreachable = 0x00;
+let kExprNop = 0x01;
+let kExprBlock = 0x02;
+let kExprLoop = 0x03;
+let kExprIf = 0x04;
+let kExprElse = 0x05;
+let kExprTry = 0x06;
+let kExprCatch = 0x07;
+let kExprThrow = 0x08;
+let kExprEnd = 0x0b;
+let kExprBr = 0x0c;
+let kExprBrIf = 0x0d;
+let kExprBrTable = 0x0e;
+let kExprReturn = 0x0f;
+let kExprCallFunction = 0x10;
+let kExprCallIndirect = 0x11;
+let kExprDrop = 0x1a;
+let kExprSelect = 0x1b;
+let kExprGetLocal = 0x20;
+let kExprSetLocal = 0x21;
+let kExprTeeLocal = 0x22;
+let kExprGetGlobal = 0x23;
+let kExprSetGlobal = 0x24;
+let kExprI32Const = 0x41;
+let kExprI64Const = 0x42;
+let kExprF32Const = 0x43;
+let kExprF64Const = 0x44;
+let kExprI32LoadMem = 0x28;
+let kExprI64LoadMem = 0x29;
+let kExprF32LoadMem = 0x2a;
+let kExprF64LoadMem = 0x2b;
+let kExprI32LoadMem8S = 0x2c;
+let kExprI32LoadMem8U = 0x2d;
+let kExprI32LoadMem16S = 0x2e;
+let kExprI32LoadMem16U = 0x2f;
+let kExprI64LoadMem8S = 0x30;
+let kExprI64LoadMem8U = 0x31;
+let kExprI64LoadMem16S = 0x32;
+let kExprI64LoadMem16U = 0x33;
+let kExprI64LoadMem32S = 0x34;
+let kExprI64LoadMem32U = 0x35;
+let kExprI32StoreMem = 0x36;
+let kExprI64StoreMem = 0x37;
+let kExprF32StoreMem = 0x38;
+let kExprF64StoreMem = 0x39;
+let kExprI32StoreMem8 = 0x3a;
+let kExprI32StoreMem16 = 0x3b;
+let kExprI64StoreMem8 = 0x3c;
+let kExprI64StoreMem16 = 0x3d;
+let kExprI64StoreMem32 = 0x3e;
+let kExprMemorySize = 0x3f;
+let kExprGrowMemory = 0x40;
+let kExprI32Eqz = 0x45;
+let kExprI32Eq = 0x46;
+let kExprI32Ne = 0x47;
+let kExprI32LtS = 0x48;
+let kExprI32LtU = 0x49;
+let kExprI32GtS = 0x4a;
+let kExprI32GtU = 0x4b;
+let kExprI32LeS = 0x4c;
+let kExprI32LeU = 0x4d;
+let kExprI32GeS = 0x4e;
+let kExprI32GeU = 0x4f;
+let kExprI64Eqz = 0x50;
+let kExprI64Eq = 0x51;
+let kExprI64Ne = 0x52;
+let kExprI64LtS = 0x53;
+let kExprI64LtU = 0x54;
+let kExprI64GtS = 0x55;
+let kExprI64GtU = 0x56;
+let kExprI64LeS = 0x57;
+let kExprI64LeU = 0x58;
+let kExprI64GeS = 0x59;
+let kExprI64GeU = 0x5a;
+let kExprF32Eq = 0x5b;
+let kExprF32Ne = 0x5c;
+let kExprF32Lt = 0x5d;
+let kExprF32Gt = 0x5e;
+let kExprF32Le = 0x5f;
+let kExprF32Ge = 0x60;
+let kExprF64Eq = 0x61;
+let kExprF64Ne = 0x62;
+let kExprF64Lt = 0x63;
+let kExprF64Gt = 0x64;
+let kExprF64Le = 0x65;
+let kExprF64Ge = 0x66;
+let kExprI32Clz = 0x67;
+let kExprI32Ctz = 0x68;
+let kExprI32Popcnt = 0x69;
+let kExprI32Add = 0x6a;
+let kExprI32Sub = 0x6b;
+let kExprI32Mul = 0x6c;
+let kExprI32DivS = 0x6d;
+let kExprI32DivU = 0x6e;
+let kExprI32RemS = 0x6f;
+let kExprI32RemU = 0x70;
+let kExprI32And = 0x71;
+let kExprI32Ior = 0x72;
+let kExprI32Xor = 0x73;
+let kExprI32Shl = 0x74;
+let kExprI32ShrS = 0x75;
+let kExprI32ShrU = 0x76;
+let kExprI32Rol = 0x77;
+let kExprI32Ror = 0x78;
+let kExprI64Clz = 0x79;
+let kExprI64Ctz = 0x7a;
+let kExprI64Popcnt = 0x7b;
+let kExprI64Add = 0x7c;
+let kExprI64Sub = 0x7d;
+let kExprI64Mul = 0x7e;
+let kExprI64DivS = 0x7f;
+let kExprI64DivU = 0x80;
+let kExprI64RemS = 0x81;
+let kExprI64RemU = 0x82;
+let kExprI64And = 0x83;
+let kExprI64Ior = 0x84;
+let kExprI64Xor = 0x85;
+let kExprI64Shl = 0x86;
+let kExprI64ShrS = 0x87;
+let kExprI64ShrU = 0x88;
+let kExprI64Rol = 0x89;
+let kExprI64Ror = 0x8a;
+let kExprF32Abs = 0x8b;
+let kExprF32Neg = 0x8c;
+let kExprF32Ceil = 0x8d;
+let kExprF32Floor = 0x8e;
+let kExprF32Trunc = 0x8f;
+let kExprF32NearestInt = 0x90;
+let kExprF32Sqrt = 0x91;
+let kExprF32Add = 0x92;
+let kExprF32Sub = 0x93;
+let kExprF32Mul = 0x94;
+let kExprF32Div = 0x95;
+let kExprF32Min = 0x96;
+let kExprF32Max = 0x97;
+let kExprF32CopySign = 0x98;
+let kExprF64Abs = 0x99;
+let kExprF64Neg = 0x9a;
+let kExprF64Ceil = 0x9b;
+let kExprF64Floor = 0x9c;
+let kExprF64Trunc = 0x9d;
+let kExprF64NearestInt = 0x9e;
+let kExprF64Sqrt = 0x9f;
+let kExprF64Add = 0xa0;
+let kExprF64Sub = 0xa1;
+let kExprF64Mul = 0xa2;
+let kExprF64Div = 0xa3;
+let kExprF64Min = 0xa4;
+let kExprF64Max = 0xa5;
+let kExprF64CopySign = 0xa6;
+let kExprI32ConvertI64 = 0xa7;
+let kExprI32SConvertF32 = 0xa8;
+let kExprI32UConvertF32 = 0xa9;
+let kExprI32SConvertF64 = 0xaa;
+let kExprI32UConvertF64 = 0xab;
+let kExprI64SConvertI32 = 0xac;
+let kExprI64UConvertI32 = 0xad;
+let kExprI64SConvertF32 = 0xae;
+let kExprI64UConvertF32 = 0xaf;
+let kExprI64SConvertF64 = 0xb0;
+let kExprI64UConvertF64 = 0xb1;
+let kExprF32SConvertI32 = 0xb2;
+let kExprF32UConvertI32 = 0xb3;
+let kExprF32SConvertI64 = 0xb4;
+let kExprF32UConvertI64 = 0xb5;
+let kExprF32ConvertF64 = 0xb6;
+let kExprF64SConvertI32 = 0xb7;
+let kExprF64UConvertI32 = 0xb8;
+let kExprF64SConvertI64 = 0xb9;
+let kExprF64UConvertI64 = 0xba;
+let kExprF64ConvertF32 = 0xbb;
+let kExprI32ReinterpretF32 = 0xbc;
+let kExprI64ReinterpretF64 = 0xbd;
+let kExprF32ReinterpretI32 = 0xbe;
+let kExprF64ReinterpretI64 = 0xbf;
+
+let kTrapUnreachable          = 0;
+let kTrapMemOutOfBounds       = 1;
+let kTrapDivByZero            = 2;
+let kTrapDivUnrepresentable   = 3;
+let kTrapRemByZero            = 4;
+let kTrapFloatUnrepresentable = 5;
+let kTrapFuncInvalid          = 6;
+let kTrapFuncSigMismatch      = 7;
+let kTrapInvalidIndex         = 8;
+
+let kTrapMsgs = [
+  "unreachable",
+  "memory access out of bounds",
+  "divide by zero",
+  "divide result unrepresentable",
+  "remainder by zero",
+  "integer result unrepresentable",
+  "invalid function",
+  "function signature mismatch",
+  "invalid index into function table"
+];
+
+function assertTraps(trap, code) {
+    var threwException = true;
+    try {
+      if (typeof code === 'function') {
+        code();
+      } else {
+        eval(code);
+      }
+      threwException = false;
+    } catch (e) {
+      assertEquals("object", typeof e);
+      assertEquals(kTrapMsgs[trap], e.message);
+      // Success.
+      return;
+    }
+    throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]);
+}
+
+function assertWasmThrows(value, code) {
+    assertEquals("number", typeof(value));
+    try {
+      if (typeof code === 'function') {
+        code();
+      } else {
+        eval(code);
+      }
+    } catch (e) {
+      assertEquals("number", typeof e);
+      assertEquals(value, e);
+      // Success.
+      return;
+    }
+    throw new MjsUnitAssertionError("Did not throw at all, expected: " + value);
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiwasmmodulebuilderjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js                              (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,555 @@
</span><ins>+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Used for encoding f32 and double constants to bits.
+let __buffer = new ArrayBuffer(8);
+let byte_view = new Int8Array(__buffer);
+let f32_view = new Float32Array(__buffer);
+let f64_view = new Float64Array(__buffer);
+
+class Binary extends Array {
+  emit_u8(val) {
+    this.push(val);
+  }
+
+  emit_u16(val) {
+    this.push(val & 0xff);
+    this.push((val >> 8) & 0xff);
+  }
+
+  emit_u32(val) {
+    this.push(val & 0xff);
+    this.push((val >> 8) & 0xff);
+    this.push((val >> 16) & 0xff);
+    this.push((val >> 24) & 0xff);
+  }
+
+  emit_u32v(val) {
+    while (true) {
+      let v = val & 0xff;
+      val = val >>> 7;
+      if (val == 0) {
+        this.push(v);
+        break;
+      }
+      this.push(v | 0x80);
+    }
+  }
+
+  emit_bytes(data) {
+    for (let i = 0; i < data.length; i++) {
+      this.push(data[i] & 0xff);
+    }
+  }
+
+  emit_string(string) {
+    // When testing illegal names, we pass a byte array directly.
+    if (string instanceof Array) {
+      this.emit_u32v(string.length);
+      this.emit_bytes(string);
+      return;
+    }
+
+    // This is the hacky way to convert a JavaScript string to a UTF8 encoded
+    // string only containing single-byte characters.
+    let string_utf8 = unescape(encodeURIComponent(string));
+    this.emit_u32v(string_utf8.length);
+    for (let i = 0; i < string_utf8.length; i++) {
+      this.emit_u8(string_utf8.charCodeAt(i));
+    }
+  }
+
+  emit_header() {
+    this.push(kWasmH0, kWasmH1, kWasmH2, kWasmH3,
+              kWasmV0, kWasmV1, kWasmV2, kWasmV3);
+  }
+
+  emit_section(section_code, content_generator) {
+    // Emit section name.
+    this.emit_u8(section_code);
+    // Emit the section to a temporary buffer: its full length isn't know yet.
+    let section = new Binary;
+    content_generator(section);
+    // Emit section length.
+    this.emit_u32v(section.length);
+    // Copy the temporary buffer.
+    this.push(...section);
+  }
+}
+
+class WasmFunctionBuilder {
+  constructor(module, name, type_index) {
+    this.module = module;
+    this.name = name;
+    this.type_index = type_index;
+    this.body = [];
+  }
+
+  exportAs(name) {
+    this.module.addExport(name, this.index);
+    return this;
+  }
+
+  exportFunc() {
+    this.exportAs(this.name);
+    return this;
+  }
+
+  addBody(body) {
+    this.body = body;
+    return this;
+  }
+
+  addLocals(locals) {
+    this.locals = locals;
+    return this;
+  }
+
+  end() {
+    return this.module;
+  }
+}
+
+class WasmGlobalBuilder {
+  constructor(module, type, mutable) {
+    this.module = module;
+    this.type = type;
+    this.mutable = mutable;
+    this.init = 0;
+  }
+
+  exportAs(name) {
+    this.module.exports.push({name: name, kind: kExternalGlobal,
+                              index: this.index});
+    return this;
+  }
+}
+
+class WasmModuleBuilder {
+  constructor() {
+    this.types = [];
+    this.imports = [];
+    this.exports = [];
+    this.globals = [];
+    this.functions = [];
+    this.function_table = [];
+    this.function_table_length = 0;
+    this.function_table_inits = [];
+    this.segments = [];
+    this.explicit = [];
+    this.num_imported_funcs = 0;
+    this.num_imported_globals = 0;
+    return this;
+  }
+
+  addStart(start_index) {
+    this.start_index = start_index;
+    return this;
+  }
+
+  addMemory(min, max, exp) {
+    this.memory = {min: min, max: max, exp: exp};
+    return this;
+  }
+
+  addExplicitSection(bytes) {
+    this.explicit.push(bytes);
+    return this;
+  }
+
+  addType(type) {
+    // TODO: canonicalize types?
+    this.types.push(type);
+    return this.types.length - 1;
+  }
+
+  addGlobal(local_type, mutable) {
+    let glob = new WasmGlobalBuilder(this, local_type, mutable);
+    glob.index = this.globals.length + this.num_imported_globals;
+    this.globals.push(glob);
+    return glob;
+  }
+
+  addFunction(name, type) {
+    let type_index = (typeof type) == "number" ? type : this.addType(type);
+    let func = new WasmFunctionBuilder(this, name, type_index);
+    func.index = this.functions.length + this.num_imported_funcs;
+    this.functions.push(func);
+    return func;
+  }
+
+  addImport(module = "", name, type) {
+    let type_index = (typeof type) == "number" ? type : this.addType(type);
+    this.imports.push({module: module, name: name, kind: kExternalFunction,
+                       type: type_index});
+    return this.num_imported_funcs++;
+  }
+
+  addImportedGlobal(module = "", name, type) {
+    let o = {module: module, name: name, kind: kExternalGlobal, type: type,
+             mutable: false}
+    this.imports.push(o);
+    return this.num_imported_globals++;
+  }
+
+  addImportedMemory(module = "", name, initial = 0, maximum) {
+    let o = {module: module, name: name, kind: kExternalMemory,
+             initial: initial, maximum: maximum};
+    this.imports.push(o);
+    return this;
+  }
+
+  addImportedTable(module = "", name, initial, maximum) {
+    let o = {module: module, name: name, kind: kExternalTable, initial: initial,
+             maximum: maximum};
+    this.imports.push(o);
+  }
+
+  addExport(name, index) {
+    this.exports.push({name: name, kind: kExternalFunction, index: index});
+    return this;
+  }
+
+  addExportOfKind(name, kind, index) {
+    this.exports.push({name: name, kind: kind, index: index});
+    return this;
+  }
+
+  addDataSegment(addr, data, is_global = false) {
+    this.segments.push({addr: addr, data: data, is_global: is_global});
+    return this.segments.length - 1;
+  }
+
+  exportMemoryAs(name) {
+    this.exports.push({name: name, kind: kExternalMemory, index: 0});
+  }
+
+  addFunctionTableInit(base, is_global, array) {
+    this.function_table_inits.push({base: base, is_global: is_global,
+                                    array: array});
+    if (!is_global) {
+      var length = base + array.length;
+      if (length > this.function_table_length) {
+        this.function_table_length = length;
+      }
+    }
+    return this;
+  }
+
+  appendToTable(array) {
+    return this.addFunctionTableInit(this.function_table.length, false, array);
+  }
+
+  setFunctionTableLength(length) {
+    this.function_table_length = length;
+    return this;
+  }
+
+  toArray(debug = false) {
+    let binary = new Binary;
+    let wasm = this;
+
+    // Add header
+    binary.emit_header();
+
+    // Add type section
+    if (wasm.types.length > 0) {
+      if (debug) print("emitting types @ " + binary.length);
+      binary.emit_section(kTypeSectionCode, section => {
+        section.emit_u32v(wasm.types.length);
+        for (let type of wasm.types) {
+          section.emit_u8(kWasmFunctionTypeForm);
+          section.emit_u32v(type.params.length);
+          for (let param of type.params) {
+            section.emit_u8(param);
+          }
+          section.emit_u32v(type.results.length);
+          for (let result of type.results) {
+            section.emit_u8(result);
+          }
+        }
+      });
+    }
+
+    // Add imports section
+    if (wasm.imports.length > 0) {
+      if (debug) print("emitting imports @ " + binary.length);
+      binary.emit_section(kImportSectionCode, section => {
+        section.emit_u32v(wasm.imports.length);
+        for (let imp of wasm.imports) {
+          section.emit_string(imp.module);
+          section.emit_string(imp.name || '');
+          section.emit_u8(imp.kind);
+          if (imp.kind == kExternalFunction) {
+            section.emit_u32v(imp.type);
+          } else if (imp.kind == kExternalGlobal) {
+            section.emit_u32v(imp.type);
+            section.emit_u8(imp.mutable);
+          } else if (imp.kind == kExternalMemory) {
+            var has_max = (typeof imp.maximum) != "undefined";
+            section.emit_u8(has_max ? 1 : 0); // flags
+            section.emit_u32v(imp.initial); // initial
+            if (has_max) section.emit_u32v(imp.maximum); // maximum
+          } else if (imp.kind == kExternalTable) {
+            section.emit_u8(kWasmAnyFunctionTypeForm);
+            var has_max = (typeof imp.maximum) != "undefined";
+            section.emit_u8(has_max ? 1 : 0); // flags
+            section.emit_u32v(imp.initial); // initial
+            if (has_max) section.emit_u32v(imp.maximum); // maximum
+          } else {
+            throw new Error("unknown/unsupported import kind " + imp.kind);
+          }
+        }
+      });
+    }
+
+    // Add functions declarations
+    let has_names = false;
+    let names = false;
+    if (wasm.functions.length > 0) {
+      if (debug) print("emitting function decls @ " + binary.length);
+      binary.emit_section(kFunctionSectionCode, section => {
+        section.emit_u32v(wasm.functions.length);
+        for (let func of wasm.functions) {
+          has_names = has_names || (func.name != undefined &&
+                                   func.name.length > 0);
+          section.emit_u32v(func.type_index);
+        }
+      });
+    }
+
+    // Add function_table.
+    if (wasm.function_table_length > 0) {
+      if (debug) print("emitting table @ " + binary.length);
+      binary.emit_section(kTableSectionCode, section => {
+        section.emit_u8(1);  // one table entry
+        section.emit_u8(kWasmAnyFunctionTypeForm);
+        section.emit_u8(1);
+        section.emit_u32v(wasm.function_table_length);
+        section.emit_u32v(wasm.function_table_length);
+      });
+    }
+
+    // Add memory section
+    if (wasm.memory != undefined) {
+      if (debug) print("emitting memory @ " + binary.length);
+      binary.emit_section(kMemorySectionCode, section => {
+        section.emit_u8(1);  // one memory entry
+        section.emit_u32v(kResizableMaximumFlag);
+        section.emit_u32v(wasm.memory.min);
+        section.emit_u32v(wasm.memory.max);
+      });
+    }
+
+    // Add global section.
+    if (wasm.globals.length > 0) {
+      if (debug) print ("emitting globals @ " + binary.length);
+      binary.emit_section(kGlobalSectionCode, section => {
+        section.emit_u32v(wasm.globals.length);
+        for (let global of wasm.globals) {
+          section.emit_u8(global.type);
+          section.emit_u8(global.mutable);
+          if ((typeof global.init_index) == "undefined") {
+            // Emit a constant initializer.
+            switch (global.type) {
+            case kWasmI32:
+              section.emit_u8(kExprI32Const);
+              section.emit_u32v(global.init);
+              break;
+            case kWasmI64:
+              section.emit_u8(kExprI64Const);
+              section.emit_u8(global.init);
+              break;
+            case kWasmF32:
+              section.emit_u8(kExprF32Const);
+              f32_view[0] = global.init;
+              section.emit_u8(byte_view[0]);
+              section.emit_u8(byte_view[1]);
+              section.emit_u8(byte_view[2]);
+              section.emit_u8(byte_view[3]);
+              break;
+            case kWasmF64:
+              section.emit_u8(kExprF64Const);
+              f64_view[0] = global.init;
+              section.emit_u8(byte_view[0]);
+              section.emit_u8(byte_view[1]);
+              section.emit_u8(byte_view[2]);
+              section.emit_u8(byte_view[3]);
+              section.emit_u8(byte_view[4]);
+              section.emit_u8(byte_view[5]);
+              section.emit_u8(byte_view[6]);
+              section.emit_u8(byte_view[7]);
+              break;
+            }
+          } else {
+            // Emit a global-index initializer.
+            section.emit_u8(kExprGetGlobal);
+            section.emit_u32v(global.init_index);
+          }
+          section.emit_u8(kExprEnd);  // end of init expression
+        }
+      });
+    }
+
+    // Add export table.
+    var mem_export = (wasm.memory != undefined && wasm.memory.exp);
+    var exports_count = wasm.exports.length + (mem_export ? 1 : 0);
+    if (exports_count > 0) {
+      if (debug) print("emitting exports @ " + binary.length);
+      binary.emit_section(kExportSectionCode, section => {
+        section.emit_u32v(exports_count);
+        for (let exp of wasm.exports) {
+          section.emit_string(exp.name);
+          section.emit_u8(exp.kind);
+          section.emit_u32v(exp.index);
+        }
+        if (mem_export) {
+          section.emit_string("memory");
+          section.emit_u8(kExternalMemory);
+          section.emit_u8(0);
+        }
+      });
+    }
+
+    // Add start function section.
+    if (wasm.start_index != undefined) {
+      if (debug) print("emitting start function @ " + binary.length);
+      binary.emit_section(kStartSectionCode, section => {
+        section.emit_u32v(wasm.start_index);
+      });
+    }
+
+    // Add table elements.
+    if (wasm.function_table_inits.length > 0) {
+      if (debug) print("emitting table @ " + binary.length);
+      binary.emit_section(kElementSectionCode, section => {
+        var inits = wasm.function_table_inits;
+        section.emit_u32v(inits.length);
+        section.emit_u8(0); // table index
+
+        for (let init of inits) {
+          if (init.is_global) {
+            section.emit_u8(kExprGetGlobal);
+          } else {
+            section.emit_u8(kExprI32Const);
+          }
+          section.emit_u32v(init.base);
+          section.emit_u8(kExprEnd);
+          section.emit_u32v(init.array.length);
+          for (let index of init.array) {
+            section.emit_u32v(index);
+          }
+        }
+      });
+    }
+
+    // Add function bodies.
+    if (wasm.functions.length > 0) {
+      // emit function bodies
+      if (debug) print("emitting code @ " + binary.length);
+      binary.emit_section(kCodeSectionCode, section => {
+        section.emit_u32v(wasm.functions.length);
+        for (let func of wasm.functions) {
+          // Function body length will be patched later.
+          let local_decls = [];
+          let l = func.locals;
+          if (l != undefined) {
+            let local_decls_count = 0;
+            if (l.i32_count > 0) {
+              local_decls.push({count: l.i32_count, type: kWasmI32});
+            }
+            if (l.i64_count > 0) {
+              local_decls.push({count: l.i64_count, type: kWasmI64});
+            }
+            if (l.f32_count > 0) {
+              local_decls.push({count: l.f32_count, type: kWasmF32});
+            }
+            if (l.f64_count > 0) {
+              local_decls.push({count: l.f64_count, type: kWasmF64});
+            }
+          }
+
+          let header = new Binary;
+          header.emit_u32v(local_decls.length);
+          for (let decl of local_decls) {
+            header.emit_u32v(decl.count);
+            header.emit_u8(decl.type);
+          }
+
+          section.emit_u32v(header.length + func.body.length);
+          section.emit_bytes(header);
+          section.emit_bytes(func.body);
+        }
+      });
+    }
+
+    // Add data segments.
+    if (wasm.segments.length > 0) {
+      if (debug) print("emitting data segments @ " + binary.length);
+      binary.emit_section(kDataSectionCode, section => {
+        section.emit_u32v(wasm.segments.length);
+        for (let seg of wasm.segments) {
+          section.emit_u8(0);  // linear memory index 0
+          if (seg.is_global) {
+            // initializer is a global variable
+            section.emit_u8(kExprGetGlobal);
+            section.emit_u32v(seg.addr);
+          } else {
+            // initializer is a constant
+            section.emit_u8(kExprI32Const);
+            section.emit_u32v(seg.addr);
+          }
+          section.emit_u8(kExprEnd);
+          section.emit_u32v(seg.data.length);
+          section.emit_bytes(seg.data);
+        }
+      });
+    }
+
+    // Add any explicitly added sections
+    for (let exp of wasm.explicit) {
+      if (debug) print("emitting explicit @ " + binary.length);
+      binary.emit_bytes(exp);
+    }
+
+    // Add function names.
+    if (has_names) {
+      if (debug) print("emitting names @ " + binary.length);
+      binary.emit_section(kUnknownSectionCode, section => {
+        section.emit_string("name");
+        var count = wasm.functions.length + wasm.num_imported_funcs;
+        section.emit_u32v(count);
+        for (var i = 0; i < wasm.num_imported_funcs; i++) {
+          section.emit_u8(0); // empty string
+          section.emit_u8(0); // local names count == 0
+        }
+        for (let func of wasm.functions) {
+          var name = func.name == undefined ? "" : func.name;
+          section.emit_string(name);
+          section.emit_u8(0);  // local names count == 0
+        }
+      });
+    }
+
+    return binary;
+  }
+
+  toBuffer(debug = false) {
+    let bytes = this.toArray(debug);
+    let buffer = new ArrayBuffer(bytes.length);
+    let view = new Uint8Array(buffer);
+    for (let i = 0; i < bytes.length; i++) {
+      let val = bytes[i];
+      if ((typeof val) == "string") val = val.charCodeAt(0);
+      view[i] = val | 0;
+    }
+    return new Uint8Array(buffer);
+  }
+
+  instantiate(...args) {
+    let module = new WebAssembly.Module(this.toBuffer());
+    let instance = new WebAssembly.Instance(module, ...args);
+    return instance;
+  }
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -122,4 +122,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-width-1000px.html [ Pass Failure ]
</span><span class="cx"> webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html [ Pass Failure ]
</span><del>-webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/error-codes/error.html [ Pass Failure ]
</del><span class="cx">\ No newline at end of file
</span><ins>+webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/error-codes/error.html [ Pass Failure ]
+
+imported/w3c/web-platform-tests/wasm [ Skip ]
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations  2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/LayoutTests/platform/win/TestExpectations     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -4423,3 +4423,5 @@
</span><span class="cx"> webkit.org/b/198112 http/tests/security/showModalDialog-sync-cross-origin-page-load2.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/198679 fast/events/fire-mousedown-while-pressing-mouse-button.html [ Failure ]
</span><ins>+
+imported/w3c/web-platform-tests/wasm [ Skip ]
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt       2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -108,7 +108,6 @@
</span><span class="cx">     wasm/js/WebAssemblyMemoryPrototype.cpp
</span><span class="cx">     wasm/js/WebAssemblyModuleConstructor.cpp
</span><span class="cx">     wasm/js/WebAssemblyModulePrototype.cpp
</span><del>-    wasm/js/WebAssemblyPrototype.cpp
</del><span class="cx">     wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
</span><span class="cx">     wasm/js/WebAssemblyRuntimeErrorPrototype.cpp
</span><span class="cx">     wasm/js/WebAssemblyTableConstructor.cpp
</span><span class="lines">@@ -1011,8 +1010,8 @@
</span><span class="cx">     wasm/WasmPageCount.h
</span><span class="cx">     wasm/WasmTierUpCount.h
</span><span class="cx"> 
</span><ins>+    wasm/js/JSWebAssembly.h
</ins><span class="cx">     wasm/js/JSWebAssemblyModule.h
</span><del>-    wasm/js/WebAssemblyPrototype.h
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     yarr/RegularExpression.h
</span><span class="lines">@@ -1220,7 +1219,6 @@
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/StringPrototype.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/TypedArrayConstructor.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/TypedArrayPrototype.js
</span><del>-    ${JAVASCRIPTCORE_DIR}/builtins/WebAssemblyPrototype.js
</del><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> add_custom_command(
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/ChangeLog       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Improve wasm wpt test results by fixing miscellaneous issues
+        https://bugs.webkit.org/show_bug.cgi?id=199783
+
+        Reviewed by Mark Lam.
+
+        This patch fixes miscellaneous issues in our Wasm JS API implementation to improve WPT score.
+        I picked trivial ones in this patch to make this easily reviewable.
+
+        1. Remove WebAssemblyPrototype. It does not exist in the spec. Merging WebAssemblyPrototype into JSWebAssembly.
+        2. Fix various attributes. It does not match to the usual JSC builtin's convention. But this change
+           is correct because they are changed to be matched against WebIDL definition, and WebAssembly implementation
+           follows WebIDL. In the future, we could move WebCore WebIDL things into WTF layer and even use (or leverage
+           some of utility functions) in our WebAssembly JS API implementation.
+        3. Fix how we interpret "present" in WebAssembly spec. This does not mean [[HasProperty]] result. It follows to
+           WebIDL spec, and it means that [[Get]] result is not undefined.
+        4. Add argument count check to Module.customSections, which is required because the method is defined in WebIDL.
+        5. Fix toNonWrappingUint32 to match it to WebIDL's conversion rule.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * builtins/WebAssembly.js: Renamed from Source/JavaScriptCore/builtins/WebAssemblyPrototype.js.
+        * jit/Repatch.cpp:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * runtime/JSModuleLoader.cpp:
+        (JSC::moduleLoaderParseModule):
+        * wasm/js/JSWebAssembly.cpp:
+        (JSC::JSWebAssembly::create):
+        (JSC::JSWebAssembly::finishCreation):
+        (JSC::reject):
+        (JSC::webAssemblyModuleValidateAsyncInternal):
+        (JSC::webAssemblyCompileFunc):
+        (JSC::resolve):
+        (JSC::JSWebAssembly::webAssemblyModuleValidateAsync):
+        (JSC::instantiate):
+        (JSC::compileAndInstantiate):
+        (JSC::JSWebAssembly::instantiate):
+        (JSC::webAssemblyModuleInstantinateAsyncInternal):
+        (JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync):
+        (JSC::webAssemblyInstantiateFunc):
+        (JSC::webAssemblyValidateFunc):
+        (JSC::webAssemblyCompileStreamingInternal):
+        (JSC::webAssemblyInstantiateStreamingInternal):
+        * wasm/js/JSWebAssembly.h:
+        * wasm/js/JSWebAssemblyHelpers.h:
+        (JSC::toNonWrappingUint32):
+        * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
+        (JSC::WebAssemblyCompileErrorConstructor::finishCreation):
+        * wasm/js/WebAssemblyInstanceConstructor.cpp:
+        (JSC::WebAssemblyInstanceConstructor::finishCreation):
+        * wasm/js/WebAssemblyInstancePrototype.cpp:
+        * wasm/js/WebAssemblyLinkErrorConstructor.cpp:
+        (JSC::WebAssemblyLinkErrorConstructor::finishCreation):
+        * wasm/js/WebAssemblyMemoryConstructor.cpp:
+        (JSC::constructJSWebAssemblyMemory):
+        (JSC::WebAssemblyMemoryConstructor::finishCreation):
+        * wasm/js/WebAssemblyMemoryPrototype.cpp:
+        * wasm/js/WebAssemblyModuleConstructor.cpp:
+        (JSC::webAssemblyModuleCustomSections):
+        (JSC::WebAssemblyModuleConstructor::finishCreation):
+        * wasm/js/WebAssemblyPrototype.cpp: Removed.
+        * wasm/js/WebAssemblyPrototype.h: Removed.
+        * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
+        (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation):
+        * wasm/js/WebAssemblyTableConstructor.cpp:
+        (JSC::constructJSWebAssemblyTable):
+        (JSC::WebAssemblyTableConstructor::finishCreation):
+        * wasm/js/WebAssemblyTablePrototype.cpp:
+
</ins><span class="cx"> 2019-07-15  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Enable a debug WebRTC mode without any encryption
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreDerivedSourcesinputxcfilelist"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/DerivedSources-input.xcfilelist (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/DerivedSources-input.xcfilelist      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/DerivedSources-input.xcfilelist 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> $(PROJECT_DIR)/builtins/StringPrototype.js
</span><span class="cx"> $(PROJECT_DIR)/builtins/TypedArrayConstructor.js
</span><span class="cx"> $(PROJECT_DIR)/builtins/TypedArrayPrototype.js
</span><del>-$(PROJECT_DIR)/builtins/WebAssemblyPrototype.js
</del><ins>+$(PROJECT_DIR)/builtins/WebAssembly.js
</ins><span class="cx"> $(PROJECT_DIR)/bytecode/BytecodeList.rb
</span><span class="cx"> $(PROJECT_DIR)/create_hash_table
</span><span class="cx"> $(PROJECT_DIR)/disassembler/udis86/optable.xml
</span><span class="lines">@@ -183,7 +183,6 @@
</span><span class="cx"> $(PROJECT_DIR)/wasm/js/WebAssemblyMemoryPrototype.cpp
</span><span class="cx"> $(PROJECT_DIR)/wasm/js/WebAssemblyModuleConstructor.cpp
</span><span class="cx"> $(PROJECT_DIR)/wasm/js/WebAssemblyModulePrototype.cpp
</span><del>-$(PROJECT_DIR)/wasm/js/WebAssemblyPrototype.cpp
</del><span class="cx"> $(PROJECT_DIR)/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
</span><span class="cx"> $(PROJECT_DIR)/wasm/js/WebAssemblyRuntimeErrorPrototype.cpp
</span><span class="cx"> $(PROJECT_DIR)/wasm/js/WebAssemblyTableConstructor.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreDerivedSourcesoutputxcfilelist"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -69,7 +69,6 @@
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyMemoryPrototype.lut.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyModuleConstructor.lut.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyModulePrototype.lut.h
</span><del>-$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyPrototype.lut.h
</del><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyRuntimeErrorConstructor.lut.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyRuntimeErrorPrototype.lut.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyTableConstructor.lut.h
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/DerivedSources.make (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/DerivedSources.make  2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/DerivedSources.make     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">     $(JavaScriptCore)/builtins/StringPrototype.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/TypedArrayConstructor.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/TypedArrayPrototype.js \
</span><del>-    $(JavaScriptCore)/builtins/WebAssemblyPrototype.js \
</del><ins>+    $(JavaScriptCore)/builtins/WebAssembly.js \
</ins><span class="cx"> #
</span><span class="cx"> 
</span><span class="cx"> # The combined output file depends on the contents of builtins and generator scripts, so
</span><span class="lines">@@ -183,7 +183,6 @@
</span><span class="cx">     WebAssemblyMemoryPrototype.lut.h \
</span><span class="cx">     WebAssemblyModuleConstructor.lut.h \
</span><span class="cx">     WebAssemblyModulePrototype.lut.h \
</span><del>-    WebAssemblyPrototype.lut.h \
</del><span class="cx">     WebAssemblyRuntimeErrorConstructor.lut.h \
</span><span class="cx">     WebAssemblyRuntimeErrorPrototype.lut.h \
</span><span class="cx">     WebAssemblyTableConstructor.lut.h \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1573,7 +1573,6 @@
</span><span class="cx">          AD2FCC1F1DB59CB200B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC131DB59C5900B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h */; };
</span><span class="cx">          AD2FCC201DB59CB200B3E736 /* WebAssemblyTableConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */; };
</span><span class="cx">          AD2FCC211DB59CB200B3E736 /* WebAssemblyTablePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */; };
</span><del>-               AD2FCC2D1DB838FD00B3E736 /* WebAssemblyPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">           AD412B341E7B2E9E008AF157 /* WasmContext.h in Headers */ = {isa = PBXBuildFile; fileRef = AD412B321E7B2E8A008AF157 /* WasmContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          AD4252511E5D0E14009D2A97 /* FullCodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4252501E5D0DEB009D2A97 /* FullCodeOrigin.h */; };
</span><span class="cx">          AD4937C41DDBE6140077C807 /* AbstractModuleRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4937C21DDBE60A0077C807 /* AbstractModuleRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -4512,8 +4511,6 @@
</span><span class="cx">          AD2FCC131DB59C5900B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyRuntimeErrorPrototype.lut.h; sourceTree = "<group>"; };
</span><span class="cx">          AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyTableConstructor.lut.h; sourceTree = "<group>"; };
</span><span class="cx">          AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyTablePrototype.lut.h; sourceTree = "<group>"; };
</span><del>-               AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyPrototype.cpp; path = js/WebAssemblyPrototype.cpp; sourceTree = "<group>"; };
-               AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyPrototype.h; path = js/WebAssemblyPrototype.h; sourceTree = "<group>"; };
</del><span class="cx">           AD2FCC321DC4045300B3E736 /* WasmFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmFormat.cpp; sourceTree = "<group>"; };
</span><span class="cx">          AD412B321E7B2E8A008AF157 /* WasmContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmContext.h; sourceTree = "<group>"; };
</span><span class="cx">          AD412B351E7B57C0008AF157 /* AllowMacroScratchRegisterUsageIf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllowMacroScratchRegisterUsageIf.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4816,6 +4813,7 @@
</span><span class="cx">          E39D9D841D39000600667282 /* InterpreterInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterpreterInlines.h; sourceTree = "<group>"; };
</span><span class="cx">          E39DA4A41B7E8B7C0084F33A /* JSModuleRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSModuleRecord.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E39DA4A51B7E8B7C0084F33A /* JSModuleRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModuleRecord.h; sourceTree = "<group>"; };
</span><ins>+               E39E030D22D9EA3E00408C18 /* WebAssembly.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = WebAssembly.js; sourceTree = "<group>"; };
</ins><span class="cx">           E39EEAF12281244C008474F4 /* ObjectToStringAdaptiveStructureWatchpoint.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectToStringAdaptiveStructureWatchpoint.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E39EEAF22281244C008474F4 /* ObjectToStringAdaptiveStructureWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ObjectToStringAdaptiveStructureWatchpoint.h; sourceTree = "<group>"; };
</span><span class="cx">          E3A0531621342B660022EC14 /* WasmStreamingParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmStreamingParser.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -8360,6 +8358,7 @@
</span><span class="cx">                          A1E0451B1C25B4B100BB663C /* StringPrototype.js */,
</span><span class="cx">                          534C457A1BC703DC007476A7 /* TypedArrayConstructor.js */,
</span><span class="cx">                          53917E831B791CB8000EBD33 /* TypedArrayPrototype.js */,
</span><ins>+                               E39E030D22D9EA3E00408C18 /* WebAssembly.js */,
</ins><span class="cx">                   );
</span><span class="cx">                  path = builtins;
</span><span class="cx">                  sourceTree = "<group>";
</span><span class="lines">@@ -8422,8 +8421,6 @@
</span><span class="cx">                          AD2FCB9B1DB585A600B3E736 /* WebAssemblyModulePrototype.h */,
</span><span class="cx">                          AD4937C51DDCDCF00077C807 /* WebAssemblyModuleRecord.cpp */,
</span><span class="cx">                          AD4937C61DDCDCF00077C807 /* WebAssemblyModuleRecord.h */,
</span><del>-                               AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */,
-                               AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */,
</del><span class="cx">                           AD2FCBBC1DB58DA400B3E736 /* WebAssemblyRuntimeErrorConstructor.cpp */,
</span><span class="cx">                          AD2FCBBD1DB58DA400B3E736 /* WebAssemblyRuntimeErrorConstructor.h */,
</span><span class="cx">                          AD2FCBBE1DB58DA400B3E736 /* WebAssemblyRuntimeErrorPrototype.cpp */,
</span><span class="lines">@@ -10064,7 +10061,6 @@
</span><span class="cx">                          AD2FCC031DB58DAD00B3E736 /* WebAssemblyModulePrototype.h in Headers */,
</span><span class="cx">                          AD2FCC1D1DB59CB200B3E736 /* WebAssemblyModulePrototype.lut.h in Headers */,
</span><span class="cx">                          AD4937C81DDD0AAE0077C807 /* WebAssemblyModuleRecord.h in Headers */,
</span><del>-                               AD2FCC2D1DB838FD00B3E736 /* WebAssemblyPrototype.h in Headers */,
</del><span class="cx">                           AD2FCBF91DB58DAD00B3E736 /* WebAssemblyRuntimeErrorConstructor.h in Headers */,
</span><span class="cx">                          AD2FCC1E1DB59CB200B3E736 /* WebAssemblyRuntimeErrorConstructor.lut.h in Headers */,
</span><span class="cx">                          AD2FCBFB1DB58DAD00B3E736 /* WebAssemblyRuntimeErrorPrototype.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/Sources.txt (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/Sources.txt  2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/Sources.txt     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1053,7 +1053,6 @@
</span><span class="cx"> wasm/js/WebAssemblyModuleConstructor.cpp
</span><span class="cx"> wasm/js/WebAssemblyModulePrototype.cpp
</span><span class="cx"> wasm/js/WebAssemblyModuleRecord.cpp
</span><del>-wasm/js/WebAssemblyPrototype.cpp
</del><span class="cx"> wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
</span><span class="cx"> wasm/js/WebAssemblyRuntimeErrorPrototype.cpp
</span><span class="cx"> wasm/js/WebAssemblyTableConstructor.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsWebAssemblyjsfromrev247439trunkSourceJavaScriptCorebuiltinsWebAssemblyPrototypejs"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/builtins/WebAssembly.js (from rev 247439, trunk/Source/JavaScriptCore/builtins/WebAssemblyPrototype.js) (0 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/WebAssembly.js                              (rev 0)
+++ trunk/Source/JavaScriptCore/builtins/WebAssembly.js 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2018 Oleksandr Skachkov <gskachkov@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function compileStreaming(argument) {
+    "use strict";
+
+    return @Promise.@resolve(argument).@then(@webAssemblyCompileStreamingInternal);
+}
+
+function instantiateStreaming(argument) {
+    "use strict";
+
+    return @Promise.@resolve(argument).@then(@webAssemblyInstantiateStreamingInternal);
+}
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsWebAssemblyPrototypejs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/builtins/WebAssemblyPrototype.js (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/WebAssemblyPrototype.js     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/builtins/WebAssemblyPrototype.js        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,37 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Oleksandr Skachkov <gskachkov@gmail.com>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-function compileStreaming(argument) {
-    "use strict";
-
-    return @Promise.@resolve(argument).@then(@webAssemblyCompileStreamingInternal);
-}
-
-function instantiateStreaming(argument) {
-    "use strict";
-
-    return @Promise.@resolve(argument).@then(@webAssemblyInstantiateStreamingInternal);
-}
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRepatchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/Repatch.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/Repatch.cpp      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/jit/Repatch.cpp 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include "JSCInlines.h"
</span><span class="cx"> #include "JSModuleNamespaceObject.h"
</span><span class="cx"> #include "JSWebAssembly.h"
</span><ins>+#include "JSWebAssemblyModule.h"
</ins><span class="cx"> #include "LinkBuffer.h"
</span><span class="cx"> #include "ModuleNamespaceAccessCase.h"
</span><span class="cx"> #include "PolymorphicAccess.h"
</span><span class="lines">@@ -62,6 +63,8 @@
</span><span class="cx"> #include "StructureStubInfo.h"
</span><span class="cx"> #include "SuperSampler.h"
</span><span class="cx"> #include "ThunkGenerators.h"
</span><ins>+#include "WebAssemblyFunction.h"
+#include "WebAssemblyToJSCallee.h"
</ins><span class="cx"> #include <wtf/CommaPrinter.h>
</span><span class="cx"> #include <wtf/ListDump.h>
</span><span class="cx"> #include <wtf/StringPrintStream.h>
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp   2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -125,6 +125,13 @@
</span><span class="cx"> #include "JSWeakObjectRef.h"
</span><span class="cx"> #include "JSWeakSet.h"
</span><span class="cx"> #include "JSWebAssembly.h"
</span><ins>+#include "JSWebAssemblyCompileError.h"
+#include "JSWebAssemblyInstance.h"
+#include "JSWebAssemblyLinkError.h"
+#include "JSWebAssemblyMemory.h"
+#include "JSWebAssemblyModule.h"
+#include "JSWebAssemblyRuntimeError.h"
+#include "JSWebAssemblyTable.h"
</ins><span class="cx"> #include "JSWithScope.h"
</span><span class="cx"> #include "LazyClassStructureInlines.h"
</span><span class="cx"> #include "LazyPropertyInlines.h"
</span><span class="lines">@@ -178,7 +185,22 @@
</span><span class="cx"> #include "WeakObjectRefPrototype.h"
</span><span class="cx"> #include "WeakSetConstructor.h"
</span><span class="cx"> #include "WeakSetPrototype.h"
</span><del>-#include "WebAssemblyPrototype.h"
</del><ins>+#include "WebAssemblyCompileErrorConstructor.h"
+#include "WebAssemblyCompileErrorPrototype.h"
+#include "WebAssemblyFunction.h"
+#include "WebAssemblyInstanceConstructor.h"
+#include "WebAssemblyInstancePrototype.h"
+#include "WebAssemblyLinkErrorConstructor.h"
+#include "WebAssemblyLinkErrorPrototype.h"
+#include "WebAssemblyMemoryConstructor.h"
+#include "WebAssemblyMemoryPrototype.h"
+#include "WebAssemblyModuleConstructor.h"
+#include "WebAssemblyModulePrototype.h"
+#include "WebAssemblyModuleRecord.h"
+#include "WebAssemblyRuntimeErrorConstructor.h"
+#include "WebAssemblyRuntimeErrorPrototype.h"
+#include "WebAssemblyTableConstructor.h"
+#include "WebAssemblyTablePrototype.h"
</ins><span class="cx"> #include "WebAssemblyToJSCallee.h"
</span><span class="cx"> #include <wtf/RandomNumber.h>
</span><span class="cx"> 
</span><span class="lines">@@ -1060,7 +1082,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     if (Wasm::isSupported()) {
</span><del>-        auto* webAssemblyPrototype = WebAssemblyPrototype::create(vm, this, WebAssemblyPrototype::createStructure(vm, this, m_objectPrototype.get()));
</del><span class="cx">         m_webAssemblyModuleRecordStructure.initLater(
</span><span class="cx">             [] (const Initializer<Structure>& init) {
</span><span class="cx">                 init.set(WebAssemblyModuleRecord::createStructure(init.vm, init.owner, init.owner->m_objectPrototype.get()));
</span><span class="lines">@@ -1081,7 +1102,7 @@
</span><span class="cx">             [] (const Initializer<Structure>& init) {
</span><span class="cx">                 init.set(WebAssemblyToJSCallee::createStructure(init.vm, init.owner, jsNull()));
</span><span class="cx">             });
</span><del>-        auto* webAssembly = JSWebAssembly::create(vm, this, JSWebAssembly::createStructure(vm, this, webAssemblyPrototype));
</del><ins>+        auto* webAssembly = JSWebAssembly::create(vm, this, JSWebAssembly::createStructure(vm, this, m_objectPrototype.get()));
</ins><span class="cx">         putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), webAssembly, static_cast<unsigned>(PropertyAttribute::DontEnum));
</span><span class="cx"> 
</span><span class="cx"> #define CREATE_WEBASSEMBLY_PROTOTYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp   2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -41,12 +41,12 @@
</span><span class="cx"> #include "JSModuleNamespaceObject.h"
</span><span class="cx"> #include "JSModuleRecord.h"
</span><span class="cx"> #include "JSSourceCode.h"
</span><ins>+#include "JSWebAssembly.h"
</ins><span class="cx"> #include "ModuleAnalyzer.h"
</span><span class="cx"> #include "Nodes.h"
</span><span class="cx"> #include "ObjectConstructor.h"
</span><span class="cx"> #include "Parser.h"
</span><span class="cx"> #include "ParserError.h"
</span><del>-#include "WebAssemblyPrototype.h"
</del><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -413,7 +413,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     if (sourceCode.provider()->sourceType() == SourceProviderSourceType::WebAssembly)
</span><del>-        return JSValue::encode(WebAssemblyPrototype::instantiate(exec, deferred, moduleKey, jsSourceCode));
</del><ins>+        return JSValue::encode(JSWebAssembly::instantiate(exec, deferred, moduleKey, jsSourceCode));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     CodeProfiling profile(sourceCode);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp    2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp       2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -28,8 +28,31 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><ins>+#include "CatchScope.h"
+#include "Exception.h"
+#include "FunctionPrototype.h"
+#include "JSCBuiltins.h"
</ins><span class="cx"> #include "JSCInlines.h"
</span><ins>+#include "JSModuleNamespaceObject.h"
+#include "JSPromiseDeferred.h"
+#include "JSToWasm.h"
+#include "JSWebAssemblyHelpers.h"
+#include "JSWebAssemblyInstance.h"
+#include "JSWebAssemblyModule.h"
+#include "ObjectConstructor.h"
+#include "Options.h"
+#include "PromiseDeferredTimer.h"
+#include "StrongInlines.h"
+#include "ThrowScope.h"
+#include "WasmBBQPlan.h"
+#include "WasmToJS.h"
+#include "WasmWorklist.h"
+#include "WebAssemblyInstanceConstructor.h"
+#include "WebAssemblyModuleConstructor.h"
</ins><span class="cx"> 
</span><ins>+using JSC::Wasm::Plan;
+using JSC::Wasm::BBQPlan;
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSWebAssembly);
</span><span class="lines">@@ -46,6 +69,10 @@
</span><span class="cx"> 
</span><span class="cx"> #undef DEFINE_CALLBACK_FOR_CONSTRUCTOR
</span><span class="cx"> 
</span><ins>+static EncodedJSValue JSC_HOST_CALL webAssemblyCompileFunc(ExecState*);
+static EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateFunc(ExecState*);
+static EncodedJSValue JSC_HOST_CALL webAssemblyValidateFunc(ExecState*);
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #include "JSWebAssembly.lut.h"
</span><span class="lines">@@ -52,10 +79,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-const ClassInfo JSWebAssembly::s_info = { "WebAssembly", &Base::s_info, &jsWebAssemblyTable, nullptr, CREATE_METHOD_TABLE(JSWebAssembly) };
</del><ins>+const ClassInfo JSWebAssembly::s_info = { "WebAssembly", &Base::s_info, &webAssemblyTable, nullptr, CREATE_METHOD_TABLE(JSWebAssembly) };
</ins><span class="cx"> 
</span><span class="cx"> /* Source for JSWebAssembly.lut.h
</span><del>-@begin jsWebAssemblyTable
</del><ins>+@begin webAssemblyTable
</ins><span class="cx">   CompileError    createWebAssemblyCompileError  DontEnum|PropertyCallback
</span><span class="cx">   Instance        createWebAssemblyInstance      DontEnum|PropertyCallback
</span><span class="cx">   LinkError       createWebAssemblyLinkError     DontEnum|PropertyCallback
</span><span class="lines">@@ -63,13 +90,16 @@
</span><span class="cx">   Module          createWebAssemblyModule        DontEnum|PropertyCallback
</span><span class="cx">   RuntimeError    createWebAssemblyRuntimeError  DontEnum|PropertyCallback
</span><span class="cx">   Table           createWebAssemblyTable         DontEnum|PropertyCallback
</span><ins>+  compile         webAssemblyCompileFunc         Function 1
+  instantiate     webAssemblyInstantiateFunc     Function 1
+  validate        webAssemblyValidateFunc        Function 1
</ins><span class="cx"> @end
</span><span class="cx"> */
</span><span class="cx"> 
</span><del>-JSWebAssembly* JSWebAssembly::create(VM& vm, JSGlobalObject*, Structure* structure)
</del><ins>+JSWebAssembly* JSWebAssembly::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
</ins><span class="cx"> {
</span><span class="cx">     auto* object = new (NotNull, allocateCell<JSWebAssembly>(vm.heap)) JSWebAssembly(vm, structure);
</span><del>-    object->finishCreation(vm);
</del><ins>+    object->finishCreation(vm, globalObject);
</ins><span class="cx">     return object;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -78,10 +108,14 @@
</span><span class="cx">     return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JSWebAssembly::finishCreation(VM& vm)
</del><ins>+void JSWebAssembly::finishCreation(VM& vm, JSGlobalObject* globalObject)
</ins><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm);
</span><span class="cx">     ASSERT(inherits(vm, info()));
</span><ins>+    if (Options::useWebAssemblyStreamingApi()) {
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("compileStreaming", webAssemblyCompileStreamingCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("instantiateStreaming", webAssemblyInstantiateStreamingCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSWebAssembly::JSWebAssembly(VM& vm, Structure* structure)
</span><span class="lines">@@ -89,6 +123,291 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void reject(ExecState* exec, CatchScope& catchScope, JSPromiseDeferred* promise)
+{
+    Exception* exception = catchScope.exception();
+    ASSERT(exception);
+    catchScope.clearException();
+    promise->reject(exec, exception->value());
+    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void());
+}
+
+static void webAssemblyModuleValidateAsyncInternal(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source)
+{
+    VM& vm = exec->vm();
+    auto* globalObject = exec->lexicalGlobalObject();
+
+    Vector<Strong<JSCell>> dependencies;
+    dependencies.append(Strong<JSCell>(vm, globalObject));
+
+    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
+
+    Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, globalObject, &vm] (Wasm::Module::ValidationResult&& result) mutable {
+        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, globalObject, result = WTFMove(result), &vm] () mutable {
+            auto scope = DECLARE_CATCH_SCOPE(vm);
+            ExecState* exec = globalObject->globalExec();
+            JSValue module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result));
+            if (UNLIKELY(scope.exception())) {
+                reject(exec, scope, promise);
+                return;
+            }
+
+            promise->resolve(exec, module);
+            CLEAR_AND_RETURN_IF_EXCEPTION(scope, void());
+        });
+    }));
+}
+
+static EncodedJSValue JSC_HOST_CALL webAssemblyCompileFunc(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* globalObject = exec->lexicalGlobalObject();
+
+    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+
+    {
+        auto catchScope = DECLARE_CATCH_SCOPE(vm);
+        Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, exec->argument(0));
+
+        if (UNLIKELY(catchScope.exception()))
+            reject(exec, catchScope, promise);
+        else
+            webAssemblyModuleValidateAsyncInternal(exec, promise, WTFMove(source));
+
+        return JSValue::encode(promise->promise());
+    }
+}
+
+enum class Resolve { WithInstance, WithModuleRecord, WithModuleAndInstance };
+static void resolve(VM& vm, ExecState* exec, JSPromiseDeferred* promise, JSWebAssemblyInstance* instance, JSWebAssemblyModule* module, JSObject* importObject, Ref<Wasm::CodeBlock>&& codeBlock, Resolve resolveKind, Wasm::CreationMode creationMode)
+{
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+    instance->finalizeCreation(vm, exec, WTFMove(codeBlock), importObject, creationMode);
+    RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
+
+    if (resolveKind == Resolve::WithInstance)
+        promise->resolve(exec, instance);
+    else if (resolveKind == Resolve::WithModuleRecord) {
+        auto* moduleRecord = instance->moduleNamespaceObject()->moduleRecord();
+        if (Options::dumpModuleRecord())
+            moduleRecord->dump();
+        promise->resolve(exec, moduleRecord);
+    } else {
+        JSObject* result = constructEmptyObject(exec);
+        result->putDirect(vm, Identifier::fromString(&vm, "module"_s), module);
+        result->putDirect(vm, Identifier::fromString(&vm, "instance"_s), instance);
+        promise->resolve(exec, result);
+    }
+    CLEAR_AND_RETURN_IF_EXCEPTION(scope, void());
+}
+
+void JSWebAssembly::webAssemblyModuleValidateAsync(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source)
+{
+    VM& vm = exec->vm();
+    auto catchScope = DECLARE_CATCH_SCOPE(vm);
+    webAssemblyModuleValidateAsyncInternal(exec, promise, WTFMove(source));
+    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void());
+}
+
+static void instantiate(VM& vm, ExecState* exec, JSPromiseDeferred* promise, JSWebAssemblyModule* module, JSObject* importObject, const Identifier& moduleKey, Resolve resolveKind, Wasm::CreationMode creationMode)
+{
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+    // In order to avoid potentially recompiling a module. We first gather all the import/memory information prior to compiling code.
+    JSWebAssemblyInstance* instance = JSWebAssemblyInstance::create(vm, exec, moduleKey, module, importObject, exec->lexicalGlobalObject()->webAssemblyInstanceStructure(), Ref<Wasm::Module>(module->module()), creationMode);
+    RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
+
+    Vector<Strong<JSCell>> dependencies;
+    // The instance keeps the module alive.
+    dependencies.append(Strong<JSCell>(vm, instance));
+    dependencies.append(Strong<JSCell>(vm, importObject));
+    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
+    // Note: This completion task may or may not get called immediately.
+    module->module().compileAsync(&vm.wasmContext, instance->memoryMode(), createSharedTask<Wasm::CodeBlock::CallbackType>([promise, instance, module, importObject, resolveKind, creationMode, &vm] (Ref<Wasm::CodeBlock>&& refCodeBlock) mutable {
+        RefPtr<Wasm::CodeBlock> codeBlock = WTFMove(refCodeBlock);
+        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, instance, module, importObject, resolveKind, creationMode, &vm, codeBlock = WTFMove(codeBlock)] () mutable {
+            ExecState* exec = instance->globalObject(vm)->globalExec();
+            resolve(vm, exec, promise, instance, module, importObject, codeBlock.releaseNonNull(), resolveKind, creationMode);
+        });
+    }), &Wasm::createJSToWasmWrapper, &Wasm::wasmToJSException);
+}
+
+static void compileAndInstantiate(VM& vm, ExecState* exec, JSPromiseDeferred* promise, const Identifier& moduleKey, JSValue buffer, JSObject* importObject, Resolve resolveKind, Wasm::CreationMode creationMode)
+{
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+
+    auto* globalObject = exec->lexicalGlobalObject();
+
+    JSCell* moduleKeyCell = identifierToJSValue(vm, moduleKey).asCell();
+    Vector<Strong<JSCell>> dependencies;
+    dependencies.append(Strong<JSCell>(vm, importObject));
+    dependencies.append(Strong<JSCell>(vm, moduleKeyCell));
+    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
+
+    Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, buffer);
+    RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
+
+    Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, importObject, moduleKeyCell, globalObject, resolveKind, creationMode, &vm] (Wasm::Module::ValidationResult&& result) mutable {
+        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, importObject, moduleKeyCell, globalObject, result = WTFMove(result), resolveKind, creationMode, &vm] () mutable {
+            auto scope = DECLARE_CATCH_SCOPE(vm);
+            ExecState* exec = globalObject->globalExec();
+            JSWebAssemblyModule* module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result));
+            if (UNLIKELY(scope.exception()))
+                return reject(exec, scope, promise);
+
+            const Identifier moduleKey = JSValue(moduleKeyCell).toPropertyKey(exec);
+            if (UNLIKELY(scope.exception()))
+                return reject(exec, scope, promise);
+
+            instantiate(vm, exec, promise, module, importObject, moduleKey, resolveKind, creationMode);
+        });
+    }));
+}
+
+JSValue JSWebAssembly::instantiate(ExecState* exec, JSPromiseDeferred* promise, const Identifier& moduleKey, JSValue argument)
+{
+    VM& vm = exec->vm();
+    compileAndInstantiate(vm, exec, promise, moduleKey, argument, nullptr, Resolve::WithModuleRecord, Wasm::CreationMode::FromModuleLoader);
+    return promise->promise();
+}
+
+static void webAssemblyModuleInstantinateAsyncInternal(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source, JSObject* importObject)
+{
+    auto* globalObject = exec->lexicalGlobalObject();
+    VM& vm = exec->vm();
+
+    Vector<Strong<JSCell>> dependencies;
+    dependencies.append(Strong<JSCell>(vm, importObject));
+    dependencies.append(Strong<JSCell>(vm, globalObject));
+    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
+
+    Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, importObject, globalObject, &vm] (Wasm::Module::ValidationResult&& result) mutable {
+        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, importObject, globalObject, result = WTFMove(result), &vm] () mutable {
+            auto scope = DECLARE_CATCH_SCOPE(vm);
+            ExecState* exec = globalObject->globalExec();
+            JSWebAssemblyModule* module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result));
+            if (UNLIKELY(scope.exception()))
+                return reject(exec, scope, promise);
+
+            instantiate(vm, exec, promise, module, importObject, JSWebAssemblyInstance::createPrivateModuleKey(),  Resolve::WithModuleAndInstance, Wasm::CreationMode::FromJS);
+            CLEAR_AND_RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
+        });
+    }));
+}
+
+void JSWebAssembly::webAssemblyModuleInstantinateAsync(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source, JSObject* importedObject)
+{
+    VM& vm = exec->vm();
+    auto catchScope = DECLARE_CATCH_SCOPE(vm);
+    webAssemblyModuleInstantinateAsyncInternal(exec, promise, WTFMove(source), importedObject);
+    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void());
+}
+
+static EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateFunc(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* globalObject = exec->lexicalGlobalObject();
+
+    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+
+    {
+        auto catchScope = DECLARE_CATCH_SCOPE(vm);
+
+        JSValue importArgument = exec->argument(1);
+        JSObject* importObject = importArgument.getObject();
+        if (UNLIKELY(!importArgument.isUndefined() && !importObject)) {
+            promise->reject(exec, createTypeError(exec,
+                "second argument to WebAssembly.instantiate must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument)));
+            CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
+        } else {
+            JSValue firstArgument = exec->argument(0);
+            if (auto* module = jsDynamicCast<JSWebAssemblyModule*>(vm, firstArgument))
+                instantiate(vm, exec, promise, module, importObject, JSWebAssemblyInstance::createPrivateModuleKey(), Resolve::WithInstance, Wasm::CreationMode::FromJS);
+            else
+                compileAndInstantiate(vm, exec, promise, JSWebAssemblyInstance::createPrivateModuleKey(), firstArgument, importObject, Resolve::WithModuleAndInstance, Wasm::CreationMode::FromJS);
+        }
+
+        return JSValue::encode(promise->promise());
+    }
+}
+
+static EncodedJSValue JSC_HOST_CALL webAssemblyValidateFunc(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    auto [base, byteSize] = getWasmBufferFromValue(exec, exec->argument(0));
+    RETURN_IF_EXCEPTION(scope, encodedJSValue());
+    BBQPlan plan(&vm.wasmContext, BBQPlan::Validation, Plan::dontFinalize());
+    // FIXME: We might want to throw an OOM exception here if we detect that something will OOM.
+    // https://bugs.webkit.org/show_bug.cgi?id=166015
+    return JSValue::encode(jsBoolean(plan.parseAndValidateModule(base, byteSize)));
+}
+
+EncodedJSValue JSC_HOST_CALL webAssemblyCompileStreamingInternal(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto* globalObject = exec->lexicalGlobalObject();
+    auto catchScope = DECLARE_CATCH_SCOPE(vm);
+
+    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
+
+    Vector<Strong<JSCell>> dependencies;
+    dependencies.append(Strong<JSCell>(vm, globalObject));
+    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
+
+    if (globalObject->globalObjectMethodTable()->compileStreaming)
+        globalObject->globalObjectMethodTable()->compileStreaming(globalObject, exec, promise, exec->argument(0));
+    else {
+        // CompileStreaming is not supported in jsc, only in browser environment
+        ASSERT_NOT_REACHED();
+    }
+
+    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
+
+    return JSValue::encode(promise->promise());
+}
+
+EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateStreamingInternal(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* globalObject = exec->lexicalGlobalObject();
+
+    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    {
+        auto catchScope = DECLARE_CATCH_SCOPE(vm);
+
+        JSValue importArgument = exec->argument(1);
+        JSObject* importObject = importArgument.getObject();
+        if (UNLIKELY(!importArgument.isUndefined() && !importObject)) {
+            promise->reject(exec, createTypeError(exec,
+                "second argument to WebAssembly.instantiateStreaming must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument)));
+            CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
+        } else {
+            if (globalObject->globalObjectMethodTable()->instantiateStreaming) {
+                Vector<Strong<JSCell>> dependencies;
+                dependencies.append(Strong<JSCell>(vm, globalObject));
+                dependencies.append(Strong<JSCell>(vm, importObject));
+                vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
+
+                // FIXME: <http://webkit.org/b/184888> if there's an importObject and it contains a Memory, then we can compile the module with the right memory type (fast or not) by looking at the memory's type.
+                globalObject->globalObjectMethodTable()->instantiateStreaming(globalObject, exec, promise, exec->argument(0), importObject);
+            } else {
+                // InstantiateStreaming is not supported in jsc, only in browser environment.
+                ASSERT_NOT_REACHED();
+            }
+        }
+        CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
+
+        return JSValue::encode(promise->promise());
+    }
+}
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.h (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.h      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.h 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -28,31 +28,7 @@
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><span class="cx"> #include "JSObject.h"
</span><del>-#include "JSWebAssemblyCompileError.h"
-#include "JSWebAssemblyInstance.h"
-#include "JSWebAssemblyLinkError.h"
-#include "JSWebAssemblyMemory.h"
-#include "JSWebAssemblyModule.h"
-#include "JSWebAssemblyRuntimeError.h"
-#include "JSWebAssemblyTable.h"
-#include "WebAssemblyCompileErrorConstructor.h"
-#include "WebAssemblyCompileErrorPrototype.h"
-#include "WebAssemblyFunction.h"
-#include "WebAssemblyInstanceConstructor.h"
-#include "WebAssemblyInstancePrototype.h"
-#include "WebAssemblyLinkErrorConstructor.h"
-#include "WebAssemblyLinkErrorPrototype.h"
-#include "WebAssemblyMemoryConstructor.h"
-#include "WebAssemblyMemoryPrototype.h"
-#include "WebAssemblyModuleConstructor.h"
-#include "WebAssemblyModulePrototype.h"
-#include "WebAssemblyModuleRecord.h"
-#include "WebAssemblyPrototype.h"
-#include "WebAssemblyRuntimeErrorConstructor.h"
-#include "WebAssemblyRuntimeErrorPrototype.h"
-#include "WebAssemblyTableConstructor.h"
-#include "WebAssemblyTablePrototype.h"
-#include "WebAssemblyToJSCallee.h"
</del><ins>+#include "JSPromiseDeferred.h"
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -66,13 +42,20 @@
</span><span class="cx"> 
</span><span class="cx">     DECLARE_INFO;
</span><span class="cx"> 
</span><ins>+    JS_EXPORT_PRIVATE static void webAssemblyModuleValidateAsync(ExecState*, JSPromiseDeferred*, Vector<uint8_t>&&);
+    JS_EXPORT_PRIVATE static void webAssemblyModuleInstantinateAsync(ExecState*, JSPromiseDeferred*, Vector<uint8_t>&&, JSObject*);
+    static JSValue instantiate(ExecState*, JSPromiseDeferred*, const Identifier&, JSValue);
+
</ins><span class="cx"> protected:
</span><del>-    void finishCreation(VM&);
</del><ins>+    void finishCreation(VM&, JSGlobalObject*);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     JSWebAssembly(VM&, Structure*);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL webAssemblyCompileStreamingInternal(ExecState*);
+EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateStreamingInternal(ExecState*);
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h       2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -39,15 +39,21 @@
</span><span class="cx"> {
</span><span class="cx">     VM& vm = exec->vm();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><del>-    double doubleValue = value.toInteger(exec);
</del><ins>+
+    if (value.isUInt32())
+        return value.asUInt32();
+
+    double doubleValue = value.toNumber(exec);
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, { });
</span><del>-    if (doubleValue < 0 || doubleValue > UINT_MAX) {
-        throwException(exec, throwScope,
-            createRangeError(exec, "Expect an integer argument in the range: [0, 2^32 - 1]"_s));
-        return { };
</del><ins>+
+    if (!std::isnan(doubleValue) && !std::isinf(doubleValue)) {
+        double truncedValue = trunc(doubleValue);
+        if (truncedValue >= 0 && truncedValue <= UINT_MAX)
+            return static_cast<uint32_t>(truncedValue);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return static_cast<uint32_t>(doubleValue);
</del><ins>+    throwException(exec, throwScope, createTypeError(exec, "Expect an integer argument in the range: [0, 2^32 - 1]"_s));
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE std::pair<const uint8_t*, size_t> getWasmBufferFromValue(ExecState* exec, JSValue value)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyCompileErrorConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp       2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "CompileError"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyCompileErrorConstructor::WebAssemblyCompileErrorConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp   2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "Instance"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyInstanceConstructor::WebAssemblyInstanceConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyInstancePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstancePrototype.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstancePrototype.cpp     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstancePrototype.cpp        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> /* Source for WebAssemblyInstancePrototype.lut.h
</span><span class="cx">  @begin prototypeTableWebAssemblyInstance
</span><del>- exports webAssemblyInstanceProtoFuncExports DontEnum|Accessor 0
</del><ins>+ exports webAssemblyInstanceProtoFuncExports Accessor 0
</ins><span class="cx">  @end
</span><span class="cx">  */
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp  2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp     2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "LinkError"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyLinkErrorConstructor::WebAssemblyLinkErrorConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyMemoryConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -79,12 +79,12 @@
</span><span class="cx"> 
</span><span class="cx">     Wasm::PageCount maximumPageCount;
</span><span class="cx">     {
</span><ins>+        // In WebIDL, "present" means that [[Get]] result is undefined, not [[HasProperty]] result.
+        // https://heycam.github.io/webidl/#idl-dictionaries
</ins><span class="cx">         Identifier maximum = Identifier::fromString(&vm, "maximum");
</span><del>-        bool hasProperty = memoryDescriptor->hasProperty(exec, maximum);
</del><ins>+        JSValue maxSizeValue = memoryDescriptor->get(exec, maximum);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-        if (hasProperty) {
-            JSValue maxSizeValue = memoryDescriptor->get(exec, maximum);
-            RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</del><ins>+        if (!maxSizeValue.isUndefined()) {
</ins><span class="cx">             uint32_t size = toNonWrappingUint32(exec, maxSizeValue);
</span><span class="cx">             RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">             if (!Wasm::PageCount::isValid(size))
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "Memory"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyMemoryConstructor::WebAssemblyMemoryConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyMemoryPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.cpp       2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.cpp  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -48,8 +48,8 @@
</span><span class="cx"> 
</span><span class="cx"> /* Source for WebAssemblyMemoryPrototype.lut.h
</span><span class="cx"> @begin prototypeTableWebAssemblyMemory
</span><del>- grow   webAssemblyMemoryProtoFuncGrow   DontEnum|Function 1
- buffer webAssemblyMemoryProtoFuncBuffer DontEnum|Accessor 0
</del><ins>+ grow   webAssemblyMemoryProtoFuncGrow   Function 1
+ buffer webAssemblyMemoryProtoFuncBuffer Accessor 0
</ins><span class="cx"> @end
</span><span class="cx"> */
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModuleConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -59,9 +59,9 @@
</span><span class="cx"> 
</span><span class="cx"> /* Source for WebAssemblyModuleConstructor.lut.h
</span><span class="cx">  @begin constructorTableWebAssemblyModule
</span><del>- customSections webAssemblyModuleCustomSections DontEnum|Function 2
- imports        webAssemblyModuleImports        DontEnum|Function 1
- exports        webAssemblyModuleExports        DontEnum|Function 1
</del><ins>+ customSections webAssemblyModuleCustomSections Function 2
+ imports        webAssemblyModuleImports        Function 1
+ exports        webAssemblyModuleExports        Function 1
</ins><span class="cx">  @end
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="lines">@@ -71,11 +71,14 @@
</span><span class="cx">     auto* globalObject = exec->lexicalGlobalObject();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    JSWebAssemblyModule* module = jsDynamicCast<JSWebAssemblyModule*>(vm, exec->argument(0));
</del><ins>+    if (UNLIKELY(exec->argumentCount() < 2))
+        return JSValue::encode(throwException(exec, throwScope, createNotEnoughArgumentsError(exec)));
+
+    JSWebAssemblyModule* module = jsDynamicCast<JSWebAssemblyModule*>(vm, exec->uncheckedArgument(0));
</ins><span class="cx">     if (!module)
</span><span class="cx">         return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, "WebAssembly.Module.customSections called with non WebAssembly.Module argument"_s)));
</span><span class="cx"> 
</span><del>-    const String sectionNameString = exec->argument(1).getString(exec);
</del><ins>+    const String sectionNameString = exec->uncheckedArgument(1).getString(exec);
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx"> 
</span><span class="cx">     JSArray* result = constructEmptyArray(exec, nullptr, globalObject);
</span><span class="lines">@@ -203,7 +206,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "Module"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyModuleConstructor::WebAssemblyModuleConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyPrototypecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,391 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
- * Copyright (C) 2018 Oleksandr Skachkov <gskachkov@gmail.com>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebAssemblyPrototype.h"
-
-#if ENABLE(WEBASSEMBLY)
-
-#include "CatchScope.h"
-#include "Exception.h"
-#include "FunctionPrototype.h"
-#include "JSCBuiltins.h"
-#include "JSCInlines.h"
-#include "JSModuleNamespaceObject.h"
-#include "JSPromiseDeferred.h"
-#include "JSToWasm.h"
-#include "JSWebAssemblyHelpers.h"
-#include "JSWebAssemblyInstance.h"
-#include "JSWebAssemblyModule.h"
-#include "ObjectConstructor.h"
-#include "Options.h"
-#include "PromiseDeferredTimer.h"
-#include "StrongInlines.h"
-#include "ThrowScope.h"
-#include "WasmBBQPlan.h"
-#include "WasmToJS.h"
-#include "WasmWorklist.h"
-#include "WebAssemblyInstanceConstructor.h"
-#include "WebAssemblyModuleConstructor.h"
-
-using JSC::Wasm::Plan;
-using JSC::Wasm::BBQPlan;
-
-namespace JSC {
-static EncodedJSValue JSC_HOST_CALL webAssemblyCompileFunc(ExecState*);
-static EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateFunc(ExecState*);
-static EncodedJSValue JSC_HOST_CALL webAssemblyValidateFunc(ExecState*);
-}
-
-#include "WebAssemblyPrototype.lut.h"
-
-namespace JSC {
-
-const ClassInfo WebAssemblyPrototype::s_info = { "WebAssembly", &Base::s_info, &prototypeTableWebAssembly, nullptr, CREATE_METHOD_TABLE(WebAssemblyPrototype) };
-
-/* Source for WebAssemblyPrototype.lut.h
- @begin prototypeTableWebAssembly
- compile     webAssemblyCompileFunc     DontEnum|Function 1
- instantiate webAssemblyInstantiateFunc DontEnum|Function 1
- validate    webAssemblyValidateFunc    DontEnum|Function 1
- @end
- */
-
-static void reject(ExecState* exec, CatchScope& catchScope, JSPromiseDeferred* promise)
-{
-    Exception* exception = catchScope.exception();
-    ASSERT(exception);
-    catchScope.clearException();
-    promise->reject(exec, exception->value());
-    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void());
-}
-
-static void webAssemblyModuleValidateAsyncInternal(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source)
-{
-    VM& vm = exec->vm();
-    auto* globalObject = exec->lexicalGlobalObject();
-
-    Vector<Strong<JSCell>> dependencies;
-    dependencies.append(Strong<JSCell>(vm, globalObject));
-
-    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
-
-    Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, globalObject, &vm] (Wasm::Module::ValidationResult&& result) mutable {
-        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, globalObject, result = WTFMove(result), &vm] () mutable {
-            auto scope = DECLARE_CATCH_SCOPE(vm);
-            ExecState* exec = globalObject->globalExec();
-            JSValue module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result));
-            if (UNLIKELY(scope.exception())) {
-                reject(exec, scope, promise);
-                return;
-            }
-
-            promise->resolve(exec, module);
-            CLEAR_AND_RETURN_IF_EXCEPTION(scope, void());
-        });
-    }));
-}
-
-static EncodedJSValue JSC_HOST_CALL webAssemblyCompileFunc(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    auto* globalObject = exec->lexicalGlobalObject();
-
-    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-
-    {
-        auto catchScope = DECLARE_CATCH_SCOPE(vm);
-        Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, exec->argument(0));
-
-        if (UNLIKELY(catchScope.exception()))
-            reject(exec, catchScope, promise);
-        else
-            webAssemblyModuleValidateAsyncInternal(exec, promise, WTFMove(source));
-
-        return JSValue::encode(promise->promise());
-    }
-}
-
-enum class Resolve { WithInstance, WithModuleRecord, WithModuleAndInstance };
-static void resolve(VM& vm, ExecState* exec, JSPromiseDeferred* promise, JSWebAssemblyInstance* instance, JSWebAssemblyModule* module, JSObject* importObject, Ref<Wasm::CodeBlock>&& codeBlock, Resolve resolveKind, Wasm::CreationMode creationMode)
-{
-    auto scope = DECLARE_CATCH_SCOPE(vm);
-    instance->finalizeCreation(vm, exec, WTFMove(codeBlock), importObject, creationMode);
-    RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
-
-    if (resolveKind == Resolve::WithInstance)
-        promise->resolve(exec, instance);
-    else if (resolveKind == Resolve::WithModuleRecord) {
-        auto* moduleRecord = instance->moduleNamespaceObject()->moduleRecord();
-        if (Options::dumpModuleRecord())
-            moduleRecord->dump();
-        promise->resolve(exec, moduleRecord);
-    } else {
-        JSObject* result = constructEmptyObject(exec);
-        result->putDirect(vm, Identifier::fromString(&vm, "module"_s), module);
-        result->putDirect(vm, Identifier::fromString(&vm, "instance"_s), instance);
-        promise->resolve(exec, result);
-    }
-    CLEAR_AND_RETURN_IF_EXCEPTION(scope, void());
-}
-
-void WebAssemblyPrototype::webAssemblyModuleValidateAsync(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source)
-{
-    VM& vm = exec->vm();
-    auto catchScope = DECLARE_CATCH_SCOPE(vm);
-    webAssemblyModuleValidateAsyncInternal(exec, promise, WTFMove(source));
-    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void());
-}
-
-static void instantiate(VM& vm, ExecState* exec, JSPromiseDeferred* promise, JSWebAssemblyModule* module, JSObject* importObject, const Identifier& moduleKey, Resolve resolveKind, Wasm::CreationMode creationMode)
-{
-    auto scope = DECLARE_CATCH_SCOPE(vm);
-    // In order to avoid potentially recompiling a module. We first gather all the import/memory information prior to compiling code.
-    JSWebAssemblyInstance* instance = JSWebAssemblyInstance::create(vm, exec, moduleKey, module, importObject, exec->lexicalGlobalObject()->webAssemblyInstanceStructure(), Ref<Wasm::Module>(module->module()), creationMode);
-    RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
-
-    Vector<Strong<JSCell>> dependencies;
-    // The instance keeps the module alive.
-    dependencies.append(Strong<JSCell>(vm, instance));
-    dependencies.append(Strong<JSCell>(vm, importObject));
-    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
-    // Note: This completion task may or may not get called immediately.
-    module->module().compileAsync(&vm.wasmContext, instance->memoryMode(), createSharedTask<Wasm::CodeBlock::CallbackType>([promise, instance, module, importObject, resolveKind, creationMode, &vm] (Ref<Wasm::CodeBlock>&& refCodeBlock) mutable {
-        RefPtr<Wasm::CodeBlock> codeBlock = WTFMove(refCodeBlock);
-        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, instance, module, importObject, resolveKind, creationMode, &vm, codeBlock = WTFMove(codeBlock)] () mutable {
-            ExecState* exec = instance->globalObject(vm)->globalExec();
-            resolve(vm, exec, promise, instance, module, importObject, codeBlock.releaseNonNull(), resolveKind, creationMode);
-        });
-    }), &Wasm::createJSToWasmWrapper, &Wasm::wasmToJSException);
-}
-
-static void compileAndInstantiate(VM& vm, ExecState* exec, JSPromiseDeferred* promise, const Identifier& moduleKey, JSValue buffer, JSObject* importObject, Resolve resolveKind, Wasm::CreationMode creationMode)
-{
-    auto scope = DECLARE_CATCH_SCOPE(vm);
-
-    auto* globalObject = exec->lexicalGlobalObject();
-
-    JSCell* moduleKeyCell = identifierToJSValue(vm, moduleKey).asCell();
-    Vector<Strong<JSCell>> dependencies;
-    dependencies.append(Strong<JSCell>(vm, importObject));
-    dependencies.append(Strong<JSCell>(vm, moduleKeyCell));
-    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
-
-    Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, buffer);
-    RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
-
-    Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, importObject, moduleKeyCell, globalObject, resolveKind, creationMode, &vm] (Wasm::Module::ValidationResult&& result) mutable {
-        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, importObject, moduleKeyCell, globalObject, result = WTFMove(result), resolveKind, creationMode, &vm] () mutable {
-            auto scope = DECLARE_CATCH_SCOPE(vm);
-            ExecState* exec = globalObject->globalExec();
-            JSWebAssemblyModule* module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result));
-            if (UNLIKELY(scope.exception()))
-                return reject(exec, scope, promise);
-
-            const Identifier moduleKey = JSValue(moduleKeyCell).toPropertyKey(exec);
-            if (UNLIKELY(scope.exception()))
-                return reject(exec, scope, promise);
-
-            instantiate(vm, exec, promise, module, importObject, moduleKey, resolveKind, creationMode);
-        });
-    }));
-}
-
-JSValue WebAssemblyPrototype::instantiate(ExecState* exec, JSPromiseDeferred* promise, const Identifier& moduleKey, JSValue argument)
-{
-    VM& vm = exec->vm();
-    compileAndInstantiate(vm, exec, promise, moduleKey, argument, nullptr, Resolve::WithModuleRecord, Wasm::CreationMode::FromModuleLoader);
-    return promise->promise();
-}
-
-static void webAssemblyModuleInstantinateAsyncInternal(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source, JSObject* importObject)
-{
-    auto* globalObject = exec->lexicalGlobalObject();
-    VM& vm = exec->vm();
-
-    Vector<Strong<JSCell>> dependencies;
-    dependencies.append(Strong<JSCell>(vm, importObject));
-    dependencies.append(Strong<JSCell>(vm, globalObject));
-    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
-
-    Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, importObject, globalObject, &vm] (Wasm::Module::ValidationResult&& result) mutable {
-        vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, importObject, globalObject, result = WTFMove(result), &vm] () mutable {
-            auto scope = DECLARE_CATCH_SCOPE(vm);
-            ExecState* exec = globalObject->globalExec();
-            JSWebAssemblyModule* module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result));
-            if (UNLIKELY(scope.exception()))
-                return reject(exec, scope, promise);
-
-            instantiate(vm, exec, promise, module, importObject, JSWebAssemblyInstance::createPrivateModuleKey(),  Resolve::WithModuleAndInstance, Wasm::CreationMode::FromJS);
-            CLEAR_AND_RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise));
-        });
-    }));
-}
-
-void WebAssemblyPrototype::webAssemblyModuleInstantinateAsync(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source, JSObject* importedObject)
-{
-    VM& vm = exec->vm();
-    auto catchScope = DECLARE_CATCH_SCOPE(vm);
-    webAssemblyModuleInstantinateAsyncInternal(exec, promise, WTFMove(source), importedObject);
-    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void());
-}
-
-static EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateFunc(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    auto* globalObject = exec->lexicalGlobalObject();
-
-    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-
-    {
-        auto catchScope = DECLARE_CATCH_SCOPE(vm);
-
-        JSValue importArgument = exec->argument(1);
-        JSObject* importObject = importArgument.getObject();
-        if (UNLIKELY(!importArgument.isUndefined() && !importObject)) {
-            promise->reject(exec, createTypeError(exec,
-                "second argument to WebAssembly.instantiate must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument)));
-            CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
-        } else {
-            JSValue firstArgument = exec->argument(0);
-            if (auto* module = jsDynamicCast<JSWebAssemblyModule*>(vm, firstArgument))
-                instantiate(vm, exec, promise, module, importObject, JSWebAssemblyInstance::createPrivateModuleKey(), Resolve::WithInstance, Wasm::CreationMode::FromJS);
-            else
-                compileAndInstantiate(vm, exec, promise, JSWebAssemblyInstance::createPrivateModuleKey(), firstArgument, importObject, Resolve::WithModuleAndInstance, Wasm::CreationMode::FromJS);
-        }
-
-        return JSValue::encode(promise->promise());
-    }
-}
-
-static EncodedJSValue JSC_HOST_CALL webAssemblyValidateFunc(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    auto [base, byteSize] = getWasmBufferFromValue(exec, exec->argument(0));
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    BBQPlan plan(&vm.wasmContext, BBQPlan::Validation, Plan::dontFinalize());
-    // FIXME: We might want to throw an OOM exception here if we detect that something will OOM.
-    // https://bugs.webkit.org/show_bug.cgi?id=166015
-    return JSValue::encode(jsBoolean(plan.parseAndValidateModule(base, byteSize)));
-}
-
-EncodedJSValue JSC_HOST_CALL webAssemblyCompileStreamingInternal(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto* globalObject = exec->lexicalGlobalObject();
-    auto catchScope = DECLARE_CATCH_SCOPE(vm);
-
-    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
-
-    Vector<Strong<JSCell>> dependencies;
-    dependencies.append(Strong<JSCell>(vm, globalObject));
-    vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
-
-    if (globalObject->globalObjectMethodTable()->compileStreaming)
-        globalObject->globalObjectMethodTable()->compileStreaming(globalObject, exec, promise, exec->argument(0));
-    else {
-        // CompileStreaming is not supported in jsc, only in browser environment
-        ASSERT_NOT_REACHED();
-    }
-
-    CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
-
-    return JSValue::encode(promise->promise());
-}
-
-EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateStreamingInternal(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    auto* globalObject = exec->lexicalGlobalObject();
-
-    JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject);
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    {
-        auto catchScope = DECLARE_CATCH_SCOPE(vm);
-
-        JSValue importArgument = exec->argument(1);
-        JSObject* importObject = importArgument.getObject();
-        if (UNLIKELY(!importArgument.isUndefined() && !importObject)) {
-            promise->reject(exec, createTypeError(exec,
-                "second argument to WebAssembly.instantiateStreaming must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument)));
-            CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
-        } else {
-            if (globalObject->globalObjectMethodTable()->instantiateStreaming) {
-                Vector<Strong<JSCell>> dependencies;
-                dependencies.append(Strong<JSCell>(vm, globalObject));
-                dependencies.append(Strong<JSCell>(vm, importObject));
-                vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies));
-
-                // FIXME: <http://webkit.org/b/184888> if there's an importObject and it contains a Memory, then we can compile the module with the right memory type (fast or not) by looking at the memory's type.
-                globalObject->globalObjectMethodTable()->instantiateStreaming(globalObject, exec, promise, exec->argument(0), importObject);
-            } else {
-                // InstantiateStreaming is not supported in jsc, only in browser environment.
-                ASSERT_NOT_REACHED();
-            }
-        }
-        CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise()));
-
-        return JSValue::encode(promise->promise());
-    }
-}
-
-WebAssemblyPrototype* WebAssemblyPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-{
-    auto* object = new (NotNull, allocateCell<WebAssemblyPrototype>(vm.heap)) WebAssemblyPrototype(vm, structure);
-    object->finishCreation(vm, globalObject);
-    return object;
-}
-
-Structure* WebAssemblyPrototype::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-{
-    return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-}
-
-void WebAssemblyPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
-{
-    Base::finishCreation(vm);
-
-    if (Options::useWebAssemblyStreamingApi()) {
-        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("compileStreaming", webAssemblyPrototypeCompileStreamingCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
-        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("instantiateStreaming", webAssemblyPrototypeInstantiateStreamingCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
-    }
-}
-
-WebAssemblyPrototype::WebAssemblyPrototype(VM& vm, Structure* structure)
-    : Base(vm, structure)
-{
-}
-
-} // namespace JSC
-
-#endif // ENABLE(WEBASSEMBLY)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyPrototypeh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h       2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.h  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- * Copyright (C) 2018 Oleksandr Skachkov <gskachkov@gmail.com>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBASSEMBLY)
-
-#include "JSDestructibleObject.h"
-#include "JSObject.h"
-
-namespace JSC {
-
-class JSPromiseDeferred;
-
-class WebAssemblyPrototype final : public JSNonFinalObject {
-public:
-    typedef JSNonFinalObject Base;
-    static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
-
-    static WebAssemblyPrototype* create(VM&, JSGlobalObject*, Structure*);
-    static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
-    JS_EXPORT_PRIVATE static void webAssemblyModuleValidateAsync(ExecState*, JSPromiseDeferred*, Vector<uint8_t>&&);
-    JS_EXPORT_PRIVATE static void webAssemblyModuleInstantinateAsync(ExecState*, JSPromiseDeferred*, Vector<uint8_t>&&, JSObject*);
-
-    DECLARE_INFO;
-
-    static JSValue instantiate(ExecState*, JSPromiseDeferred*, const Identifier&, JSValue);
-
-protected:
-    void finishCreation(VM&, JSGlobalObject*);
-
-private:
-    WebAssemblyPrototype(VM&, Structure*);
-};
-
-EncodedJSValue JSC_HOST_CALL webAssemblyCompileStreamingInternal(ExecState*);
-EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateStreamingInternal(ExecState*);
-
-} // namespace JSC
-
-#endif // ENABLE(WEBASSEMBLY)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyRuntimeErrorConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp       2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp  2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "RuntimeError"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyRuntimeErrorConstructor::WebAssemblyRuntimeErrorConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyTableConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp      2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp 2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -79,13 +79,13 @@
</span><span class="cx">     uint32_t initial = toNonWrappingUint32(exec, initialSizeValue);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx"> 
</span><ins>+    // In WebIDL, "present" means that [[Get]] result is undefined, not [[HasProperty]] result.
+    // https://heycam.github.io/webidl/#idl-dictionaries
</ins><span class="cx">     Optional<uint32_t> maximum;
</span><span class="cx">     Identifier maximumIdent = Identifier::fromString(&vm, "maximum");
</span><del>-    bool hasProperty = memoryDescriptor->hasProperty(exec, maximumIdent);
</del><ins>+    JSValue maxSizeValue = memoryDescriptor->get(exec, maximumIdent);
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (hasProperty) {
-        JSValue maxSizeValue = memoryDescriptor->get(exec, maximumIdent);
-        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</del><ins>+    if (!maxSizeValue.isUndefined()) {
</ins><span class="cx">         maximum = toNonWrappingUint32(exec, maxSizeValue);
</span><span class="cx">         RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx"> 
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, "Table"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
</del><ins>+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyTableConstructor::WebAssemblyTableConstructor(VM& vm, Structure* structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyTablePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp        2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp   2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -48,10 +48,10 @@
</span><span class="cx"> 
</span><span class="cx"> /* Source for WebAssemblyTablePrototype.lut.h
</span><span class="cx">  @begin prototypeTableWebAssemblyTable
</span><del>- length webAssemblyTableProtoFuncLength DontEnum|Accessor 0
- grow   webAssemblyTableProtoFuncGrow   DontEnum|Function 1
- get    webAssemblyTableProtoFuncGet    DontEnum|Function 1
- set    webAssemblyTableProtoFuncSet    DontEnum|Function 2
</del><ins>+ length webAssemblyTableProtoFuncLength Accessor 0
+ grow   webAssemblyTableProtoFuncGrow   Function 1
+ get    webAssemblyTableProtoFuncGet    Function 1
+ set    webAssemblyTableProtoFuncSet    Function 2
</ins><span class="cx">  @end
</span><span class="cx">  */
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/WebCore/ChangeLog      2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Improve wasm wpt test results by fixing miscellaneous issues
+        https://bugs.webkit.org/show_bug.cgi?id=199783
+
+        Reviewed by Mark Lam.
+
+        Remove WebAssemblyPrototype.
+
+        Tests: imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html
+               imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::compileStreaming):
+        (WebCore::JSDOMWindowBase::instantiateStreaming):
+
</ins><span class="cx"> 2019-07-15  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Enable a debug WebRTC mode without any encryption
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (247439 => 247440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp     2019-07-15 19:09:51 UTC (rev 247439)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2019-07-15 19:26:56 UTC (rev 247440)
</span><span class="lines">@@ -50,10 +50,10 @@
</span><span class="cx"> #include <JavaScriptCore/CodeBlock.h>
</span><span class="cx"> #include <JavaScriptCore/JSInternalPromise.h>
</span><span class="cx"> #include <JavaScriptCore/JSInternalPromiseDeferred.h>
</span><ins>+#include <JavaScriptCore/JSWebAssembly.h>
</ins><span class="cx"> #include <JavaScriptCore/Microtask.h>
</span><span class="cx"> #include <JavaScriptCore/PromiseDeferredTimer.h>
</span><span class="cx"> #include <JavaScriptCore/StrongInlines.h>
</span><del>-#include <JavaScriptCore/WebAssemblyPrototype.h>
</del><span class="cx"> #include <wtf/Language.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> 
</span><span class="lines">@@ -446,7 +446,7 @@
</span><span class="cx">     if (auto inputResponse = JSFetchResponse::toWrapped(vm, source)) {
</span><span class="cx">         handleResponseOnStreamingAction(globalObject, exec, inputResponse, promise, [promise] (JSC::ExecState* exec, const char* data, size_t byteSize) mutable {
</span><span class="cx">             if (auto arrayBuffer = tryAllocate(exec, promise, data, byteSize))
</span><del>-                JSC::WebAssemblyPrototype::webAssemblyModuleValidateAsync(exec, promise, WTFMove(*arrayBuffer));
</del><ins>+                JSC::JSWebAssembly::webAssemblyModuleValidateAsync(exec, promise, WTFMove(*arrayBuffer));
</ins><span class="cx">         });
</span><span class="cx">     } else
</span><span class="cx">         promise->reject(exec, createTypeError(exec, "first argument must be an Response or Promise for Response"_s));
</span><span class="lines">@@ -465,7 +465,7 @@
</span><span class="cx">     if (auto inputResponse = JSFetchResponse::toWrapped(vm, source)) {
</span><span class="cx">         handleResponseOnStreamingAction(globalObject, exec, inputResponse, promise, [promise, importedObject] (JSC::ExecState* exec, const char* data, size_t byteSize) mutable {
</span><span class="cx">             if (auto arrayBuffer = tryAllocate(exec, promise, data, byteSize))
</span><del>-                JSC::WebAssemblyPrototype::webAssemblyModuleInstantinateAsync(exec, promise, WTFMove(*arrayBuffer), importedObject);
</del><ins>+                JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync(exec, promise, WTFMove(*arrayBuffer), importedObject);
</ins><span class="cx">         });
</span><span class="cx">     } else
</span><span class="cx">         promise->reject(exec, createTypeError(exec, "first argument must be an Response or Promise for Response"_s));
</span></span></pre>
</div>
</div>

</body>
</html>