Restricting subclassing support in built-in methods
Yulia Startsev, Mozilla
Shu-yu Guo, Google
Primary Motivation
Implementation Complexity and Maintenance
Secondary Motivations
Performance and robustness
Security Bugs
Natalie Silvanoich presented in 2018
Chrome:
Firefox
Why isn’t this “water under the bridge”?
Regardless, why do this when the risks are so high?
Taxonomy of Subclassing
Type I: Minimal Support
Type II: subclass instance creation in builtin methods
Type III: custom subclass instance creation in BIM
Type IV: Delegation to property lookups in BIM
Proposed new “old semantics”
Impacts from Species Removal
Major change in behavior:
Minor change in behavior
<Class>[@@species] will be removed. It is currently not used.
Other Impacts
Major
Property lookups of "exec" and "flags" will be removed in favor of internal slots.
Continue to use @@match et al as an interface between RegExp and String
Minor
Symbol.species will remain as a vestigial symbol if any user code wants to use it in its own subclassing protocol.
Example Species Removal: Array
Array Prototype Methods
Impacts:
Before & After
Array Constructor Methods
Impacts:
Before & After
Removing Array[@@species]
No longer possible.
Similar impacts
RegExp
Changes
Before & After
What about WebCompat?
Current Efforts
Results so far
Results cont.
Working Hypothesis
Most of the real uses are false positives due to outdated shims, and this change is by and large web compatible.
Exit Criteria
To sum up:
This is a proposal to investigate, intervene, and if there is evidence that this is a positive direction, act.
Stage 1?