Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Native image Lazyloading sometimes does not load
https://bugs.webkit.org/show_bug.cgi?id=237703 Reviewed by Darin Adler. Fix the problem that data URL placeholders are not replaced with the target image by keeping track of pending URL loads ; if the new request is done with the same URL we keep the original URL since it contains the original base URL, otherwise we use the new URL. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-crossorigin-change.sub.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-data-url-to-https-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-data-url-to-https-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-data-url-to-https.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-empty-src-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-empty-src.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::notifyFinished): * Source/WebCore/loader/ImageLoader.h: Canonical link: https://commits.webkit.org/254471@main
- Loading branch information
Showing
9 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<img src="resources/image.png"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<img src="resources/image.png"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<head> | ||
<title>Lazy loaded Images with data url placeholders can be overwritten by a src change</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#update-the-image-data"> | ||
<link rel="match" href="image-loading-lazy-data-url-to-https-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
</head> | ||
|
||
<body> | ||
<img id="image" loading="lazy" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 872 490' width='872' height='490' style='background: green' %3E%3C/svg%3E"> | ||
|
||
<script> | ||
const image = document.querySelector('#image'); | ||
|
||
window.onload = function() { | ||
// trigger intersection observer through forced layout. | ||
image.offsetWidth; | ||
image.setAttribute("src", 'resources/image.png'); | ||
setTimeout(() => { takeScreenshot(); }, 100); | ||
}; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS lazy loaded image and empty src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<title>Lazy loaded Images handle correctly when setting src to empty</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#update-the-image-data"> | ||
<div id=log></div> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<img id="image" loading="lazy" src="resources/image.png"> | ||
|
||
<script> | ||
const image = document.querySelector('#image'); | ||
|
||
async_test(function(t) { | ||
image.onerror = t.step_func(function(e) { | ||
assert_equals(e.type, "error", "null image source check failed"); | ||
image.onload = t.step_func(function() { | ||
t.done(); | ||
}); | ||
image.src = "resources/image.png"; | ||
}); | ||
image.src = ""; | ||
}, "lazy loaded image and empty src"); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters