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.send(Document) #14648

Merged
merged 1 commit into from Jan 8, 2017

Conversation

@cynicaldevil
Copy link
Contributor

cynicaldevil commented Dec 20, 2016


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #9490 .

r? @KiChjang

XMLHttpRequest/send-entity-body-document.htm is not working atm, I get this output:

$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.

This change is Reviewable

Some(DocumentOrBodyInit::Blob(ref b)) => { Some(b.extract()) },
Some(DocumentOrBodyInit::FormData(ref formdata)) => { Some(formdata.extract()) },
Some(DocumentOrBodyInit::String(ref str)) => { Some(str.extract()) },
Some(DocumentOrBodyInit::URLSearchParams(ref urlsp)) => { Some(urlsp.extract()) },

This comment has been minimized.

Copy link
@KiChjang

KiChjang Dec 20, 2016

Member

nit: Braces are not required when you only have 1 expression inside of it.

}
}

pub fn serialize_document(doc: &Document) -> Fallible<DOMString> {

This comment has been minimized.

Copy link
@KiChjang

KiChjang Dec 20, 2016

Member

nit: Doesn't really need to be pub.

@KiChjang
Copy link
Member

KiChjang commented Dec 20, 2016

Great work! This is very easy to review for the eyes. For the ignored test case, check to make sure that the tests under that directory is enabled (look for tests/wpt/include.ini and tests/wpt/metadata/XMLHttpRequest/send-entity-body-document.htm.ini and inspect their contents to see if they've marked the test as disabled).

@KiChjang KiChjang self-assigned this Dec 20, 2016
@cynicaldevil
Copy link
Contributor Author

cynicaldevil commented Dec 20, 2016

It is. Are there any other tests related to this? Like send-entity-body-document-bogus.htm?

@KiChjang
Copy link
Member

KiChjang commented Dec 20, 2016

Ah ok, you need to remove tests/wpt/metadata/XMLHttpRequest/send-entity-body-document.htm.ini.

@cynicaldevil
Copy link
Contributor Author

cynicaldevil commented Dec 20, 2016

I tried it, I am getting something like this (image stolen from prev. PR, its identical) :
img

let extracted = data.as_ref().map(|d| d.extract());
let extracted_or_serialized = match data {
Some(DocumentOrBodyInit::Document(ref doc)) => {
let data = Vec::from(serialize_document(&doc).unwrap().as_ref());

This comment has been minimized.

Copy link
@KiChjang

KiChjang Dec 20, 2016

Member

You should really check whether serialize_document returns an Err or not instead of unwrapping. If it does, return Err(Error::InvalidState).

This comment has been minimized.

Copy link
@cynicaldevil

cynicaldevil Dec 20, 2016

Author Contributor

got it.

@KiChjang
Copy link
Member

KiChjang commented Dec 20, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 20, 2016

Trying commit f62ae44 with merge 54dd4ab...

bors-servo added a commit that referenced this pull request Dec 20, 2016
Implemented XMLHttpRequest.send(Document)

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [X] These changes fix #9490 .

<!-- Either: -->
r? @KiChjang

`XMLHttpRequest/send-entity-body-document.htm` is not working atm, I get this output:
```
$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.
```
<!-- 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/14648)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 20, 2016

💔 Test failed - mac-rel-wpt1

@KiChjang
Copy link
Member

KiChjang commented Dec 20, 2016

Not a lot of tests are passing; the implementation looks like it needs improvement.

Tests with unexpected results:
  ▶ Unexpected subtest result in /html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html:
  └ PASS [expected FAIL] iframe-noload-noallowfullscreen

  ▶ Unexpected subtest result in /html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html:
  └ PASS [expected FAIL] iframe-noload-allowfullscreen

  ▶ Unexpected subtest result in /XMLHttpRequest/setrequestheader-content-type.htm:
  └ PASS [expected FAIL] XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"

  ▶ Unexpected subtest result in /XMLHttpRequest/setrequestheader-content-type.htm:
  └ PASS [expected FAIL] HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"

  ▶ Unexpected subtest result in /XMLHttpRequest/setrequestheader-content-type.htm:
  │ FAIL [expected PASS] HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
  │   → assert_equals: expected "content-type: text/html+junk;charset=utf-8" but got "content-type: text/html+junk;charset=ascii"
  │ 
  │ request/<@http://web-platform.test:8000/XMLHttpRequest/setrequestheader-content-type.htm:26:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  │ test@http://web-platform.test:8000/resources/testharness.js:501:9
  │ request@http://web-platform.test:8000/XMLHttpRequest/setrequestheader-content-type.htm:3:9
  └ @http://web-platform.test:8000/XMLHttpRequest/setrequestheader-content-type.htm:96:7

  ▶ Unexpected subtest result in /XMLHttpRequest/setrequestheader-content-type.htm:
  │ FAIL [expected PASS] XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
  │   → assert_equals: expected "content-type: application/xhtml+xml;charset=utf-8" but got "content-type: application/xhtml+xml;charset=ascii"
  │ 
  │ request/<@http://web-platform.test:8000/XMLHttpRequest/setrequestheader-content-type.htm:26:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  │ test@http://web-platform.test:8000/resources/testharness.js:501:9
  │ request@http://web-platform.test:8000/XMLHttpRequest/setrequestheader-content-type.htm:3:9
  └ @http://web-platform.test:8000/XMLHttpRequest/setrequestheader-content-type.htm:78:7
@cynicaldevil
Copy link
Contributor Author

cynicaldevil commented Dec 20, 2016

hmm...two failing tests, plus send-entity-body-document.htm and send-entity-body-document-bogus.htm...I'll look into these tomorrow.

@Ms2ger
Copy link
Contributor

Ms2ger commented Dec 21, 2016

iframe-allowfullscreen.html is #14607; you can ignore that. As for the failure in setrequestheader-content-type.htm, you may be missing the requirement

Otherwise, if the header named Content-Type in author request headers has a value that is a valid MIME type, which has a charset parameter whose value is not a case-insensitive match for encoding, and encoding is not null, then set all the charset parameters whose value is not a case-insensitive match for encoding of that Content-Type header's value to encoding.

@cynicaldevil
Copy link
Contributor Author

cynicaldevil commented Dec 23, 2016

@Ms2ger fixed it, also updated the manifests for passing tests.

For send-entity-body-document-bogus.htm.ini the error's defintely occuring in the function call serialize in xmlhttprequest.rs (line 1394), because the test passes when I explicitly return Err(Error::InvalidState) from serialize_document.

@KiChjang
Copy link
Member

KiChjang commented Dec 23, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 23, 2016

Trying commit 4133207 with merge 7fa803b...

bors-servo added a commit that referenced this pull request Dec 23, 2016
Implemented XMLHttpRequest.send(Document)

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [X] These changes fix #9490 .

<!-- Either: -->
r? @KiChjang

`XMLHttpRequest/send-entity-body-document.htm` is not working atm, I get this output:
```
$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.
```
<!-- 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/14648)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 23, 2016

💔 Test failed - arm32

@cynicaldevil
Copy link
Contributor Author

cynicaldevil commented Dec 24, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 24, 2016

Trying commit 4133207 with merge 37177b1...

bors-servo added a commit that referenced this pull request Dec 24, 2016
Implemented XMLHttpRequest.send(Document)

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [X] These changes fix #9490 .

<!-- Either: -->
r? @KiChjang

`XMLHttpRequest/send-entity-body-document.htm` is not working atm, I get this output:
```
$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.
```
<!-- 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/14648)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 7, 2017

Testing commit 401836e with merge 063fc17...

bors-servo added a commit that referenced this pull request Jan 7, 2017
Implemented XMLHttpRequest.send(Document)

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [X] These changes fix #9490 .

<!-- Either: -->
r? @KiChjang

`XMLHttpRequest/send-entity-body-document.htm` is not working atm, I get this output:
```
$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.
```
<!-- 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/14648)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 7, 2017

💔 Test failed - linux-dev

@KiChjang
Copy link
Member

KiChjang commented Jan 8, 2017

@bors-servo r- r+ retry

@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

💡 This pull request was already approved, no need to approve it again.

  • There's another pull request that is currently being tested, blocking this pull request: #14905
@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

📌 Commit 401836e has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

Testing commit 401836e with merge 95dec99...

bors-servo added a commit that referenced this pull request Jan 8, 2017
Implemented XMLHttpRequest.send(Document)

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [X] These changes fix #9490 .

<!-- Either: -->
r? @KiChjang

`XMLHttpRequest/send-entity-body-document.htm` is not working atm, I get this output:
```
$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.
```
<!-- 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/14648)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

💔 Test failed - linux-dev

@KiChjang
Copy link
Member

KiChjang commented Jan 8, 2017

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

Testing commit 401836e with merge 87cce81...

bors-servo added a commit that referenced this pull request Jan 8, 2017
Implemented XMLHttpRequest.send(Document)

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [X] These changes fix #9490 .

<!-- Either: -->
r? @KiChjang

`XMLHttpRequest/send-entity-body-document.htm` is not working atm, I get this output:
```
$ ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
Running 1 tests in web-platform-tests

Ran 1 tests finished in 0.0 seconds.
  • 1 ran as expected. 1 tests skipped.
```
<!-- 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/14648)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

💔 Test failed - linux-dev

@KiChjang
Copy link
Member

KiChjang commented Jan 8, 2017

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

Previous build results for android, arm64, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev are reusable. Rebuilding only arm32, linux-dev...

@bors-servo
Copy link
Contributor

bors-servo commented Jan 8, 2017

@bors-servo bors-servo merged commit 401836e into servo:master Jan 8, 2017
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
@cynicaldevil cynicaldevil deleted the cynicaldevil:xmlhttpreq-send branch Jul 29, 2017
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.

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