window.onerror gives null as error even loading JS with crossorigin=anonymous
Reported by
cpalla...@inbenta.com,
Sep 23 2016
|
||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Steps to reproduce the problem:
1. Attach an error handler: window.onerror = function() { console.log(arguments); };
2. Load a JS from another domain (it must contain CORS headers): <script src="..." crossorigin="anonymous">. It must be prepared to throw an exception somehow.
3. Make the JS throw an error.
What is the expected behavior?
The error object should be an instance of the error thrown.
What went wrong?
The error object is null.
Did this work before? N/A
Chrome version: 53.0.2785.116 Channel: stable
OS Version: 16.04 LTS
Flash Version: Shockwave Flash 23.0 r0
It actually works as expected in Firefox 49.0
,
Sep 30 2016
,
Oct 24 2016
+mkwst, jochen - can one of you help triage this? Is it a security feature bug?
,
Oct 26 2016
step 6 of https://html.spec.whatwg.org/#runtime-script-errors says the errorValue should be null
,
Oct 26 2016
jochen, what does it mean? Never heard of that flag... In any case, why seems that it is always enabled in Chrome?
,
Oct 26 2016
it's not always enabled. if you can provide a concrete repro that works in FF, but not in Chrome, I'm happy to look into this some more
,
Feb 6 2017
I was running into a similar issue thinking that it had to do with my CORS header, but it turns out that when you throw an error inside of an eval() statement it does not get picked up by window.onerror properly (no stack trace). In my case I was using webpack to bundle my code and it used eval() to generate the source maps, which is why i was seeing this behavior.
,
Feb 7 2017
I was using webpack too, so chances are high that this is the problem. |
||||
►
Sign in to add a comment |
||||
Comment 1 by kojii@chromium.org
, Sep 26 2016Labels: -OS-Linux OS-All