File: not-rendered-image-loading-lazy.html

package info (click to toggle)
thunderbird 1%3A140.3.1esr-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,608,628 kB
  • sloc: cpp: 7,671,698; javascript: 5,901,131; ansic: 3,898,955; python: 1,413,270; xml: 653,997; asm: 462,284; java: 180,948; sh: 113,489; makefile: 20,460; perl: 14,288; objc: 13,059; yacc: 4,583; pascal: 3,352; lex: 1,720; ruby: 1,222; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (49 lines) | stat: -rw-r--r-- 2,083 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<head>
  <title>In-viewport loading=lazy not-rendered images should never load</title>
  <link rel="author" title="Rob Buis" href="mailto:rbuis@igalia.com">
  <link rel="author" title="Dom Farolino" href="mailto:dom@chromium.org">
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="../resources/common.js"></script>
</head>

<body>
  <!-- These images must not attempt to load -->
  <img id="display_none" style="display:none;" src="resources/image.png?not-rendered-image-loading-lazy-2" loading="lazy"
       onload="display_none_img.resolve();" onerror="display_none_img.reject();">
  <img id="attribute_hidden" hidden src="resources/image.png?not-rendered-image-loading-lazy-3" loading="lazy"
       onload="attribute_hidden_img.resolve();" onerror="attribute_hidden_img.reject();">
  <img id="js_display_none" src="resources/image.png?not-rendered-image-loading-lazy-4" loading="lazy"
       onload="js_display_none_img.resolve();" onerror="js_display_none_img.reject();">
  <script>
    document.getElementById("js_display_none").style = 'display:none;';
  </script>
</body>

<script>
  const display_none_img = new ElementLoadPromise("display_none");
  const attribute_hidden_img = new ElementLoadPromise("attribute_hidden");
  const js_display_none_img = new ElementLoadPromise("js_display_none");

  async_test(t => {
    const unreached_not_rendered_img_func =
      t.unreached_func("The not-rendered in-viewport loading=lazy images " +
                       "should not attempt to load.");

    display_none_img.promise
      .then(unreached_not_rendered_img_func)
      .catch(unreached_not_rendered_img_func);

    attribute_hidden_img.promise
      .then(unreached_not_rendered_img_func)
      .catch(unreached_not_rendered_img_func);

    js_display_none_img.promise
      .then(unreached_not_rendered_img_func)
      .catch(unreached_not_rendered_img_func);

    t.step_timeout(t.done, 2000);
  }, "In-viewport loading=lazy not-rendered images should never load");
</script>