unhandledrejection sometimes doesn't work
Reported by
josh...@gmail.com,
Oct 13 2016
|
||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36 Steps to reproduce the problem: 1. Load working/index.html. 2. Notice that it displays two message boxes, one of which is from the unhandledrejection event handler 3. Load notworking/index.html. 4. Notice how it only displays one message box. The unhandledrejection event handler doesn't fire, even though the code is identical. What is the expected behavior? unhandledrejection works consistently. What went wrong? I'm unable to get unhandledrejection event handlers to fire in my React application. It works in a JSFiddle. After some experimentation, I can reproduce the problem in the attached test cases. Did this work before? N/A Does this work in other browsers? Yes Chrome version: 54.0.2840.59 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 23.0 r0
,
Oct 19 2016
,
Oct 20 2016
Tested this issue on Windows-10 using chrome latest stable #54.0.2840.59 by following steps mentioned below. 1. Downloaded file unhandledrejecton.zip 2. Opened index.html file from not working folder 3. Observed a pop up saying "This page says About to fail" 4. Opened index.html file from working folder 5. Observed two pop ups saying "This page says About to fail" and "This page says oh no!" While testing the same issue on chrome previous version of chrome #35.0.1849.0 & #40.0.2172.0. Observed only one alert saying "About to fail" from both the folders working and not working. Could you please let us is this is the expected behavior of the issue?
,
Oct 20 2016
Displaying "Oh no!" is the desired behavior. ("unhandledrejection" is commonly used for error handling; the two test cases intentionally trigger a failure then see if they can correctly see it. A real application would have do something more productive than saying, "Oh no!")
According to https://www.chromestatus.com/feature/4805872211460096, unhandledrejection was added in Chrome 49, so I would not expect Chrome 35 or 40 to work.
,
Oct 21 2016
As per comment #4 I have rechecked this issue on Windows-10 using chrome M49 #49.0.2623.112 and observed the same behavior as seen on latest stable M54 #54.0.2840.59. So considering this to be a non-regression issue and marking it as untriaged.
,
Oct 21 2016
Event handling is typically not related to V8.
,
Oct 24 2016
It sounds Promise's issue. yhirano@, domenic@, I appreciate if you could triage this issue. Do you know which bug components we should use for Promise? Blink>DOM>Events is not appropriate, I think.
,
Oct 24 2016
joshkel@, I can see the message when the html and js files are served via http. I cannot see it when they're loaded as file:// resources. Do you agree with it?
window.onerror behaves similarly. Can you check with the following code?
window.onerror = function(e) {
alert(e);
}
throw 77;
cc-ing mkwst@ as he added ExecutionContext::shouldSanitizeScriptError. If this is the intended behavior, please let me know.
,
Oct 24 2016
If the script is cross-origin to the page, then the page should be getting a sanitized error (e.g. "Script error." as opposed to a detailed error message with a stack trace) via `window.onerror`. It looks like the unhandled rejection flow errors out entirely rather than firing a sanitized event (see step 2 of https://html.spec.whatwg.org/multipage/webappapis.html#the-hostpromiserejectiontracker-implementation). domenic@, jochen@, was that intentional?
,
Oct 24 2016
the script error would have zero information, so we figured it's not worthwhile to throw it
,
Oct 24 2016
https://github.com/domenic/unhandled-rejections-browser-spec/issues/20 has fragments of the discussion :-/
,
Oct 24 2016
Hrm. It seems like there would be exactly as little information in this as there is in the `window.onerror` event. If we don't consider the one worth sending, why do we send the other? Consistency seems like a reasonable goal here.
,
Oct 24 2016
in the other case it tells you that the entire script was not executed. For unhandled exceptions, you can only guess what happened
,
Oct 24 2016
> the entire script What entire script? It tells you that you had a "Script error." :) But yeah, there's some distinction in behavior between an uncaught exception and an unhandled rejection.
,
Oct 26 2016
Assigning to Domenic to decide whether or not to change the spec here
,
Oct 26 2016
I don't think we should change the spec, since as stated it's useless. But if people have some use case for getting some kind of censored version of the event (I guess with both `promise` and `reason` set to null??), please raise that on the HTML spec issue tracker.
,
Oct 28 2016
Thank you for the explanation. I didn't realize that cross-origin policy was what was causing my event handler to fail. I did some more testing with that knowledge, and I think there may still be a bug. My original scenario was that my unhandledrejection handler wasn't working in a React application, served using webpack-dev-server. I went back to that today and did some more investigation and found that the event handler fires as long as Chrome Dev Tools are closed. If Chrome Dev Tools are open, the unhandledrejection handler is ignored. I've noticed that scripts are listed in Chrome Dev Tools with webpack:// URLs. Does translating the "real" URLs (e.g., http://localhost:8000/assets/app.js) to webpack:// URLs cause them to appear as coming from a different origin, causing unhandledrejection events to appear as cross origin and be ignored? If you'd like for me to open a new issue for this or put together a full test case using webpack-dev-server, please let me know.
,
Mar 15 2017
Remove Blink>DOM>Events
,
Aug 29
Issue 876248 has been merged into this issue. |
||||||||||||
►
Sign in to add a comment |
||||||||||||
Comment 1 by josh...@gmail.com
, Oct 13 2016