Skip to content

Conversation

annevk
Copy link
Member

@annevk annevk commented Sep 5, 2017

Test for whatwg/fetch#1167.

Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % trouble of understanding redirect.py

return fetch("./#test").then(res => {
assert_equals(res.url, new URL("./", location).href);
return fetch("../resources/redirect.py?location=/#test").then(res2 => {
assert_equals(res2.url, new URL("/?location=%2F&count=1", location).href);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit took a while to understand, but I think it's correct. You really have to read redirect.py to make sense of it though, first I assumed redirect.py would simply redirect. Maybe comment "/redirect.py redirects to this funny URL, and the UA should not append a fragment"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@annevk
Copy link
Member Author

annevk commented Jan 31, 2018

Hmm, I should maybe also test a redirect to a URL that includes a fragment, for completeness.

@@ -0,0 +1,7 @@
<p><img src=/images/green.svg>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this isn't ready for review yet since this isn't used, will hold off until poked.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was thinking of using a reference test for this, but I first need to determine if everyone is okay with passing along fragments all the time.

assert_equals(res2.url, new URL("/?location=%2F&count=1", location).href);
// redirect.py ends up appending some stuff to the fragment, but that does not affect this
return fetch("../resources/redirect.py?location=/%23test").then(res3 => {
assert_equals(res3.url, new URL("/", location).href);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised here, but I guess the deal is that fragments on redirects are not preserved and if they're included they're thrown away, except for navigations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the current deal, yes. Perhaps we should alter the deal though.

@annevk annevk force-pushed the annevk/fetch-fragments branch from f96f44a to 62a5aad Compare February 1, 2018 13:23
});
self.addEventListener("load", t.step_func_done(() => {
ctx.drawImage(img, 0, 0);
assert_true(isColor(ctx.getImageData(0, 0, 100, 25).data, 0, 255, 0, 255));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this bit could use a comment to explain what the structure of the image is and why these asserts would fail if something were wrong with how fragments are handled on subresource redirects.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an explanation.

@annevk annevk force-pushed the annevk/fetch-fragments branch from e64ef83 to 3714176 Compare April 12, 2018 10:31
@@ -4,6 +4,17 @@
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<!--
The source image is 50h x 100w lime green. However, if the viewBox 25,25,50,50 is correctly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great documentation, thanks!

@gsnedders gsnedders closed this Jan 24, 2020
@gsnedders gsnedders deleted the annevk/fetch-fragments branch January 24, 2020 18:01
@gsnedders gsnedders restored the annevk/fetch-fragments branch January 24, 2020 18:50
@Hexcles Hexcles reopened this Jan 24, 2020
@web-platform-tests web-platform-tests deleted a comment Feb 11, 2021
img.remove();
ctx.clearRect(0, 0, 100, 50);
});
self.addEventListener("load", t.step_func_done(() => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Road

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event listener

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants