diff --git a/document/js-api/index.bs b/document/js-api/index.bs
index 0348c193eb..f5325c4a42 100644
--- a/document/js-api/index.bs
+++ b/document/js-api/index.bs
@@ -520,10 +520,12 @@ To instantiate imported strings with module |module| and |importedStr
1. Let |index| be the number of external functions in |imports|. This value |index| is known as the index of the host function |funcaddr|.
1. Let |externfunc| be the [=external value=] [=external value/func=] |funcaddr|.
1. [=list/Append=] |externfunc| to |imports|.
- 1. If |externtype| is of the form [=external-type/global=] mut |valtype|,
+ 1. If |externtype| is of the form [=external-type/global=] |mut| |valtype|,
1. If |v| [=implements=] {{Global}},
1. Let |globaladdr| be |v|.\[[Global]].
1. Otherwise,
+ 1. If |mut| is [=mut=],
+ 1. Throw a {{LinkError}} exception.
1. If |valtype| is [=i64=] and |v| [=is not a BigInt=],
1. Throw a {{LinkError}} exception.
1. If |valtype| is one of [=i32=], [=f32=] or [=f64=] and |v| [=is not a Number=],
@@ -552,8 +554,9 @@ To instantiate imported strings with module |module| and |importedStr
1. [=list/Append=] |externtag| to |imports|.
1. Return |imports|.
-Note: This algorithm only verifies the right kind of JavaScript values are passed.
-The verification of WebAssembly type requirements is deferred to the
+Note: This algorithm verifies the right kind of JavaScript values are passed.
+A value that does not [=implement=] {{Global}} can only initialize an immutable global.
+The remaining WebAssembly type requirements are deferred to the
"[=instantiate the core of a WebAssembly module=]" algorithm.
diff --git a/test/js-api/bad-imports.js b/test/js-api/bad-imports.js
index 786fc650e3..c56f21dffa 100644
--- a/test/js-api/bad-imports.js
+++ b/test/js-api/bad-imports.js
@@ -123,6 +123,18 @@ function test_bad_imports(t) {
"global": global,
},
});
+
+ const mutableGlobal = new WebAssembly.Global({ "value": type, "mutable": true }, value);
+ t(`Importing an ${type} global with a mutable Global object`,
+ WebAssembly.LinkError,
+ builder => {
+ builder.addImportedGlobal("module", "global", value_type(type));
+ },
+ {
+ "module": {
+ "global": mutableGlobal,
+ },
+ });
}
const nonMemories = [