Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct inverted logic for available image checks. #24674

Merged
merged 1 commit into from Nov 14, 2019
Merged

Conversation

@jdm
Copy link
Member

jdm commented Nov 6, 2019

From https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data:
Step 3 says to initialize selected source to null.
Step 4 says to set the selected source to the image element's src value if it's not using responsive images and it has a non-empty src value.
Step 6 performs some steps if selected source is not null.

The existing code tried to do the step 6 check in a roundabout way which caused us to always check for an available image when using responsive images, which is incorrect. The new code is easier to read and matches the specification text.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes do not require tests because it's not worth writing a test to verify that an image cache check that would always fail does not happen.
@highfive
Copy link

highfive commented Nov 6, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/htmlimageelement.rs
  • @KiChjang: components/script/dom/htmlimageelement.rs
@highfive
Copy link

highfive commented Nov 6, 2019

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member Author

jdm commented Nov 12, 2019

Review ping @nox.

@nox
Copy link
Member

nox commented Nov 13, 2019

Sorry, missed that.

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Nov 13, 2019

📌 Commit 411890e has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Nov 13, 2019

Testing commit 411890e with merge 4f4b9e9...

bors-servo added a commit that referenced this pull request Nov 13, 2019
Correct inverted logic for available image checks.

From https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data:
Step 3 says to initialize selected source to null.
Step 4 says to set the selected source to the image element's src value if it's not using responsive images and it has a non-empty src value.
Step 6 performs some steps if selected source is not null.

The existing code tried to do the step 6 check in a roundabout way which caused us to always check for an available image when using responsive images, which is incorrect. The new code is easier to read and matches the specification text.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it's not worth writing a test to verify that an image cache check that would always fail does not happen.
@bors-servo
Copy link
Contributor

bors-servo commented Nov 13, 2019

💔 Test failed - status-taskcluster

@jdm
Copy link
Member Author

jdm commented Nov 13, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Nov 14, 2019

💣 Failed to start rebuilding: 405 Not Allowed

@bors-servo
Copy link
Contributor

bors-servo commented Nov 14, 2019

Testing commit 411890e with merge f65cb94...

bors-servo added a commit that referenced this pull request Nov 14, 2019
Correct inverted logic for available image checks.

From https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data:
Step 3 says to initialize selected source to null.
Step 4 says to set the selected source to the image element's src value if it's not using responsive images and it has a non-empty src value.
Step 6 performs some steps if selected source is not null.

The existing code tried to do the step 6 check in a roundabout way which caused us to always check for an available image when using responsive images, which is incorrect. The new code is easier to read and matches the specification text.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it's not worth writing a test to verify that an image cache check that would always fail does not happen.
@bors-servo
Copy link
Contributor

bors-servo commented Nov 14, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: nox
Pushing f65cb94 to master...

@bors-servo bors-servo merged commit 411890e into master Nov 14, 2019
3 checks passed
3 checks passed
Community-TC (pull_request) TaskGroup: success
Details
Taskcluster (pull_request) TaskGroup: success
Details
homu Test successful
Details
@bors-servo bors-servo deleted the jdm-patch-34 branch Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.