Bug 1318624 - Add wpt for img in non-active document; r=jdm
authorEdgar Chen <echen@mozilla.com>
Wed, 17 May 2017 18:15:12 +0800
changeset 359251 55ccbc9a9bfcd1327f617230031f178a7a2aa8d3
parent 359250 9c9166bc787d7b69b1d0148e8e1bf7413b7b2bd9
child 359252 70e5477cdda0d0713531e7eb9ce220d5b532c67a
push id31850
push userryanvm@gmail.com
push dateFri, 19 May 2017 15:47:16 +0000
treeherdermozilla-central@c800b6dfca67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1318624
milestone55.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 1318624 - Add wpt for img in non-active document; r=jdm MozReview-Commit-ID: F8x6H3IW08c
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/non-active-document.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -100182,16 +100182,22 @@
     ]
    ],
    "html/semantics/embedded-content/the-img-element/invalid-src.html": [
     [
      "/html/semantics/embedded-content/the-img-element/invalid-src.html",
      {}
     ]
    ],
+   "html/semantics/embedded-content/the-img-element/non-active-document.html": [
+    [
+     "/html/semantics/embedded-content/the-img-element/non-active-document.html",
+     {}
+    ]
+   ],
    "html/semantics/embedded-content/the-img-element/nonexistent-image.html": [
     [
      "/html/semantics/embedded-content/the-img-element/nonexistent-image.html",
      {}
     ]
    ],
    "html/semantics/embedded-content/the-img-element/not-rendered-dimension-getter.html": [
     [
@@ -187427,16 +187433,20 @@
   "html/semantics/embedded-content/the-img-element/img.complete.html": [
    "723ded8aca956dc1f3cbc60feb0e502c2b943d1d",
    "testharness"
   ],
   "html/semantics/embedded-content/the-img-element/invalid-src.html": [
    "fb713f6068016a6315220716a858397a241eb7c3",
    "testharness"
   ],
+  "html/semantics/embedded-content/the-img-element/non-active-document.html": [
+   "ad443ef3039e99c92de2d14bfe7d1b93cd5bdb0c",
+   "testharness"
+  ],
   "html/semantics/embedded-content/the-img-element/nonexistent-image.html": [
    "ed3a4e8ec0ffe8411176c91de37e965f252534cd",
    "testharness"
   ],
   "html/semantics/embedded-content/the-img-element/not-rendered-dimension-getter.html": [
    "3752b0f4f5b31ca0bf55b99a400dd8cd7a12b8a7",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/non-active-document.html
@@ -0,0 +1,52 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>img in non-active document should not perform loads</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+
+<!-- Per load the image so that any loads in this test would be cached. -->
+<img src=/images/green-1x1.png>
+
+<!-- tests -->
+<template>
+<img>
+</template>
+
+<script>
+
+onload = function() {
+  async_test(function(t) {
+    var p = new DOMParser();
+    var d = p.parseFromString('<img>', 'text/html');
+    var i = d.querySelector('img');
+    i.onerror = t.unreached_func('got unexpected error event');
+    i.onload = t.unreached_func('got unexpected load event');
+    i.src = '/images/green-1x1.png';
+    // delay to ensure there is no load/error event fired.
+    t.step_timeout(t.step_func_done(), 0);
+  }, "DOMParser");
+
+  async_test(function(t) {
+    var d = document.implementation.createHTMLDocument('');
+    d.body.innerHTML = '<img>';
+    var i = d.querySelector('img');
+    i.onerror = this.unreached_func('got unexpected error event');
+    i.onload = this.unreached_func('got unexpected load event');
+    i.src = '/images/green-1x1.png';
+    // delay to ensure there is no load/error event fired.
+    t.step_timeout(t.step_func_done(), 0);
+  }, "createHTMLDocument");
+
+  async_test(function(t) {
+    var template = document.querySelector('template');
+    var i = template.content.querySelector('img');
+    i.onerror = this.unreached_func('got unexpected error event');
+    i.onload = this.unreached_func('got unexpected load event');
+    i.src = '/images/green-1x1.png';
+    // delay to ensure there is no load/error event fired.
+    t.step_timeout(t.step_func_done(), 0);
+  }, "<template>");
+};
+
+</script>