Bug 1511892 [wpt PR 14347] - Add missing test for image reloading bug, a=testonly
authorJosh Matthews <josh@joshmatthews.net>
Thu, 13 Dec 2018 14:01:01 +0000
changeset 507850 1903598dec0711afeeda0c583b856d13a89f0cb3
parent 507849 24cdebac99e92b3368c178c83a1bc9ca4165251e
child 507851 a80e38a30bc74bc67bb7f40eca44e9abb4e02f23
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1511892, 14347
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511892 [wpt PR 14347] - Add missing test for image reloading bug, a=testonly Automatic update from web-platform-tests Add a test for dealing with multiple image loading tasks when the list of available images is usable. -- wpt-commits: 912d5081b62d6e6a2f847935c82722e31cca7a1f wpt-pr: 14347
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/available-images-onload.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/available-images-onload.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+<title>Ensure images from available images list can be drawn to a canvas</title>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-list-of-available-images">
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+  async_test(function(t) {
+    var i = new Image();
+    i.onerror = t.unreached_func();
+    i.onload = t.step_func(function() {
+      var i2 = new Image();
+      // Potentially start multiple image loading tasks by performing several
+      // relevant mutations. This could lead to an invalid state later in an
+      // erroneous implementation.
+      i2.crossOrigin = true;
+      // Start an image loading task that is expected to short-circuit since
+      // the requested image is present in the list of available images.
+      i2.src = "3.jpg";
+      i2.onerror = t.unreached_func();
+      // Ensure the loaded image is in a state that is usable by a 2d canvas.
+      i2.onload = t.step_func_done(function() {
+        var c = document.createElement('canvas');
+        var ctx = c.getContext('2d');
+        ctx.drawImage(i2, 0, 0);
+      });
+    });
+    // Request an image which should be added to the list of available images.
+    i.src = "3.jpg";
+  });
+</script>