Skip to content

Instantly share code, notes, and snippets.

@klipstein
Last active December 12, 2015 02:19
Show Gist options
  • Save klipstein/4698185 to your computer and use it in GitHub Desktop.
Save klipstein/4698185 to your computer and use it in GitHub Desktop.
Webworker Bug in Opera with importScripts (1)
<html>
<head>
<title>Loading an empty JS-file within worker#importScripts prevents loading following requests</title>
<script>
var worker = new Worker('worker_bug1.js');
var callCount = 0;
worker.addEventListener('message', function() {
callCount++;
}, false);
setTimeout(function() {
console.assert(callCount == 2, 'Does not prevent executing following scripts in "importScripts", if a previous loaded JS-file was empty.');
}, 1000);
</script>
</head>
</html>
importScripts(
'worker_bug1_filled.js',
'worker_bug1_empty.js', // just an empty file (not even a js-comment in that file!)
// does not execute when a previous file was empty
'worker_bug1_filled.js'
);
this.postMessage('');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment