Skip to content

Commit

Permalink
Bug 1730709 - Tweak some lazy-load tests to not share URLs. r=nika
Browse files Browse the repository at this point in the history
Since that can make them spuriously not be lazy, depending on cache
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D125565
  • Loading branch information
emilio committed Sep 14, 2021
1 parent 5345e64 commit 95a5477
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<body>
<div style="height:10000px;"></div>
<img id="below_viewport" src="resources/image.png?pipe=trickle(d2)"
<img id="below_viewport" src="resources/image.png?below-viewport-dynamic&pipe=trickle(d2)"
loading="lazy" onload="below_viewport_img_onload();">
<script>
assert_false(has_window_loaded,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</script>

<body>
<img id="in_viewport" src="resources/image.png?pipe=trickle(d2)"
<img id="in_viewport" src="resources/image.png?in-viewport-dynamic&pipe=trickle(d2)"
loading="lazy" onload="in_viewport_img_onload();">
<script>
document.getElementById("in_viewport").loading = 'eager';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<div style="width: 200px; height: 200px; overflow: hidden;">
<img id="negative_margin" width="5px"; style="margin-left: -10px;"
loading="lazy" src="resources/image.png"
loading="lazy" src="resources/image.png?loading-lazy-negative-margin"
onload="window.negative_margin_onload()">
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@
below_viewport_3.onerror = reject;
t.step_timeout(resolve, 1000);

below_viewport_3.src = "resources/image.png?change";
below_viewport_3.src = "resources/image.png?relevant-mutations-change";
});
}, "Image src mutation does not cause deferred loading=lazy " +
"images to be fetched");
</script>

<body>
<div style="height:1000vh;"></div>
<img id="below-viewport-1" src="resources/image.png?1" loading="lazy"
<img id="below-viewport-1" src="resources/image.png?relevant-mutations-1" loading="lazy"
onload="below_viewport_1_loaded = true"
onerror="below_viewport_1_loaded = true">

<img id="below-viewport-2" src="resources/image.png?2" loading="lazy"
<img id="below-viewport-2" src="resources/image.png?relevant-mutations-2" loading="lazy"
onload="below_viewport_2_loaded = true"
onerror="below_viewport_2_loaded = true">

<img id="below-viewport-3" src="resources/image.png?3" loading="lazy"
<img id="below-viewport-3" src="resources/image.png?relevant-mutations-3" loading="lazy"
onload="below_viewport_3_loaded = true"
onerror="below_viewport_3_loaded = true">
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
loaded = true;
target.src = "";
requestAnimationFrame(() => requestAnimationFrame(() => {
target.src = "resources/image.png?pipe=trickle(d2)";
target.src = "resources/image.png?slow-aspect-ratio&pipe=trickle(d2)";
takeScreenshot();
}));
};
target.src = "resources/image.png";
target.src = "resources/image.png?slow-aspect-ratio";
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
loaded = true;
target.src = "";
requestAnimationFrame(() => requestAnimationFrame(() => {
target.src = "resources/image.png?pipe=trickle(d2)";
target.src = "resources/image.png?loading-lazy-slow&pipe=trickle(d2)";
takeScreenshot();
}));
};
target.src = "resources/image.png";
target.src = "resources/image.png?loading-lazy-slow";
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
<body>
<div style="height:1000vh;"></div>
<img id="img_1"
src="resources/image.png?1"
src="resources/image.png?lazy-to-eager-1"
loading="lazy" onload="img_1_onload();">
<img id="img_2"
src="resources/image.png?2"
src="resources/image.png?lazy-to-eager-2"
loading="lazy" onload="img_2_onload();">
</body>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<div style="height:1000vh;"></div>

<img id="img" loading="lazy" src="image.png">
<img id="img" loading="lazy" src="image.png?lazy-below-viewport">

<script>
const img = document.querySelector('#img');
Expand Down

0 comments on commit 95a5477

Please sign in to comment.