Backed out changeset 5e72eab5fab7 (bug 1003380) for intermittent mochitest failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 01 May 2014 16:28:03 -0400
changeset 181646 0ac19d49bfba0a3aa8ae85d1af9c9f33a648396b
parent 181645 caa1de36d1ad34509db8a599dd6d2449fb1e3958
child 181647 9e36450f9e746c57f872632c08221dfc8bd5d60a
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
bugs1003380
milestone32.0a1
backs out5e72eab5fab74ada669b4a43a4ddbd2ad9dd9a71
Backed out changeset 5e72eab5fab7 (bug 1003380) for intermittent mochitest failures.
content/canvas/src/CanvasRenderingContext2D.cpp
content/canvas/test/mochitest.ini
content/canvas/test/test_canvas.html
content/canvas/test/test_createPattern_broken.html
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -1485,23 +1485,17 @@ CanvasRenderingContext2D::CreatePattern(
       RefPtr<SourceSurface> srcSurf = srcCanvas->GetSurfaceSnapshot();
 
       nsRefPtr<CanvasPattern> pat =
         new CanvasPattern(this, srcSurf, repeatMode, htmlElement->NodePrincipal(), canvas->IsWriteOnly(), false);
 
       return pat.forget();
     }
   } else if (element.IsHTMLImageElement()) {
-    HTMLImageElement* img = &element.GetAsHTMLImageElement();
-    if (img->IntrinsicState().HasState(NS_EVENT_STATE_BROKEN)) {
-      error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
-      return nullptr;
-    }
-
-    htmlElement = img;
+    htmlElement = &element.GetAsHTMLImageElement();
   } else {
     htmlElement = &element.GetAsHTMLVideoElement();
   }
 
   EnsureTarget();
 
   // The canvas spec says that createPattern should use the first frame
   // of animated images
--- a/content/canvas/test/mochitest.ini
+++ b/content/canvas/test/mochitest.ini
@@ -208,9 +208,8 @@ skip-if = (buildapp == 'b2g' && toolkit 
 [test_mozGetAsFile.html]
 [test_strokeText_throw.html]
 [test_toBlob.html]
 [test_toDataURL_alpha.html]
 [test_toDataURL_lowercase_ascii.html]
 [test_toDataURL_parameters.html]
 [test_windingRuleUndefined.html]
 [test_2d.fillText.gradient.html]
-[test_createPattern_broken.html]
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -15088,16 +15088,37 @@ var _thrown = undefined; try {
   ctx.createPattern(img, 'repeat');
 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
 
 
 }
 </script>
 <img src="image_broken.png" id="broken_2.png" class="resource">
 
+<!-- [[[ test_2d.pattern.image.incomplete.html ]]] -->
+
+<p>Canvas test: 2d.pattern.image.incomplete</p>
+<canvas id="c466" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<script>
+
+function test_2d_pattern_image_incomplete() {
+
+var canvas = document.getElementById('c466');
+var ctx = canvas.getContext('2d');
+
+var img = new Image();
+todo(img.complete === false, "img.complete === false");
+var _thrown = undefined; try {
+  ctx.createPattern(img, 'repeat');
+} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
+
+
+}
+</script>
+
 <!-- [[[ test_2d.pattern.image.null.html ]]] -->
 
 <p>Canvas test: 2d.pattern.image.null</p>
 <canvas id="c467" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
 <script>
 
 function test_2d_pattern_image_null() {
 
@@ -23764,16 +23785,21 @@ function runTests() {
   ok(false, "unexpected exception thrown in: test_2d_pattern_crosscanvas");
  }
  try {
   test_2d_pattern_image_broken();
  } catch (e) {
   ok(false, "unexpected exception thrown in: test_2d_pattern_image_broken");
  }
  try {
+  test_2d_pattern_image_incomplete();
+ } catch (e) {
+  ok(false, "unexpected exception thrown in: test_2d_pattern_image_incomplete");
+ }
+ try {
   test_2d_pattern_image_null();
  } catch (e) {
   ok(false, "unexpected exception thrown in: test_2d_pattern_image_null");
  }
  try {
   test_2d_pattern_image_string();
  } catch (e) {
   ok(false, "unexpected exception thrown in: test_2d_pattern_image_string");
deleted file mode 100644
--- a/content/canvas/test/test_createPattern_broken.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test for createPattern with a broken image</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
-  <script type="application/javascript" src="file_drawWindow_common.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript">
-
-  SimpleTest.waitForExplicitFinish();
-  window.addEventListener("load", function(){
-    var _thrown = undefined;
-
-    try{
-      var img = document.getElementById('broken.png');
-      var ctx = document.getElementById('c').getContext('2d');
-      var p = ctx.createPattern(img, 'repeat');
-    } catch (e) {
-      _thrown = e
-    };
-
-    ok(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
-
-    SimpleTest.finish();
-    });
-
-  </script>
-</head>
-<body>
-<canvas id="c" class="output" width="100" height="50"></canvas>
-<img src="/images/broken.png" id="broken.png" class="resource"/>
-</body>
-</html>