Bug 1578448 - Make img.complete align with spec; r=bzbarsky
If the img has srcset attribute and the current request isn't complete or broken, the img.complete should return false per spec, https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete. We should check srcset or src attribute, checking only mCurrentRequest isn't enough given that updating mCurrentRequest happens async. Differential Revision: https://phabricator.services.mozilla.com/D44678
This commit is contained in:
@@ -164,11 +164,17 @@ bool HTMLImageElement::Draggable() const {
|
||||
}
|
||||
|
||||
bool HTMLImageElement::Complete() {
|
||||
if (!mCurrentRequest) {
|
||||
// It is still not clear what value should img.complete return in various
|
||||
// cases, see https://github.com/whatwg/html/issues/4884
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::srcset)) {
|
||||
nsAutoString src;
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::src, src) || src.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mPendingRequest) {
|
||||
if (!mCurrentRequest || mPendingRequest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
[img.complete.html]
|
||||
[IDL attribute complete returns true when image resource has been fetched but not run yet & image is not in broken state]
|
||||
expected: FAIL
|
||||
|
||||
[async srcset complete test]
|
||||
expected: FAIL
|
||||
|
||||
[async srcset removal test]
|
||||
expected: FAIL
|
||||
|
||||
Reference in New Issue
Block a user