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

Implemented XMLHttpRequest.responseURL #9518

Merged
merged 1 commit into from Mar 22, 2016
Merged

Conversation

@shinglyu
Copy link
Member

shinglyu commented Feb 3, 2016

Resolves #8830

Review on Reviewable

@KiChjang
Copy link
Member

KiChjang commented Feb 3, 2016

Hi @shinglyu! Does the problem you mentioned in the issue still occur?

"url": "/XMLHttpRequest/responseurl.html"
}
],
"html/webappapis/scripting/events/event-handler-onresize.html": [

This comment has been minimized.

@jdm

jdm Feb 3, 2016

Member

The other entries here should be removed.

@jdm jdm changed the title Implemented XMLHttpRequest.requestURL Implemented XMLHttpRequest.responseURL Feb 3, 2016
@@ -3,12 +3,6 @@
[domain]
expected: FAIL

[URL]

This comment has been minimized.

@jdm

jdm Feb 3, 2016

Member

Huh, I'm confused why this test result changed. The test doesn't use responseURL at all.

assert_equals(client.responseURL, "")
client.open("GET", "foo.html", false)
client.send()
assert_equals(client.responseURL, "http://web-platform.test:8000/XMLHttpRequest/foo.html")
<body>
<div id="log"></div>
<script>
test(function() {

This comment has been minimized.

@jdm

jdm Feb 3, 2016

Member

We should also have a test that uses an HTTP redirect (resources/redirect.py) and ensures that responseURL shows the post-redirect URL.

@@ -901,6 +901,7 @@ impl XMLHttpRequest {

// Subsubsteps 5-7
self.send_flag.set(false);
*self.response_url.borrow_mut() = self.request_url.borrow().clone().unwrap().serialize_no_fragment();

This comment has been minimized.

@jdm

jdm Feb 3, 2016

Member

self.request_url.borrow().as_ref().unwrap().serialize_no_fragment() will avoid the clone.

@jdm jdm self-assigned this Feb 3, 2016
@jdm
Copy link
Member

jdm commented Feb 3, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Feb 3, 2016

Trying commit 9552064 with merge 19dded5...

bors-servo added a commit that referenced this pull request Feb 3, 2016
Implemented XMLHttpRequest.responseURL

Resolves #8830

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9518)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 3, 2016

💔 Test failed - linux-dev

@shinglyu
Copy link
Member Author

shinglyu commented Feb 4, 2016

Review status: 0 of 4 files reviewed at latest revision, 4 unresolved discussions.


tests/wpt/web-platform-tests/XMLHttpRequest/responseurl.html, line 12 [r1] (raw file):
I added the test, but it seems I didn't handle the redirection correctly in my code. Let me fix that in the following commits.


Comments from the review on Reviewable.io

@shinglyu
Copy link
Member Author

shinglyu commented Feb 4, 2016

@KiChjang : Yes I still have the issue, so I run the full XMLHttpRequest suite everytime.

@bors-servo
Copy link
Contributor

bors-servo commented Feb 5, 2016

The latest upstream changes (presumably #9521) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm
Copy link
Member

jdm commented Feb 8, 2016

Aha, I figured out why the responseXML tests started passing - we use self.ResponseURL() in the code that creates a new Document that's called from ResponseXML.
-S-awaiting-review +S-needs-code-changes


Reviewed 1 of 4 files at r1, 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Comments from the review on Reviewable.io

@shinglyu
Copy link
Member Author

shinglyu commented Feb 15, 2016

I changed the redirect test to redirect to resources/image.gif, but seem like the responseURL doesn't reflect the redirected URL. I'm still trying to figure out how redirection is handled in XHR, I must have missed something in the spec.

@jdm
Copy link
Member

jdm commented Feb 15, 2016

Redirections are handled entirely http_loader.rs, so the XHR only sees the final post-redirection Metadata value in headers_available.

@KiChjang
Copy link
Member

KiChjang commented Mar 21, 2016

@shinglyu Almost there! Do you need help with rebasing?

@shinglyu
Copy link
Member Author

shinglyu commented Mar 21, 2016

Errrrrr! I found out that this computer's servo clone is a very old one, which has the web-platform-test subfolder as a git submodule. I'll go back and use my laptop to do the rebase, it should have the correct version.

@shinglyu shinglyu force-pushed the shinglyu:responseurl branch from 27cbc47 to b513f50 Mar 21, 2016
@shinglyu
Copy link
Member Author

shinglyu commented Mar 21, 2016

I though I could use my old desktop computer as my build machine, so I can free my laptop for development, but it turns out the Servo repository in that machine is too old. :'(

client.send()

expected = location.href.replace(/[^/]*$/, "resources/" + target)
assert_not_equals(client.status, 404)

This comment has been minimized.

@jdm

jdm Mar 21, 2016

Member

I left a review comment about making this assert the actual status we're looking for; could you address that?

expected = location.href.replace(/[^/]*$/, 'foo.html')
assert_equals(client.status, 404)
assert_equals(client.responseURL, expected)
})

This comment has been minimized.

@jdm

jdm Mar 21, 2016

Member

Let's add a description for this test (, "404 response has proper responseURL")).

expected = location.href.replace(/[^/]*$/, "resources/" + target)
assert_not_equals(client.status, 404)
assert_equals(client.responseURL, expected)
})

This comment has been minimized.

@jdm

jdm Mar 21, 2016

Member

Description: , "Redirected response has proper responseURL")

@jdm
Copy link
Member

jdm commented Mar 21, 2016

Sorry, just noticed a couple final issues. Almost there!

@shinglyu shinglyu force-pushed the shinglyu:responseurl branch from b513f50 to 268dc58 Mar 21, 2016
@jdm
Copy link
Member

jdm commented Mar 22, 2016

Sorry, ambiguous wording on my part previously.
-S-awaiting-review +S-needs-code-changes


Reviewed 2 of 2 files at r9, 1 of 1 files at r10.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


tests/wpt/web-platform-tests/XMLHttpRequest/responseurl.html, line 22 [r9] (raw file):
Sorry, I meant that it should be an argument to the test() function, not assert_equals.


tests/wpt/web-platform-tests/XMLHttpRequest/responseurl.html, line 34 [r9] (raw file):
Same as above.


Comments from the review on Reviewable.io

@shinglyu shinglyu force-pushed the shinglyu:responseurl branch from 268dc58 to f55b076 Mar 22, 2016
@jdm
Copy link
Member

jdm commented Mar 22, 2016

@bors-servo: r+
Whee! Thanks for finishing this up :)


Reviewed 1 of 1 files at r11.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

@bors-servo
Copy link
Contributor

bors-servo commented Mar 22, 2016

📌 Commit f55b076 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Mar 22, 2016

Testing commit f55b076 with merge 50193e9...

bors-servo added a commit that referenced this pull request Mar 22, 2016
Implemented XMLHttpRequest.responseURL

Resolves #8830

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9518)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 22, 2016

@bors-servo bors-servo merged commit f55b076 into servo:master Mar 22, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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

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