Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

makeAddListener breaks when the Event Name is a Symbol #1110

Closed
jreidgreer opened this issue Jul 10, 2018 · 8 comments · Fixed by #1113
Closed

makeAddListener breaks when the Event Name is a Symbol #1110

jreidgreer opened this issue Jul 10, 2018 · 8 comments · Fixed by #1113

Comments

@jreidgreer
Copy link

When Zone.js is running in Node, it appears to be wrapping Node's EventEmitter methods, causing issues when the eventName is a Symbol. Node's documentation states that eventName can be a string or a symbol.

However, Zone tries to coerce eventName into a string:

const falseEventName = eventName + FALSE_STR;

This causes an error:

TypeError: Cannot convert a Symbol value to a string
    at Unpack.<anonymous> (zone.js/dist/zone-node.js:1688:52)
    at new Parser (/gulp-custom-plugin/node_modules/custom-module/node_modules/tar/lib/parse.js:70:12)
    at new <anonymous> (/gulp-custom-plugin/node_modules/custom-module/node_modules/tar/lib/warn-mixin.js:2:26)
    at new Unpack (/gulp-custom-plugin/node_modules/custom-module/node_modules/tar/lib/unpack.js:52:5)
    at extract (/gulp-custom-plugin/node_modules/custom-module/node_modules/tar/lib/extract.js:111:10)
    at Object.module.exports (/gulp-custom-plugin/node_modules/custom-module/node_modules/tar/lib/extract.js:38:7)
    at extractStream (/gulp-custom-plugin/node_modules/custom-module/node_modules/pacote/lib/extract-stream.js:39:1

This is causing an issue in the node-tar library, for instance.

@JiaLiPassion
Copy link
Collaborator

@jreidgreer , thank you for posting the issue, I will fix this one.

JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Jul 17, 2018
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Jul 17, 2018
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Jul 18, 2018
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Jul 27, 2018
@Mathyn
Copy link

Mathyn commented Nov 6, 2018

Is a fix already available? I am also running into issues using node-tar with zone.js. I use zone.js version 0.8.26.

@alamothe
Copy link

alamothe commented Nov 13, 2018

Running into this issue after upgrading puppeteer to 1.10, is there a fix?

EDIT: Downgrade to puppeteer 1.8 fixes it.

@JiaLiPassion
Copy link
Collaborator

@alamothe, it is fixed, but not merged yet, please wait for the next release(not sure when...)

@jreidgreer
Copy link
Author

@Mathyn @alamothe you can prevent this issue if you place this before Zone bootstraps:

global.__Zone_disable_EventEmitter = true;

Obviously not idea, but it'll do the trick.

@alamothe
Copy link

Does it have any side-effect...?

@JiaLiPassion
Copy link
Collaborator

@alamothe, the side-effect will be the callback of addListener(eventName, callback) will not under the control of zone.js, so it will outside of zone. if you are working on something relying on it (such as Change detection in Electron), it will not work.

@alamothe
Copy link

No worries, in my case I'm fine with puppeteer 1.8 for now and will wait for the next release. Thanks!

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

Successfully merging a pull request may close this issue.

4 participants