-
Notifications
You must be signed in to change notification settings - Fork 333
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
Log all accesses to toStringTag #1674
Conversation
|
||
static void setAndLogToStringTag(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info){ | ||
LOG_ERROR_PERIODICALLY("toStringTag has been set"); | ||
auto isolate = info.GetIsolate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this it would be simpler just to store the given value
within a jsg::Value
member field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally tried doing that, but I couldn't get access to the ResourceTypeBuilder
instance from within this function, since I need to be able to give a pointer to it to SetAccessor. Any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think we would have to use the object itself to store the property, since we would want two objets to have separate toStringTags even if they share a single ObjectTemplate.
What's the motivation for this? (This should be included in the PR and commit descriptions.) |
My bad, I'll add it in. One of the questions brought up in #1607 is whether or not the change would be breaking, so we wanted to get some visibility into how many workers actually use the toStringTag property on built-in objects (i.e. ResouceTypes). This would allow us to find out if a worker is getting or setting the property. |
Ah, I see. My opinion: I don't think we should worry about it. This is like worrying that adding a new method to an existing API could beak someone, because they might be checking for the existence of that method. It's extremely unlikely, and if we worry about stuff like that we'll never get anything done. So I'd say it's fine to proceed without this logging change and without a compat flag. Honestly the more likely breakage is from people expecting that |
I agree, especially since Node and Chromium already set the toStringTags correctly. FYI, based on my testing, this change would actually detect what you mentioned. |
I think it will actually log any time anyone calls |
Yep, logging on the get here is not likely to tell us anything useful. Logging on the set would at least tell us if someone is trying to work around the lack of our APIs having a |
Okie dokie, lemme close this and try to merge the other change in then. :-) |
One of the questions brought up in #1607 is whether or not the change would be breaking, so we wanted to get some visibility into how many workers actually use the toStringTag property on built-in objects (i.e. ResouceTypes). This would allow us to find out if a worker is getting or setting the property.
Open questions: