Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

ES6 WeakMap Works in Webkit core but not PhantomJS #13652

Closed
binarydev opened this issue Oct 14, 2015 · 10 comments
Closed

ES6 WeakMap Works in Webkit core but not PhantomJS #13652

binarydev opened this issue Oct 14, 2015 · 10 comments

Comments

@binarydev
Copy link

I've started using WeakMap, a new feature available in ES6, which is well supported by WebKit core and is working on our local and review servers when testing manually in the browser. In the latest version of phantomjs though, my tests are failing with:

ReferenceError: Can't find variable: WeakMap
ReferenceError: Can't find variable: WeakMap
           at http://127.0.0.1:63472/assets/application.js:61222
           at http://127.0.0.1:63472/assets/application.js:61264

Minor details: Occurs in a Rails 4.2 project with Capybara and Poltergeist.

@zackw
Copy link
Collaborator

zackw commented Oct 14, 2015

Yes, unfortunately, PhantomJS is not keeping up with Webkit at the moment - I think our version is currently about a year old.

We will eventually pick up a browser core with WeakMap support, but we're not going to start cherry-picking web platform features. I regret I don't have a time frame for you.

@zackw zackw closed this as completed Oct 14, 2015
@kevohagan
Copy link

Any news on this? I'm having the same issue with PhantomJS 2.1.1 . Thanks! :)

@matejstrasek
Copy link

+1

1 similar comment
@mde17
Copy link

mde17 commented Jul 6, 2016

+1

@opub
Copy link

opub commented Aug 4, 2016

Is there a reason this was closed? Not supporting WeakMap seems to cause problems on React.js pages.

@binarydev
Copy link
Author

Ended up abandoning PhantomJS and implementing a new solution using NightmareJS and Electron in a headless environment with an optional Docker wrapper: https://github.com/binarydev/dreamcatcher

@ariya
Copy link
Owner

ariya commented Aug 25, 2016

Track ES6 support in #14506.

@proton1k
Copy link

@binarydev if the issue is related to WeakMap support for PhantomJS while running tests with Karma, then in your karma.conf.js just add a line files: ['./node_modules/babel-polyfill/dist/polyfill.js', and don't forget to replace phantom-polyfill package with babel-polyfill. Then you can still use PhantomJS for tests.

@htxiong
Copy link

htxiong commented Nov 20, 2016

@o1dnik I did what you suggested, and I am still get this error.

`
[ERROR - 2016-11-20T23:46:16.091Z] Session [80ab3180-af7b-11e6-8329-999df902fd21] - page.onError - msg: ReferenceError: Can't find variable: WeakMap

phantomjs://platform/console++.js:263 in error
[ERROR - 2016-11-20T23:46:16.092Z] Session [80ab3180-af7b-11e6-8329-999df902fd21] - page.onError - stack:
CompositeKeyWeakMap (http://localhost:19001/assets/vendor.bundle.js:56038)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:54459)
webpack_require (http://localhost:19001/assets/vendor.bundle.js:51)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:73822)
webpack_require (http://localhost:19001/assets/vendor.bundle.js:51)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:54382)
webpack_require (http://localhost:19001/assets/vendor.bundle.js:51)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:73719)
webpack_require (http://localhost:19001/assets/vendor.bundle.js:51)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:74022)
webpack_require (http://localhost:19001/assets/vendor.bundle.js:51)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:117)
webpack_require (http://localhost:19001/assets/vendor.bundle.js:51)
(anonymous function) (http://localhost:19001/assets/vendor.bundle.js:94)

`

@AlexandreBonneau
Copy link

On my end, the babel-polyfill trick fixed the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests