Created
August 10, 2009 02:26
-
-
Save xxx/164984 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
****** index.html | |
<html> | |
<head> | |
</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/'); | |
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