11cb0ef41Sopenharmony_ci// META: global=window,dedicatedworker,jsshell
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_citest(() => {
41cb0ef41Sopenharmony_ci  const thisValues = [
51cb0ef41Sopenharmony_ci    undefined,
61cb0ef41Sopenharmony_ci    null,
71cb0ef41Sopenharmony_ci    true,
81cb0ef41Sopenharmony_ci    "",
91cb0ef41Sopenharmony_ci    Symbol(),
101cb0ef41Sopenharmony_ci    1,
111cb0ef41Sopenharmony_ci    {},
121cb0ef41Sopenharmony_ci    WebAssembly.Table,
131cb0ef41Sopenharmony_ci    WebAssembly.Table.prototype,
141cb0ef41Sopenharmony_ci  ];
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Table.prototype, "length");
171cb0ef41Sopenharmony_ci  assert_equals(typeof desc, "object");
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci  const getter = desc.get;
201cb0ef41Sopenharmony_ci  assert_equals(typeof getter, "function");
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci  assert_equals(typeof desc.set, "undefined");
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci  for (const thisValue of thisValues) {
251cb0ef41Sopenharmony_ci    assert_throws_js(TypeError, () => getter.call(thisValue), `this=${format_value(thisValue)}`);
261cb0ef41Sopenharmony_ci  }
271cb0ef41Sopenharmony_ci}, "Branding");
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_citest(() => {
301cb0ef41Sopenharmony_ci  const argument = { "element": "anyfunc", "initial": 2 };
311cb0ef41Sopenharmony_ci  const table = new WebAssembly.Table(argument);
321cb0ef41Sopenharmony_ci  assert_equals(table.length, 2, "Initial length");
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci  const desc = Object.getOwnPropertyDescriptor(WebAssembly.Table.prototype, "length");
351cb0ef41Sopenharmony_ci  assert_equals(typeof desc, "object");
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci  const getter = desc.get;
381cb0ef41Sopenharmony_ci  assert_equals(typeof getter, "function");
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci  assert_equals(getter.call(table, {}), 2);
411cb0ef41Sopenharmony_ci}, "Stray argument");
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_citest(() => {
441cb0ef41Sopenharmony_ci  const argument = { "element": "anyfunc", "initial": 2 };
451cb0ef41Sopenharmony_ci  const table = new WebAssembly.Table(argument);
461cb0ef41Sopenharmony_ci  assert_equals(table.length, 2, "Initial length");
471cb0ef41Sopenharmony_ci  table.length = 4;
481cb0ef41Sopenharmony_ci  assert_equals(table.length, 2, "Should not change the length");
491cb0ef41Sopenharmony_ci}, "Setting (sloppy mode)");
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_citest(() => {
521cb0ef41Sopenharmony_ci  const argument = { "element": "anyfunc", "initial": 2 };
531cb0ef41Sopenharmony_ci  const table = new WebAssembly.Table(argument);
541cb0ef41Sopenharmony_ci  assert_equals(table.length, 2, "Initial length");
551cb0ef41Sopenharmony_ci  assert_throws_js(TypeError, () => {
561cb0ef41Sopenharmony_ci    "use strict";
571cb0ef41Sopenharmony_ci    table.length = 4;
581cb0ef41Sopenharmony_ci  });
591cb0ef41Sopenharmony_ci  assert_equals(table.length, 2, "Should not change the length");
601cb0ef41Sopenharmony_ci}, "Setting (strict mode)");
61