RegExp static members missing in Safari
On Safari 11 (not this is RegExp not RegExp.prototype):
Object.getOwnPropertyNames(RegExp).toString()
> "length,name,prototype,input,$_,lastMatch,$&,lastParen,$+,leftContext,$`,rightContext,$',$1,$2,$3,$4,$5,$6,$7,$8,$9"
But confluence shows (at least) lastMatch, lastParen, leftContext, and rightContext as missing from Safari. Why?
As far as I can see, these APIs are exposed basically the same on Chrome and Safari. I think understanding why this difference exists is urgent (to understand the extent of the problem), though fixing it may not be if it's confined to just a few properties.
Object.getOwnPropertyDescriptor(RegExp, 'rightContext')
On Safari {value: "", writable: false, enumerable: true, configurable: false}
On Chrome: {enumerable: false, configurable: true, get: ƒ, set: ƒ}
Our code that excludes primitive constants to avoid uninteresting bloat in the data does something equivalent to check whether writable is exactly false.
Boring details: object-graph-js coerces metadata to 0s and 1s (hence the === 0 in the linked code). The default value for writable is false, so we arguably should be doing a simply falsey check. That said, we would have to see what other things change when we do that before committing to update the data.
Ah, I forgot about that constant elimination heuristic - thanks. At some point we should document all these heuristics and the arguments behind them somewhere, I'm sure we'll keep wanting to revisit them.
I remember that there were a ton of properties like this including about 300 on WebGLRenderingContext like VERTEX_ATTRIB_ARRAY_ENABLED, along with the common constants like Node.ELEMENT_NODE. Continuing to exclude those from our counts certainly seems important, and if possible it would be nice to keep using a heuristic that's more principled than just looking for a naming convention.
It's unfortunate that Safari uses data descriptors for these members when Chrome and Firefox use accessor descriptors (Edge uses a data descriptor but with writable=true, which is even weirder). These RegExp properties are unfortunately non-standard so we can't really say it's a Safari bug. Regardless I've filed this bug on WebKit to see if they'd consider changing.
Thanks for tracking this down. Now that we understand the difference I no longer thinking working around this is urgent (though we should still try to come up with something depending what Apple folks say about that issue).