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

RESOLVED FIXED in Firefox 64

Status

()

defect
P3
normal
RESOLVED FIXED
8 months ago
7 months ago

People

(Reporter: Ms2ger, Assigned: lth)

Tracking

(Blocks 1 bug, {dev-doc-complete})

unspecified
mozilla64
Points:
---

Firefox Tracking Flags

(firefox64 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

8 months ago
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
(Assignee)

Comment 2

8 months ago
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
(Assignee)

Comment 3

8 months ago
Attachment #9009077 - Flags: review?(jseward)
(Reporter)

Comment 4

8 months ago
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+
(Assignee)

Comment 6

8 months ago
Changes our own test cases to conform as well.  Carrying jseward's r+.
Attachment #9009077 - Attachment is obsolete: true
Attachment #9009605 - Flags: review+

Comment 7

8 months ago
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ce36705acf73
Ignore 'undefined' value when constructing wasm global. r=jseward

Comment 8

8 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/ce36705acf73
Status: ASSIGNED → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.