Skip to content

Implement Blob response for XMLHttpRequest: #9623 - #9629

Merged
bors-servo merged 1 commit into
servo:masterfrom
dlrobertson:i9623
Feb 15, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
dlrobertson:i9623

Conversation

@dlrobertson

Copy link
Copy Markdown
Contributor

My first attempt at implementing the Blob response for XMLHttpRequest. The expected result for the response tests/wpt/web-platform-test/HMLHttpRequest/response-blob-data.htm is also changed to PASS. Please let me know if you see any areas in which I can improve this PR!

Fixes #9623

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 14, 2016
Comment thread components/script/dom/xmlhttprequest.rs Outdated
}
}
XMLHttpRequestResponseType::Blob => {
match self.response_blob.get() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should really go into a separate method down there, named blob_response, with an annotation containing the corresponding link to the WHATWG specification.

@dlrobertson

Copy link
Copy Markdown
Contributor Author

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


components/script/dom/xmlhttprequest.rs, line 126 [r1] (raw file):
From some review of other commits, I guessed that this was the correct type.


components/script/dom/xmlhttprequest.rs, line 757 [r1] (raw file):
It would be nice to implement this as a separate function, but I don't have a good grasp on codegen and how the XMLHttpRequest trait is generated yet.


Comments from the review on Reviewable.io

type: testharness
[XMLHttpRequest: The response attribute: Blob data]
expected: FAIL
expected: PASS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not how we change test expectations. If it is expected to PASS, you can just delete the line. In fact, since there's only one expected test failure in this .ini file, you can delete the entire file.

@dlrobertson

Copy link
Copy Markdown
Contributor Author

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


components/script/dom/xmlhttprequest.rs, line 733 [r1] (raw file):
Beat me to it 😄... I'll figure it out and make the update. Thanks!


Comments from the review on Reviewable.io

@KiChjang KiChjang self-assigned this Feb 14, 2016
@dlrobertson

Copy link
Copy Markdown
Contributor Author

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


tests/wpt/metadata/XMLHttpRequest/response-data-blob.htm.ini, line 4 [r1] (raw file):
Good to know! I'll add this in the update as well!


Comments from the review on Reviewable.io

encoding.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap().to_owned()
}

fn blob_response(&self) -> Root<Blob> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread components/script/dom/xmlhttprequest.rs Outdated
fn blob_response(&self) -> Root<Blob> {
// Step 1
match self.response_blob.get() {
Some(response) => response,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could simplify this step as if let Some(blob) = self.response_blob.get() { return blob; }

@dlrobertson

Copy link
Copy Markdown
Contributor Author

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


components/script/dom/xmlhttprequest.rs, line 1054 [r3] (raw file):
Awesome, i'll look it up.


components/script/dom/xmlhttprequest.rs, line 1061 [r3] (raw file):
Okay! I was just being on the safe side. I'll test and use this if possible.


Comments from the review on Reviewable.io

Comment thread components/script/dom/xmlhttprequest.rs Outdated
return response;
}
// Step 2
let mime = match self.final_mime_type() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let mime = self.fial_mime_type().unwrap_or("").to_string();

@KiChjang

Copy link
Copy Markdown
Contributor

Almost there! r=me with that final nit.

Comment thread components/script/dom/xmlhttprequest.rs Outdated
return response;
}
// Step 2
let mime = self.final_mime_type().map(|x| x.to_string()).unwrap_or("".to_owned());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use std::string::ToString

and then .as_ref().map(ToString::to_string) should work.

@KiChjang

Copy link
Copy Markdown
Contributor

Ah, brainfarted. Everything looks fine right now, thanks for working on this!

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 5dc108b has been approved by KiChjang

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 5dc108b with merge a38442d...

@highfive highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Feb 14, 2016
bors-servo pushed a commit that referenced this pull request Feb 14, 2016
Implement Blob response for XMLHttpRequest: #9623

My first attempt at implementing the Blob response for XMLHttpRequest. The expected result for the response `tests/wpt/web-platform-test/HMLHttpRequest/response-blob-data.htm` is also changed to `PASS`. Please let me know if you see any areas in which I can improve this PR!

Fixes #9623

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9629)
<!-- Reviewable:end -->
@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 14, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-dev-unit

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 14, 2016
@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 14, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0b0e147 with merge 6aa908a...

bors-servo pushed a commit that referenced this pull request Feb 14, 2016
Implement Blob response for XMLHttpRequest: #9623

My first attempt at implementing the Blob response for XMLHttpRequest. The expected result for the response `tests/wpt/web-platform-test/HMLHttpRequest/response-blob-data.htm` is also changed to `PASS`. Please let me know if you see any areas in which I can improve this PR!

Fixes #9623

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

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 15, 2016
@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0b0e147 with merge d8e1237...

bors-servo pushed a commit that referenced this pull request Feb 15, 2016
Implement Blob response for XMLHttpRequest: #9623

My first attempt at implementing the Blob response for XMLHttpRequest. The expected result for the response `tests/wpt/web-platform-test/HMLHttpRequest/response-blob-data.htm` is also changed to `PASS`. Please let me know if you see any areas in which I can improve this PR!

Fixes #9623

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9629)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Feb 15, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 15, 2016
@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0b0e147 with merge e8ae7e4...

bors-servo pushed a commit that referenced this pull request Feb 15, 2016
Implement Blob response for XMLHttpRequest: #9623

My first attempt at implementing the Blob response for XMLHttpRequest. The expected result for the response `tests/wpt/web-platform-test/HMLHttpRequest/response-blob-data.htm` is also changed to `PASS`. Please let me know if you see any areas in which I can improve this PR!

Fixes #9623

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9629)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Feb 15, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-css

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 15, 2016
@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Previous build results for android, gonk, linux-dev, mac-dev-unit are reusable. Rebuilding only linux-rel, mac-rel-css, mac-rel-wpt...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 0b0e147 into servo:master Feb 15, 2016
@dlrobertson
dlrobertson deleted the i9623 branch February 15, 2016 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-tests-failed The changes caused existing tests to fail.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants