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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/cross-origin-createImageBitmap-structured-clone.html

Issue 2178513002: Add layout test to make sure origin clean flag is preserved (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script id="myWorker" type="text/worker">
7 self.onmessage = function(e) {
8 postMessage(e.data);
9 };
10 </script>
11 <script>
12 async_test(function(t) {
13 function makeWorker(script) {
14 var blob = new Blob([script]);
15 return new Worker(URL.createObjectURL(blob));
16 }
17 var worker = makeWorker(document.getElementById('myWorker').textContent);
18 var returnedBitmap;
19
20 var image = new Image();
21 image.onload = function() {
22 shouldBeTainted(image);
23 createImageBitmap(image).then(imageBitmap => {
24 worker.postMessage({data:imageBitmap}, [imageBitmap]);
25 worker.onmessage = t.step_func(onMessage);
26 });
27 }
28 image.src = 'http://localhost:8080/security/resources/abe.png';
29
30 function onMessage(e) {
31 returnedBitmap = e.data.data;
32 shouldBeTainted(returnedBitmap);
33 t.done();
34 }
35
36 function shouldBeTainted(imageBitmap) {
37 var canvas = document.createElement("canvas");
38 canvas.width = 10;
39 canvas.height = 10;
40 var context = canvas.getContext("2d");
41 context.drawImage(imageBitmap, 0, 0, 10, 10);
42 assert_throws(null, function () { context.getImageData(0, 0, 10, 10); }, 'ImageBitmap should be tainted');
43 }
44 }, 'Transfer and structured-clone an ImageBitmap should preserve the originClean flag.');
45 </script>
46 </body>
47 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698