throw the appropriate exception object for each error.

Type errors on entry to webidl-specified functions are thrown as TypeError.
Range errors discovered later are throw as RangeError.

We were conflating these in a single error message, hence nothing worked
quite properly.

Two fixes here to test cases that also did not quite distinguish these
two cases.

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1488473
gecko-commit: 54e9cd8211b3ac47092cbcbf6aaca0fb0abdb53e
gecko-integration-branch: mozilla-inbound
gecko-reviewers: bbouvier, ms2ger
diff --git a/wasm/jsapi/table/assertions.js b/wasm/jsapi/table/assertions.js
index dde2fd7..c88972b 100644
--- a/wasm/jsapi/table/assertions.js
+++ b/wasm/jsapi/table/assertions.js
@@ -1,6 +1,8 @@
 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)`);
+  // The argument check in get() happens before the range check, and negative numbers
+  // are illegal, hence will throw TypeError per spec.
+  assert_throws(new TypeError(), () => 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})`);
   }
diff --git a/wasm/jsapi/table/get-set.any.js b/wasm/jsapi/table/get-set.any.js
index 2bb43a9..66c4134 100644
--- a/wasm/jsapi/table/get-set.any.js
+++ b/wasm/jsapi/table/get-set.any.js
@@ -131,7 +131,9 @@
 
   const {fn} = functions;
 
-  assert_throws(new RangeError(), () => table.set(-1, fn));
+  // -1 is the wrong type hence the type check on entry gets this
+  // before the range check does.
+  assert_throws(new TypeError(), () => 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");