ignore SecurityError exception if opener is different security context / cross-origin

This commit is contained in:
Ralf Becker 2014-01-08 15:19:04 +00:00
parent 911e7d2955
commit 0092addd08

View File

@ -86,11 +86,20 @@
// check for a framework object // check for a framework object
if (typeof window.framework == 'undefined') if (typeof window.framework == 'undefined')
{ {
// try finding it in top or opener's top try {
if (window.opener && typeof window.opener.top.framework != 'undefined') // try finding it in top or opener's top
if (window.opener && typeof window.opener.top.framework != 'undefined')
{
window.framework = window.opener.top.framework;
if (debug) console.log('found framework object in opener top');
}
}
catch(e) {
// ignore SecurityError exception if opener is different security context / cross-origin
}
if (typeof window.framework != 'undefined')
{ {
window.framework = window.opener.top.framework; // set in above try block
if (debug) console.log('found framework object in opener top');
} }
else if (window.top && typeof window.top.framework != 'undefined') else if (window.top && typeof window.top.framework != 'undefined')
{ {