Closed Bug 1615741 Opened 4 years ago Closed 4 years ago

Interaction of lack of AllowShared and unions seems to not follow the spec

Categories

(Core :: DOM: Bindings (WebIDL), defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: bzbarsky, Assigned: edgar)

References

Details

Attachments

(1 file)

Consider this testcase:

    var xhr = new XMLHttpRequest();
    xhr.open("GET", "");
    xhr.send(new Uint8Array(new SharedArrayBuffer(2)));

I was expecting this to throw, but it does not. This is because our union code treats lack of [AllowShared] as meaning "a thing backed by a shared thing is not a valid value for the type, move to the next type", and we end up at the USVString branch of the union and stringify the object. I think per spec this should throw, though it talks about [AllowShared] creating a different type, etc... but the actual specced behavior is "same type, but with an extra check".

I expect the same thing would be a problem for array buffer views that are distinguishing arguments for overloads.

If my understanding of the spec is correct, then the fix is for onFailureIsShared to just ignore failureCode and always throw.

Flags: needinfo?(annevk)
Priority: -- → P1

Yes, it should throw per current spec of converting a buffer source type.

Assignee: nobody → echen

Converting a shared buffer source to buffer souce type should
always throw if the type isn't annotated with [AllowShared].

Thanks Edgar!

Flags: needinfo?(annevk)
Attachment #9127038 - Attachment description: Bug 1615741 - Make convertion a buffer source follow the spec; → Bug 1615741 - Make convertion a buffer source follows the spec;
Attachment #9127038 - Attachment description: Bug 1615741 - Make convertion a buffer source follows the spec; → Bug 1615741 - Make converting a buffer source follow the spec when a shared buffer is passed in;
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb8677cbf5c6
Make converting a buffer source follow the spec when a shared buffer is passed in; r=bzbarsky
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21864 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Upstream PR merged by moz-wptsync-bot
Regressions: 1624944
See Also: → 1696216
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: