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

Side by Side Diff: third_party/WebKit/LayoutTests/csspaint/valid-image-after-load.html

Issue 2872453002: Worklet: Specify JavaScript MIME type for Worklets created from Blob URL (Closed)
Patch Set: Created 3 years, 7 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 src="../resources/run-after-layout-and-paint.js"></script> 4 <script src="../resources/run-after-layout-and-paint.js"></script>
5 <style> 5 <style>
6 #output { 6 #output {
7 width: 100px; 7 width: 100px;
8 height: 100px; 8 height: 100px;
9 background-color: red; 9 background-color: red;
10 } 10 }
11 </style> 11 </style>
12 </head> 12 </head>
13 <body> 13 <body>
14 <div id="output"></div> 14 <div id="output"></div>
15 15
16 <script id="code" type="text/worklet"> 16 <script id="code" type="text/worklet">
17 registerPaint('green', class { 17 registerPaint('green', class {
18 paint(ctx, geom) { 18 paint(ctx, geom) {
19 ctx.fillStyle = 'green'; 19 ctx.fillStyle = 'green';
20 ctx.fillRect(0, 0, geom.width, geom.height); 20 ctx.fillRect(0, 0, geom.width, geom.height);
21 } 21 }
22 }); 22 });
23 </script> 23 </script>
24 24
25 <script> 25 <script>
26 if (window.testRunner) { 26 if (window.testRunner) {
27 testRunner.waitUntilDone(); 27 testRunner.waitUntilDone();
28 } 28 }
29 29
30 var blob = new Blob([document.getElementById('code').textContent]); 30 var blob = new Blob([document.getElementById('code').textContent],
31 {type: 'text/javascript'});
31 paintWorklet.addModule(URL.createObjectURL(blob)).then(function() { 32 paintWorklet.addModule(URL.createObjectURL(blob)).then(function() {
32 var el = document.getElementById('output'); 33 var el = document.getElementById('output');
33 el.style.backgroundImage = 'paint(green)'; 34 el.style.backgroundImage = 'paint(green)';
34 runAfterLayoutAndPaint(function() { 35 runAfterLayoutAndPaint(function() {
35 if (window.testRunner) { 36 if (window.testRunner) {
36 testRunner.notifyDone(); 37 testRunner.notifyDone();
37 } 38 }
38 }); 39 });
39 }); 40 });
40 </script> 41 </script>
41 </body> 42 </body>
42 </html> 43 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698