Closed Bug 1644581 Opened 4 years ago Closed 4 years ago

Iterator.prototype[@@toStringTag] breaks web compatibility

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: avandolder, Assigned: avandolder)

References

(Regression)

Details

(Keywords: regression, site-compat)

Attachments

(1 file)

Iterator.prototype[@@toStringTag] was created as non-writable in https://bugzilla.mozilla.org/show_bug.cgi?id=1640923, behind the javascript.options.experimental.iterator_helpers pref, which breaks web compatibility.

Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4a3b83f31a88
Remove Iterator.prototype[@@toStringTag]. r=jorendorff
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Keywords: site-compat
Regressed by: 1640923
Has Regression Range: --- → yes
See Also: → 1654075

Can someone elaborate on exactly what broke? ie, what makes it not web compatible?

Defining toStringTag on Iterator.prototype (specifically, defining it as non-writable) causes regenerator to throw Uncaught TypeError: Symbol.toStringTag is read-only here: https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/runtime.js#L389

This causes sites like Slack and Discord to fail to render at all.

It could be that is an implementation issue specific to Firefox, I'm not 100% sure whether what regenerator does (polyfill Generators and set a toStringTag on their prototype) is legal under the spec or not.

That is the correct behaviour of OrdinarySetWithOwnDescriptor when a parent has a non‑writable property.

Regenerator should be using Object.defineProperty instead.

Alternatively, Regenerator should be doing if (Gp[toStringTagSymbol] !== "Generator") { Gp[toStringTagSymbol] = "Generator"; }.

Thanks, that explains the issue.

The regenerator-runtime problem discussed above should now be fixed in regenerator-runtime@0.13.6, thanks to this PR from ljharb (with tests by ExE Boss): https://github.com/facebook/regenerator/pull/400. I'm the maintainer of Regenerator, by the way.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: