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

Crash when a class closes over lexically-bound variables inside an eval #974

Closed
shicks opened this issue May 12, 2016 · 1 comment
Closed

Comments

@shicks
Copy link

shicks commented May 12, 2016

Steps to reproduce in Edge 13:

Point browser to a page serving the following JS file:

eval('(function(){let a; class A { x() { return a; } } })()');

This will cause the page to fail to load, immediately reloading the HTML and JS from the server a second time, and then giving up with a message of "This page is having a problem loading. We tried to load this page for you a few times ...".

The crash can be averted in any of several different ways:

  1. Remove the eval - the code itself works fine outside an eval
  2. Change let to var - no problems there [note that changing to const (and assigning something, as required) does not prevent the crash]
  3. Change the method to a function (i.e. remove the class) - ordinary functions have no problems
  4. Remove the IIFE - top-level lets seem to be fine, too
  5. After a crash, open devtools (F12), highlight the URL, and hit enter - may take a few tries before it finally succeeds, but once it does, it continues to succeed

The crash appears to be independent of strict mode - adding "use strict"; either at the beginning of the eval, or immediately inside the function - neither makes a difference.

@ianwjhalliday
Copy link
Collaborator

Thanks for reporting this bug @shicks

It has already been fixed in ChakraCore and will be included in the next release of Edge. If I am not mistaken it should also be fixed in the latest preview builds of Windows too.

joeltine added a commit to google/closure-library that referenced this issue May 17, 2016
* Fixed ES6 feature detection test to not hit edge bug chakra-core/ChakraCore#974.

Automated g4 rollback of changelist 122094563.

*** Reason for rollback ***

Roll forward, working around edge bug.

*** Original change description ***

Automated g4 rollback of changelist 122006729.

*** Reason for rollback ***

Breaks JS tests in edge-windows.

*** Original change description ***

Add transpilation in the debug loader.

RELNOTES[NEW]: Debug loader will now optionally transpile if {'lang': 'es6'} is passed to goog.addDependency and "transpile.js" is available in the same directory as "base.js".
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122286871
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