diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 52851fdce36..6eb5bfd3489 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -76,7 +76,7 @@ impl ImageData { })?; let byte_len = array.as_slice().len() as u32; - if byte_len % 4 != 0 { + if byte_len % 4 != 0 || byte_len == 0 { return Err(Error::InvalidState); } diff --git a/tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html.ini b/tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html.ini deleted file mode 100644 index a10bfc0c856..00000000000 --- a/tests/wpt/metadata/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.imageData.object.ctor.array.bounds.html] - type: testharness - [ImageData has a usable constructor] - expected: FAIL -