mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #21533 - nupurbaghel:current_src, r=jdm
correct currentSrc function <!-- Please describe your changes on the following line: --> --- (recreating PR which got closed earlier https://github.com/servo/servo/pull/21521) <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21533) <!-- Reviewable:end -->
This commit is contained in:
commit
ad865c7156
5 changed files with 13 additions and 69 deletions
|
@ -1147,10 +1147,16 @@ impl HTMLImageElementMethods for HTMLImageElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-img-currentsrc
|
||||
fn CurrentSrc(&self) -> DOMString {
|
||||
let ref url = self.current_request.borrow().source_url;
|
||||
let ref url = self.current_request.borrow().parsed_url;
|
||||
match *url {
|
||||
Some(ref url) => url.clone(),
|
||||
None => DOMString::from(""),
|
||||
Some(ref url) => DOMString::from_string(url.clone().into_string()),
|
||||
None => {
|
||||
let ref unparsed_url = self.current_request.borrow().source_url;
|
||||
match *unparsed_url {
|
||||
Some(ref url) => url.clone(),
|
||||
None => DOMString::from("")
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -601198,7 +601198,7 @@
|
|||
"support"
|
||||
],
|
||||
"html/semantics/embedded-content/the-img-element/img.complete.html": [
|
||||
"771b8e1b80e6ad41b5cf703b5a1e99bd23b35416",
|
||||
"4be8d4db848ad259a508e1a8091feaae7733e784",
|
||||
"testharness"
|
||||
],
|
||||
"html/semantics/embedded-content/the-img-element/invalid-src.html": [
|
||||
|
|
|
@ -1,26 +1,5 @@
|
|||
[adoption.html]
|
||||
type: testharness
|
||||
[img (src only)]
|
||||
expected: FAIL
|
||||
|
||||
[img (src only), parent is picture]
|
||||
expected: FAIL
|
||||
|
||||
[img (src only), previous sibling is source]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand)]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand), parent is picture]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand), previous sibling is source]
|
||||
expected: FAIL
|
||||
|
||||
[adopt a cloned img in template]
|
||||
expected: FAIL
|
||||
|
||||
[adoption is from appendChild]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,69 +1,27 @@
|
|||
[viewport-change.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[img (src only) broken image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[img (src only) valid image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand) broken image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand) valid image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) broken image, img broken image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) broken image, img valid image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) broken image, img valid image, resize to wide]
|
||||
expected: TIMEOUT
|
||||
|
||||
[picture: source (max-width:500px) valid image, img broken image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) valid image, img valid image, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) valid image, img valid image, resize to wide]
|
||||
expected: TIMEOUT
|
||||
|
||||
[picture: same URL in source (max-width:500px) and img, onload, narrow]
|
||||
expected: FAIL
|
||||
|
||||
[img (src only) broken image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[img (src only) valid image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand) broken image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[img (srcset 1 cand) valid image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) broken image, img broken image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) broken image, img valid image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) valid image, img broken image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) valid image, img broken image, resize to narrow]
|
||||
expected: TIMEOUT
|
||||
|
||||
[picture: source (max-width:500px) valid image, img valid image, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
[picture: source (max-width:500px) valid image, img valid image, resize to narrow]
|
||||
expected: TIMEOUT
|
||||
|
||||
[picture: same URL in source (max-width:500px) and img, onload, wide]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
assert_false(loaded);
|
||||
loaded = true;
|
||||
assert_true(document.getElementById("imgTestTag3").complete);
|
||||
var currentSrc = document.getElementById("imgTestTag3").currentSrc
|
||||
assert_equals(new URL(window.location.origin + "/" + currentSrc).pathname, "/3.jpg");
|
||||
var currentSrc = document.getElementById("imgTestTag3").currentSrc;
|
||||
var expectedUrl = new URL("3.jpg", window.location);
|
||||
assert_equals(new URL(currentSrc).pathname, expectedUrl.pathname);
|
||||
}, "Only one onload, despite setting the src twice");
|
||||
|
||||
document.getElementById("imgTestTag3").src = 'test' + Math.random();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue