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

Javascript strict mode enforced incorrectly #60

Closed
RuralHunter opened this issue Jul 24, 2019 · 3 comments
Closed

Javascript strict mode enforced incorrectly #60

RuralHunter opened this issue Jul 24, 2019 · 3 comments

Comments

@RuralHunter
Copy link
Contributor

The html page below fails in HtmlUnit but is fine with real browser.

<html>
    <head>
        <title>TODO supply a title</title>
        <script>
            (function() {
                "use strict"; 
                new Function("with(this){alert('OK')}")();
            })();
        </script>
    </head>
    <body>
        <div>TODO write content</div>
    </body>
</html>

The error is "com.gargoylesoftware.htmlunit.ScriptException: SyntaxError: with statements not allowed in strict mode". The problem is that the strict mode is enforced in the code snip in Function body while it should not.
This is actually a rhino bug according to this: mozilla/rhino#403
Not sure if it can be fixed in HtmlUnit.

@rbri
Copy link
Member

rbri commented Jul 27, 2019

Strict mode is one of the major pain points with Rhino - any help is welcome. If you look at the rhino commits you will notice that HtmlUnit is responsible for most of the changes during the last year. Hopefully there will be more progress in the future.

@rbri rbri mentioned this issue Jul 5, 2020
@rbri
Copy link
Member

rbri commented Jul 9, 2020

This is now fixed as part of the latest core-js snapshot. A new release is planned for this weekend.

@rbri rbri closed this as completed Jul 9, 2020
@RuralHunter
Copy link
Contributor Author

Nice!

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