core: save native HTMLElement.prototype.matches function#6283
Conversation
patrickhulce
left a comment
There was a problem hiding this comment.
Nice! If you wanted to be extra secure with a test, you could throw a line that overrides matches to one of our smoke test files, probably the dbw_tester.html?
5b2a8d6 to
b878b6a
Compare
|
Done, thanks for pointing me towards the smoke tests. |
|
Paul found this err'ing sites: https://www.fitreisen.de/
Well, the second one does. Looking into why the first one is failing. |
|
OK, the first link fails due to specific elements having a custom property descriptor (overriding Switched to saving the method on |
b878b6a to
03617b3
Compare
|
patch looks great. some of the smoketests are being a problem. Perhaps there's an extra console error now? |
|
yeah, seems that the two elements I added produces an extra log statement. It also makes for two fewer render blocking requests ... I guess these smoke tests are pretty fragile? I'll update the new expected values, let me know if that is incorrect. Output before changing expectations: |
|
My assumption is that some sort of costly processing happens with each element, and it is throwing off the expected result of all those |
03617b3 to
d336580
Compare
|
@hoten yeah those smoketest errors definitely aren't expected. It looks like something is wrong with the HTML that's causing the rest of the elements to be dropped. is an error that shouldn't be there. A different test can't find Also for the smoketest I'm thinking we want to redefine matches, not just use it to make sure our workaround is working-around something :) |
|
brendankenny
left a comment
There was a problem hiding this comment.
nj getting into the smoke tests!
| <object id="5934a"></object> | ||
| <object id="5934b"></object> | ||
| <script> | ||
| document.getElementById("5934a").matches = "See #5934"; |
There was a problem hiding this comment.
can you add a comment on why these lines are here so we aren't mystified at some point in the future :)
| window.__nativeError = Error; | ||
| window.__nativeURL = URL;`); | ||
| window.__nativeURL = URL; | ||
| window.__ElementMatches = Element.prototype.matches;`); |
There was a problem hiding this comment.
👍👍 on the __ElementMatches instead of modifying the prototype
d336580 to
5319678
Compare
|
@patrickhulce I'll add a line that also redefines |
|
Oh ya for sure didn't mean to suggest removing what you've already got 👍 :) |
Summary
HTMLElement.prototype.matches was being overriden (by userland code), so we now store the native implementation at
HTMLElement.prototype.__matchesand use that instead.Not sure how to make a test for this. If you use the sample HTML provided in the associated ticket, you'll see that the error no longer occurs.
Related Issues/PRs
Fixes #5934