brianleroux/lawnchair

JSON.parse(window.top.name) can cause all JS to stop executing

Closed this issue · 8 comments

We just had a major issue on the site due to this bug.
in the 'window-name' adapter, there is a call:

data = window.top.name ? JSON.parse(window.top.name) : {}

when the window.top.name is not valid json, this will throw an exception which causes all JS loaded after this to fail.

fix is:

var data;
try {
data = window.top.name ? JSON.parse(window.top.name) : {}
} catch(e){
data = {};
}

I ran into this will links that call window.open(url) ... the window name in this case was the string '_blank'

The fix worked fine.

Experienced the same problem. Please fix.

eykd commented

👍 Just ran into this bad behavior, due to a bug in Firefox 17 where window.top.name does not get cleared between sites. Another site should not be able to crash my Javascript. :)

eykd commented

Well, here I was going to fix this and send a pull request, but I see it's already been fixed in master.

Thanks for this

So, i assume this is never going to be fixed, right?

This was fixed over 3 years ago without an update to this bug.

mark