New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 649707 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

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
 

Comment 1 by kojii@chromium.org, Sep 26 2016

Components: -Blink Blink>DOM
Labels: -OS-Linux OS-All

Comment 2 by tkent@chromium.org, Sep 30 2016

Components: -Blink>DOM Blink>SecurityFeature
Labels: Hotlist-Interop

Comment 3 by dk...@chromium.org, Oct 24 2016

Cc: jochen@chromium.org mkwst@chromium.org
+mkwst, jochen - can one of you help triage this? Is it a security feature bug?

Comment 4 by jochen@chromium.org, Oct 26 2016

Status: WontFix (was: Unconfirmed)
step 6 of https://html.spec.whatwg.org/#runtime-script-errors says the errorValue should be null
jochen, what does it mean? Never heard of that flag... In any case, why seems that it is always enabled in Chrome?

Comment 6 by jochen@chromium.org, 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

Comment 7 by jam...@gmail.com, 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.
I was using webpack too, so chances are high that this is the problem.

Sign in to add a comment