Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: LayoutTests/fast/files/workers/inline-worker-via-blob-url.html

Issue 1025203002: Have postMessage()s throw TypeError on failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tidy up incorrect postMessage() usage Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script> 4 <script>
5 function log(message) 5 function log(message)
6 { 6 {
7 document.getElementById('console').appendChild(document.createTextNode(messa ge + "\n")); 7 document.getElementById('console').appendChild(document.createTextNode(messa ge + "\n"));
8 } 8 }
9 9
10 function runTest() 10 function runTest()
11 { 11 {
12 log("Test inline web worker via blob URL."); 12 log("Test inline web worker via blob URL.");
13 var string = [ 13 var string = [
14 "onmessage = function(e) {", 14 "onmessage = function(e) {",
15 " postMessage('Hello from worker');", 15 " postMessage('Hello from worker');",
16 "};" 16 "};"
17 ].join('\n'); 17 ].join('\n');
18 var blobURL = URL.createObjectURL(new Blob([string])); 18 var blobURL = URL.createObjectURL(new Blob([string]));
19 var worker = new Worker(blobURL); 19 var worker = new Worker(blobURL);
20 worker.onmessage = function(event) { 20 worker.onmessage = function(event) {
21 log(event.data); 21 log(event.data);
22 log("DONE"); 22 log("DONE");
23 if (testRunner.notifyDone) 23 if (testRunner.notifyDone)
24 testRunner.notifyDone(); 24 testRunner.notifyDone();
25 }; 25 };
26 worker.postMessage(); 26 worker.postMessage("hi");
27 } 27 }
28 28
29 if (window.testRunner) { 29 if (window.testRunner) {
30 testRunner.setAllowUniversalAccessFromFileURLs(false); 30 testRunner.setAllowUniversalAccessFromFileURLs(false);
31 testRunner.setAllowFileAccessFromFileURLs(true); 31 testRunner.setAllowFileAccessFromFileURLs(true);
32 testRunner.dumpAsText(); 32 testRunner.dumpAsText();
33 testRunner.waitUntilDone(); 33 testRunner.waitUntilDone();
34 } 34 }
35 </script> 35 </script>
36 </head> 36 </head>
37 <body onload="runTest()"> 37 <body onload="runTest()">
38 <pre id='console'></pre> 38 <pre id='console'></pre>
39 </body> 39 </body>
40 </html> 40 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/resources/message-port-multi.js ('k') | LayoutTests/fast/workers/resources/worker-multi-port.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698