Closed Bug 1490286 Opened 6 years ago Closed 6 years ago

In the WebAssembly.Global constructor, use the default value if the v argument is undefined

Categories

(Core :: JavaScript: WebAssembly, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: Ms2ger, Assigned: lth)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

Per spec: https://webassembly.github.io/spec/js-api/#dom-global-global step 3

Tested in:

wasm/jsapi/global/constructor.any.js

(which runs in jstests and wpt).
Note for when I update the docs to account for this — If value is not specified, use a default value as specified at https://webassembly.github.io/spec/js-api/#defaultvalue
Keywords: dev-doc-needed
WasmGlobalObject::construct() does not treat an undefined 2nd argument the way it treats a missing 2nd argument.
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Priority: -- → P3
Attachment #9009077 - Flags: review?(jseward)
Comment on attachment 9009077 [details] [diff] [review]
bug1490286-ignore-undefined-value-for-global.patch

Review of attachment 9009077 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/wasm/WasmJS.cpp
@@ +2463,2 @@
>      if (args.length() >= 2) {
>          RootedValue valueVal(cx, args.get(1));

args.get(1) will give you undefined on out-of-bounds access, so the length check is no longer necessary.
Comment on attachment 9009077 [details] [diff] [review]
bug1490286-ignore-undefined-value-for-global.patch

Review of attachment 9009077 [details] [diff] [review]:
-----------------------------------------------------------------

Looks OK to me.  If you choose to remove the bounds check per comment 4,
maybe add a 1-liner comment which is essentially the last line of comment 4.
Attachment #9009077 - Flags: review?(jseward) → review+
Changes our own test cases to conform as well.  Carrying jseward's r+.
Attachment #9009077 - Attachment is obsolete: true
Attachment #9009605 - Flags: review+
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ce36705acf73
Ignore 'undefined' value when constructing wasm global. r=jseward
https://hg.mozilla.org/mozilla-central/rev/ce36705acf73
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: