Permalink
Browse files

Fake web workers locally too.

  • Loading branch information...
1 parent fb0f5f5 commit 4515893b3c88b8a5b1bbc9634842e0c5c6ed4f2a @nmrugg nmrugg committed Dec 13, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/lzma.js
View
@@ -1,7 +1,8 @@
/// This code is licensed under the MIT License. See LICENSE for more details.
/// Does the environment support web workers? If not, let's fake it.
-if (!Worker) {
+///NOTE: Since web workers don't work when a page is loaded from the local system, we have to fake it there too. (Take that security measures!)
+if (!Worker || (location && location.protocol === "file:")) {
///NOTE: IE8 and IE9 needs onmessage to be created first, IE7- do not care.
///NOTE: Because IE9 implements part of the Web Worker's spec, postMessage() must be overwritten.
/*@cc_on

0 comments on commit 4515893

Please sign in to comment.