Title: [182767] trunk/LayoutTests
Revision
182767
Author
[email protected]
Date
2015-04-13 16:51:36 -0700 (Mon, 13 Apr 2015)

Log Message

Fix LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image.html on all bots
following http://trac.webkit.org/changeset/182750.

Reviewed by Daniel Bates.

* http/tests/canvas/canvas-tainted-after-draw-image-expected.txt:
* http/tests/canvas/canvas-tainted-after-draw-image.html:
Set window.jsTestIsAsync true and call finishJSTest() to make the test 
asynchronous, so the "TEST COMPLETE" message will be output after all the
test messages. Also delete the synchronous tests for data url image and
same-domain image since they can't be reliably tested.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (182766 => 182767)


--- trunk/LayoutTests/ChangeLog	2015-04-13 23:41:17 UTC (rev 182766)
+++ trunk/LayoutTests/ChangeLog	2015-04-13 23:51:36 UTC (rev 182767)
@@ -1,3 +1,17 @@
+2015-04-13  Said Abou-Hallawa  <[email protected]>
+
+        Fix LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image.html on all bots
+        following http://trac.webkit.org/changeset/182750.
+
+        Reviewed by Daniel Bates.
+
+        * http/tests/canvas/canvas-tainted-after-draw-image-expected.txt:
+        * http/tests/canvas/canvas-tainted-after-draw-image.html:
+        Set window.jsTestIsAsync true and call finishJSTest() to make the test 
+        asynchronous, so the "TEST COMPLETE" message will be output after all the
+        test messages. Also delete the synchronous tests for data url image and
+        same-domain image since they can't be reliably tested.
+
 2015-04-13  Simon Fraser  <[email protected]>
 
         Fix compositing/geometry/fixed-transformed.html on Mavericks.

Modified: trunk/LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image-expected.txt (182766 => 182767)


--- trunk/LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image-expected.txt	2015-04-13 23:41:17 UTC (rev 182766)
+++ trunk/LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image-expected.txt	2015-04-13 23:51:36 UTC (rev 182767)
@@ -1,10 +1,8 @@
-CONSOLE MESSAGE: line 60: Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
+CONSOLE MESSAGE: line 58: Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
 Tainting works correctly.
 Tainting works correctly.
 Tainting works correctly.
 Tainting works correctly.
-Tainting works correctly.
-Tainting works correctly.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image.html (182766 => 182767)


--- trunk/LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image.html	2015-04-13 23:41:17 UTC (rev 182766)
+++ trunk/LayoutTests/http/tests/canvas/canvas-tainted-after-draw-image.html	2015-04-13 23:51:36 UTC (rev 182767)
@@ -24,14 +24,12 @@
       if (typeof incrementLoadedImagesCount.counter == 'undefined')
         incrementLoadedImagesCount.counter = 0;
         
-      if (++incrementLoadedImagesCount.counter == 6) {
-        if (window.testRunner)
-          testRunner.notifyDone();
-      }
+      if (++incrementLoadedImagesCount.counter == 4)
+          finishJSTest();
     }
 
-    function drawAndGetImageDataSynchronous(id, color, imageSrc, shouldTaint) {
-      var context = drawCanvasBackground(id, color);
+    function drawAndGetImageDataSynchronous(id, imageSrc, shouldTaint) {
+      var context = drawCanvasBackground(id, '#f00'); // red
       var image =  new Image();
       image.src = ""
       context.drawImage(image, 0, 0);
@@ -51,7 +49,7 @@
     }
     
     function drawAndGetImageDataAsynchronous(canvasId, imageSrc, shouldTaint) {
-      var context = drawCanvasBackground(canvasId, '#f00');
+      var context = drawCanvasBackground(canvasId, '#f00'); // red
       var image =  new Image();
 
       image._onload_ = function() {
@@ -69,19 +67,19 @@
       image.src = ""
     }
 
-    if (window.testRunner) {
-      testRunner.dumpAsText();
-      testRunner.waitUntilDone();
-    }
-
-    drawCanvasBackground("sourceCanvas", '#0f0');
-        
-    drawAndGetImageDataSynchronous("dataURLSynchronousCanvas", sourceCanvas.toDataURL(), false);
-    drawAndGetImageDataAsynchronous("dataURLAsynchronousCanvas", sourceCanvas.toDataURL(), false);
+    window.jsTestIsAsync = true;
     
-    drawAndGetImageDataSynchronous("sameDomainSynchronousCanvas", "http://127.0.0.1:8000/canvas/resources/100x100-lime-rect.svg", false);
+    drawCanvasBackground("sourceCanvas", '#0f0'); // green
+    
+    // The dataURL and same-domain images should not be tainted. We should always be
+    // able to get the image data regardless whether it is drawn or not. But because
+    // we ask for the image data right after we load the image, we do not know the
+    // pixels values. So the synchronous case can't be tested.
+    drawAndGetImageDataAsynchronous("dataURLAsynchronousCanvas", sourceCanvas.toDataURL(), false);
     drawAndGetImageDataAsynchronous("sameDomainAsynchronousCanvas", "http://127.0.0.1:8000/canvas/resources/100x100-lime-rect.svg", false);
     
+    // Cross domain image load should taint the canvas. The image should not be drawn
+    // so the synchronous case can be tested since we know the canvas pixel value.
     drawAndGetImageDataSynchronous("crossDomainSynchronousCanvas", "http://localhost:8000/canvas/resources/100x100-lime-rect.svg", true);
     drawAndGetImageDataAsynchronous("crossDomainAsynchronousCanvas", "http://localhost:8000/canvas/resources/100x100-lime-rect.svg", true);
   </script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to