Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$.global is inaccessible after changing domain on IE 8 #100

Closed
imsun opened this issue Aug 22, 2015 · 2 comments
Closed

$.global is inaccessible after changing domain on IE 8 #100

imsun opened this issue Aug 22, 2015 · 2 comments

Comments

@imsun
Copy link

imsun commented Aug 22, 2015

var global = typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
module.exports = global;
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef

In $.global.js, self is used as global. But on IE 8 if you changed document.domain, the elder self will be refused to access.

// i.e.
var global = require('./$.global');
document.domain = 'foo.bar'

// no log on IE 8
global.console.log('Accessible!')

What's worse is that the loader will cache $.global module, so if you changed domain after the first time you load it, it won't work any longer.

@zloirock
Copy link
Owner

You can propose more correct way global detection?

@imsun
Copy link
Author

imsun commented Aug 22, 2015

Maybe you could detect if the script is executing in a web worker, and use window if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants