Wrapping of Function.prototype.toString causes inconsistent behavior of wrapped functions
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
- go to a sentry-injected page
- run
XMLHttpRequest.prototype.open.toString()- it returnsfunction () { [native code] }even though it's wrapped by sentry - run
XMLHttpRequest.prototype.open.name- it returns"", because it's wrapped by sentry but the wrapper doesn't forward the property access like it forwards thetoStringcall
Expected Result
access to XMLHttpRequest.prototype.open.name returns "open"
Actual Result
access to XMLHttpRequest.prototype.open.name returns ""
This can cause interoperability issues with other tracking services.
Product Area
Issues - Suggested Fix
Link
No response
DSN
No response
Version
No response
Assigning to @getsentry/support for routing ⏲️
my suggestion for a fix would be to implement the access to other Function.prototype properties similar to the toString function - forward the call to the native function to behave consistent
hi @DerGernTod thanks for reaching out, are you using self-hosted Sentry? If not, would you mind checking the link you provided? It currently points to sentry.sentry.io. Thanks in advance!
i'm not using sentry on my own, i just had to deal with this issue as a third party vendor.
you can reproduce the issue on https://sentry.io/welcome/ for example. simply open the console and type XMLHttpRequest.prototype.open.name - it shouldn't return an empty string