Skip to content

Instantly share code, notes, and snippets.

@xxx
Created August 10, 2009 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxx/164985 to your computer and use it in GitHub Desktop.
Save xxx/164985 to your computer and use it in GitHub Desktop.
****** index.html
<html>
<head><title></title></head>
<body>
<script>
var dude = new Worker('my_worker.js');
dude.onmessage = function(e) {
alert(e.data);
};
dude.postMessage('fire');
</script>
</body>
</html>
****** my_worker.js
makeRequest = function() {
var req = new XMLHttpRequest();
req.open('GET', 'http://www.google.com/'); // fails here
req.onreadystatechange = function (e) {
if (req.readyState == 4) {
postMessage("received status: "+req.status);
}
};
req.send(null);
};
onmessage = function(e) {
makeRequest();
};
****** the error
uncaught exception: [Exception... "Component returned failure code: 0x805e000a [nsIXMLHttpRequest.open]" nsresult: "0x805e000a (<unknown>)" location: "JS frame :: file:///usr/home/pope/hx/my_worker.js :: anonymous :: line 4" data: no]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment