paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 388 forks source link

Worker tests fail under file:// #272

Closed ljharb closed 10 years ago

ljharb commented 10 years ago

Looks like the worker tests don't work properly on file:// - the test "can import es6-shim" seems to fail in Chrome with the error Error: Failed to construct 'Worker': Script at 'file://localhost/Users/jharband/Dropbox/git/ljharb-es6-shim.git/test/worker-runner.workerjs' cannot be accessed from origin 'null'.

ljharb commented 10 years ago

@david-risney, any ideas? Related to #248.

david-risney commented 10 years ago

Browsers handle origin for the file Uri scheme differently from one another. It may be we need to skip this test if run over file rather than http(s). I'll need to see if there's a way to run workers over file Uris consistently across browsers.

david-risney commented 10 years ago

At least in chrome this is by design and you can't use workers over file Uris: http://stackoverflow.com/questions/7505796/what-is-wrong-with-this-webworker-no-errors-but-console-log-are-not-reached/7505911#7505911 We can add a check for file: to skip the test (like already done if the Worker constructor is missing) so we don't have the false negative test failure.

ljharb commented 10 years ago

A feature check for that would definitely be ideal.