Skip to content
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

patchWindow.js might try to patch non-window objects and log errors #343

Open
Karuljonnai opened this issue Feb 21, 2024 · 5 comments
Open

Comments

@Karuljonnai
Copy link

Karuljonnai commented Feb 21, 2024

On my SO post, I enter in detail on how I got a bug because of NoScript.
But, basically, on patchWindow.js:291, it's using a deprecated interface HTMLFrameElement, which throws an TypeError: win[(("HTML" + (intermediate value)) + "Element")] is undefined

@hackademix
Copy link
Owner

On my SO post

That link seems broken.

Which browser version are you finding this in?

However probably checking if the interface is there is a good idea anyway.

@Karuljonnai
Copy link
Author

I updated the link. I'm on Kubuntu 22.04, Firefox 123.0, NoScript 11.4.29

@hackademix
Copy link
Owner

Is the i variable numeric (i.e. "0")?

@Karuljonnai
Copy link
Author

Karuljonnai commented Feb 21, 2024

Yes, .map enumerates the results with the 2nd argument i.

@hackademix
Copy link
Owner

Yes, .map enumerates the results with the 2nd argument i.

Then what is happening is quite clear: you're adding your elements as window[number], which would normally reference subframes' window objects (where HTMLFrameElement is defined - deprecation is not the issue here).

Fortunately this cannot alias the actual window objects (meant to be wrapped) if they're present, and your code won't break anyway because the exception is just logged, not rethrown, but that's annoying nonetheless, if nothing else because of the console noise.

Therefore I'm fixing this in next NoScript version, thanks.

@hackademix hackademix changed the title NoScript still using deprecated HTMLFrameElement interface patchWindow.js might try to patch non-window objects and log errors Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants