-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback to legacy set/get in old versions of FF #6930
Conversation
I'll start doing a sync now, so we can get this internally. cc @spicyj |
Wait. Should we just polyfill getOwnPropertyDescriptor better? es5-sham seems to do something with lookupGetter or lookupSetter: I don't think we should keep this fix. |
@spicyj that'd certainly avoid this from happening again. Happy to reconsider |
@andrewimm Want to submit a followup PR and then I'll proceed with the sync? |
Yeah, fine to sync this in. Looks like we don't even polyfill getOwnPropertyDescriptor in www? |
Hmm, so should we move ahead with this and consider the value of a more permanent polyfill down the road? We have only 2 instances of using it in this codebase, and this is the only one that references a native property. |
No, I don't want to ship this in a React release. |
What's happening here? I'll hold off cherry-picking to stable but want to make sure we don't forget about following up. |
We're fixing our polyfill internally (D3382014) so we should be good to revert this. |
Revert in #6976. |
#5746 introduced some issues with older (<22) versions of Firefox that prevent inputs from being properly updated, and fails to fire
componentDidMount
and any ref callbacks.In these old versions of Firefox, accessing the property descriptor of a prototype calculated the value, which caused it to throw exceptions in certain cases related to the DOM (see: https://bugzilla.mozilla.org/show_bug.cgi?id=520882). In this specific case, fetching the
value
of aninput
ortextarea
would fail withNS_ERROR_XPC_BAD_OP_ON_WN_PROTO
, which cascaded upwards, eventually getting caught by the transaction queue. This would prevent any other enqueued actions, such as runningcomponentDidMount
or establishing refs.This fix uses Firefox's deprecated
__lookupSetter__
and__lookupGetter__
methods as a fallback, which are supported in all versions where thegetOwnPropertyDescriptor
will fail. It has been spot tested on Firefox 4, 17, 21, and 46: all managed to run all lifecycle hooks and establish refs, and were able to set and update thevalue
of inputs.One remaining question is what to do when the catch block is reached and the lookup methods don't exist. In this case, descriptor will be undefined and will break below. This actually seems like reasonable behavior to me, because if we get that far we're in a bizarre, unsupported browser environment, and nothing should work.