Skip to content

Instantly share code, notes, and snippets.

@klipstein
Created February 2, 2013 17:13
Show Gist options
  • Save klipstein/4698354 to your computer and use it in GitHub Desktop.
Save klipstein/4698354 to your computer and use it in GitHub Desktop.
Webworker Bug in Opera with importScripts (2)
<html>
<head>
<title>Using importScripts in a file which was imported via importScripts prevents loading following scripts.</title>
<script>
var worker = new Worker('worker_bug2.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 previously loaded js-file used "importScripts".');
}, 1000);
</script>
</head>
</html>
importScripts(
'worker_bug2_1.js',
'worker_bug2_2.js',
// the following script is not executed, because worker_bug2_2.js used "importScripts"
'worker_bug2_1.js'
);
this.postMessage('');
importScripts('worker_bug2_3.js');
var foo = 'bar';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment