Backed out 2 changesets (bug 1684689) for causing damp failures. CLOSED TREE
authorButkovits Atila <abutkovits@mozilla.com>
Sun, 03 Jan 2021 03:45:02 +0200
changeset 561848 1098ab162ad2352f7623193c1bbb80834d0b5d3a
parent 561847 f70abb51ec6d779695a991454be7f981025d9a61
child 561849 bf23effb69da99533769ed4c9613b9b4d6b935e7
push id133435
push userabutkovits@mozilla.com
push dateSun, 03 Jan 2021 01:59:33 +0000
treeherderautoland@1098ab162ad2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1684689
milestone86.0a1
backs outf70abb51ec6d779695a991454be7f981025d9a61
636bed8f02dc5b95dd1c3572c09fa4bf9bb92aed
first release with
nightly linux32
1098ab162ad2 / 86.0a1 / 20210103092941 / files
nightly linux64
1098ab162ad2 / 86.0a1 / 20210103092941 / files
nightly mac
1098ab162ad2 / 86.0a1 / 20210103092941 / files
nightly win32
1098ab162ad2 / 86.0a1 / 20210103092941 / files
nightly win64
1098ab162ad2 / 86.0a1 / 20210103092941 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1684689) for causing damp failures. CLOSED TREE Backed out changeset f70abb51ec6d (bug 1684689) Backed out changeset 636bed8f02dc (bug 1684689)
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/test/test_canvas.html
testing/web-platform/meta/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero.html.ini
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5328,24 +5328,24 @@ static already_AddRefed<ImageData> Creat
     return nullptr;
   }
 
   return do_AddRef(new ImageData(aW, aH, *darray));
 }
 
 already_AddRefed<ImageData> CanvasRenderingContext2D::CreateImageData(
     JSContext* aCx, double aSw, double aSh, ErrorResult& aError) {
+  if (!aSw || !aSh) {
+    aError.ThrowIndexSizeError("Invalid width or height");
+    return nullptr;
+  }
+
   int32_t wi = JS::ToInt32(aSw);
   int32_t hi = JS::ToInt32(aSh);
 
-  if (wi == 0 || hi == 0) {
-    aError.ThrowIndexSizeError("Invalid width or height");
-    return nullptr;
-  }
-
   uint32_t w = Abs(wi);
   uint32_t h = Abs(hi);
   return mozilla::dom::CreateImageData(aCx, this, w, h, aError);
 }
 
 already_AddRefed<ImageData> CanvasRenderingContext2D::CreateImageData(
     JSContext* aCx, ImageData& aImagedata, ErrorResult& aError) {
   return mozilla::dom::CreateImageData(aCx, this, aImagedata.Width(),
--- a/dom/canvas/test/test_canvas.html
+++ b/dom/canvas/test/test_canvas.html
@@ -7500,21 +7500,33 @@ is(imgdata1.height, imgdata2.height, "im
 
 function test_2d_imageData_create_tiny() {
 
 var canvas = document.getElementById('c260');
 var ctx = canvas.getContext('2d');
 
 var _thrown_outer = false;
 try {
-    var imgdata = ctx.createImageData(0.0001, 0.0001);
-} catch (e) {
-    _thrown_outer = true;
-}
-ok(_thrown_outer, ctx.canvas.id + ' should throw exception');
+
+var imgdata = ctx.createImageData(0.0001, 0.0001);
+ok(imgdata.data.length == imgdata.width*imgdata.height*4, "imgdata.data.length == imgdata.width*imgdata.height*4");
+ok(imgdata.width == 1, "imgdata.width == 1");
+ok(imgdata.height == 1, "imgdata.height == 1");
+var isTransparentBlack = true;
+for (var i = 0; i < imgdata.data.length; ++i)
+    if (imgdata.data[i] !== 0)
+        isTransparentBlack = false;
+ok(isTransparentBlack, "isTransparentBlack");
+
+} catch (e) {
+    _thrown_outer = true;
+}
+ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
+
+
 }
 </script>
 
 <!-- [[[ test_2d.imageData.create.type.html ]]] -->
 
 <p>Canvas test: 2d.imageData.create.type - bug 433004</p>
 <!-- Testing: createImageData() returns an ImageData object containing a Uint8ClampedArray object -->
 <canvas id="c261" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero.html.ini
@@ -0,0 +1,4 @@
+[2d.imageData.create2.zero.html]
+  [createImageData(sw, sh) throws INDEX_SIZE_ERR if size is zero]
+    expected: FAIL
+