-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
es6.promise.js feature testing causes console error in Chrome Canary v49.0.2615.0? #159
Comments
Thanks for the report. In Chrome 49, |
var test = new Promise(function(){});
test.constructor = Object;
Promise.resolve(test); is buggy in Chrome 49 native promises. And it creates problems for testing subclassing. Added fallback. |
What behavior are you observing, and what do you expect? |
@littledan subclassing. By the spec: var test = new Promise(function(){});
Promise.resolve(test) === test; // should be `true`
var test = new Promise(function(){});
test.constructor = function(){};
Promise.resolve(test) === test; // should be `false` But in Chrome 49 the second example creates rejected promise - bug. Why? Looks like |
It's true that we don't yet implement @@species (sorry, working on it!), but I don't think that's the cause here. For me, both of those tests pass. Which version of Chrome are you running? I tested the version of V8 that's in 49.0.2617. |
The problem not in
It will not be caused here only with other serious bugs. I did not seek it in V8 source code - I just opened required method for confirming my guess. If var test = new Promise(function(){});
test.constructor = function(){};
test.then(function(){});
Passed, but the second with unhandled rejection.
49.0.2617.0 canary (64-bit) Early 49 worked without unhandled rejection. 48- was completely replaced because of V8 bugs like 1, 2, etc. |
Oh, I see what you mean--we currently take the constructor at face value, but really, we should only honor it if it has a @@species property (e.g., if it is a real subclass of Promise). To get that error on a spec-compliant Promises implementation, you'd have to add the line test.constructor[Symbol.species] = test.constructor; I was planning on shipping all of the @@species-related things as a package, ideally around M51, and leaving Promise subclassing in its current intermediate state for now, but it seems like this would cause issues for existing core.js users. At this point, I see three options:
Which of these do you think would be reasonable? |
The first option does not look like a good solution for me. Sure, it's not a critical problem - mainly error message, but serious. Fallback for that was added, but too many people use obsolete From the second and the third options, the third seems to me more convenient and logical. Instead of, for example, |
I'm starting with a rollback: https://codereview.chromium.org/1578893002 . This fixes the core.js console message in practice, but doesn't really leave things in an optimal state (like the third option does). I'm working on @@species in general, and we'll see if a backport ends up making sense (since we're about to branch for dev). Could you let me know if there are any issues with this revert, if it's an insufficient solution? Thanks for your help so far. |
How well would core.js do if V8 shipped Symbol.species but didn't ship it on all types at once (namely not Array yet)? |
@littledan as I wrote - perfectly, without any problem :) |
It disappeared in Google Chrome |
I and some others are seeing this error pop up in React apps running in Chrome Canary. The theory is that this error is emanating from
babel-polyfill
, which is depending oncore-js
. See discussion at https://code.google.com/p/chromium/issues/detail?id=575314. Chromium seems to have enabled more strict checks.Repro:
git clone [email protected]:Ognian/test.git
cd test && npm install && npm start
http://localhost:3002
in Chrome Canaryv49.0.2615.0
, with developer tools console openExpected: no error
Actual: Error is displayed:
The text was updated successfully, but these errors were encountered: