-
Notifications
You must be signed in to change notification settings - Fork 30k
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
url: improve isURLThis
detection
#46866
Conversation
Review requested:
|
@anonrig Is that faster? |
I don't think so. This was a recommendation by @TimothyGu on the original Ada migration pull request. I'm following up with the TODOs |
I wonder if we are just going to do a brand check, why can't we just make |
I didn't follow. Can you share an example? |
class URL {
#context;
get href() {
this.#context;
}
}
Object.getOwnPropertyDescriptor(URL.prototype, 'href').get.call('not a URL object'); // TypeError |
I'll follow up on a different pull request since it might be a breaking change. |
Landed in 37c736f |
PR-URL: #46866 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
PR-URL: #46866 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
PR-URL: #46866 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Oh. In the original comment from @TimothyGu there was
Can you please elaborate, why that so?
|
In nodejs 18.16.0 become impossible to do a trick `Object.create(new URL(...))`, so rewrote all mocks implementations to classes. Nodejs behaviour was changed in this PR - nodejs/node#46866
@victordidenko If you try running |
@TimothyGu Thank you! Yes, I know that already :) |
I think I see what the issue is...
|
I totally agree with that URL should behave the same in all environments. I was just using this feature in my tests, and was really surprised, that node update from 18.15 to 18.16 broke my tests. But I've already rewrote them, and for now I'm just curious, why this behaviour in the first place? |
Resolve the TODO and updates the implementation to avoid prototype look.
cc @TimothyGu