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

Remove same-origin-data-url flag from fetch implementation #13467

Merged
merged 1 commit into from Oct 1, 2016

Conversation

@JanZerebecki
Copy link
Contributor

JanZerebecki commented Sep 27, 2016

The spec removed it. Check the scheme instead, data is always same origin now,
except for workers.
Closes #13362


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #13362 .
  • There are tests for these changes OR
  • These changes do not require tests because they only remove code.

This change is Reviewable

@highfive
Copy link

highfive commented Sep 27, 2016

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @pcwalton (or someone else) soon.

@highfive
Copy link

highfive commented Sep 27, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/request.rs, components/net/fetch/methods.rs, components/script/dom/xmlhttprequest.rs, components/script/dom/htmlscriptelement.rs, components/net_traits/request.rs, components/net_traits/request.rs
@@ -673,8 +673,6 @@ fn http_redirect_fetch(request: Rc<Request>,
request.redirect_count.set(request.redirect_count.get() + 1);

// Step 9

This comment has been minimized.

Copy link
@KiChjang

KiChjang Sep 27, 2016

Member

Step annotations for this fetch function needs to be updated to match the spec, I'm afraid.

This comment has been minimized.

Copy link
@JanZerebecki

JanZerebecki Sep 27, 2016

Author Contributor

Done.

Copy link
Member

KiChjang left a comment

Almost done! If you can squash your commits after stylistic nits, I can land this :).

let same_origin = if let Origin::Origin(ref origin) = *request.origin.borrow() {
*origin == request.current_url().origin()
} else {
false
};
let has_credentials = has_credentials(&location_url);

// Step 10
// Step 7

This comment has been minimized.

Copy link
@KiChjang

KiChjang Sep 27, 2016

Member

nit: add a newline before step 7.

This comment has been minimized.

Copy link
@JanZerebecki

JanZerebecki Sep 27, 2016

Author Contributor

The newline is missing intentionally because the previous lines are preparation for Step 7 and not used in Step 6.

This comment has been minimized.

Copy link
@KiChjang

KiChjang Sep 27, 2016

Member

Then the step annotation should be above the previous line.

This comment has been minimized.

Copy link
@JanZerebecki

JanZerebecki Sep 28, 2016

Author Contributor

Done.

let location_url = match location_url {
Ok(url) => url,
_ => return Response::network_error()
};

// Step 7
// Step 4
//TODO implement return network_error if not HTTP(S)

This comment has been minimized.

Copy link
@KiChjang

KiChjang Sep 27, 2016

Member

nit: space after //.

This comment has been minimized.

Copy link
@JanZerebecki

JanZerebecki Sep 27, 2016

Author Contributor

Done.

request.url_list.borrow_mut().push(location_url);

// Step 15
// Step 12
//TODO implement referrer policy

This comment has been minimized.

Copy link
@KiChjang

KiChjang Sep 27, 2016

Member

nit: space after //.

This comment has been minimized.

Copy link
@JanZerebecki

JanZerebecki Sep 27, 2016

Author Contributor

Done.

@KiChjang KiChjang assigned KiChjang and unassigned pcwalton Sep 27, 2016
@JanZerebecki JanZerebecki force-pushed the JanZerebecki:rm-same-origin-data-url branch from 5fc9a72 to 44517e0 Sep 27, 2016
@JanZerebecki JanZerebecki force-pushed the JanZerebecki:rm-same-origin-data-url branch from 44517e0 to beaf91d Sep 28, 2016
@KiChjang
Copy link
Member

KiChjang commented Sep 28, 2016

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

bors-servo commented Sep 28, 2016

📌 Commit beaf91d has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Sep 30, 2016

Testing commit beaf91d with merge a014e4b...

bors-servo added a commit that referenced this pull request Sep 30, 2016
Remove same-origin-data-url flag from fetch implementation

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

The spec removed it. Check the scheme instead, data is always same origin now,
except for workers.
Closes #13362

---
<!-- 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 #13362 .

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they only remove code.

<!-- 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/13467)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 30, 2016

💔 Test failed - linux-dev

@jdm
Copy link
Member

jdm commented Sep 30, 2016

error[E0560]: struct `net_traits::request::RequestInit` has no field named `same_origin_data`
  --> /home/servo/buildbot/slave/linux-dev/build/components/script/fetch.rs:47:9
   |
47 |         same_origin_data: request.same_origin_data.get(),
   |         ^^^^^^^^^^^^^^^^

error: attempted access of field `same_origin_data` on type `net_traits::request::Request`, but no field with that name was found
  --> /home/servo/buildbot/slave/linux-dev/build/components/script/fetch.rs:47:27
   |
47 |         same_origin_data: request.same_origin_data.get(),
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: did you mean `omit_origin_header`?
  --> /home/servo/buildbot/slave/linux-dev/build/components/script/fetch.rs:47:35
   |
47 |         same_origin_data: request.same_origin_data.get(),
   |                                   ^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
@jdm
Copy link
Member

jdm commented Sep 30, 2016

That code was added in #13323 which only merged yesterday.

The spec removed it. Check the scheme instead, data is always same origin now,
except for workers.
This also updates the comments to make step numbers match the spec.
Closes #13362
@KiChjang KiChjang force-pushed the JanZerebecki:rm-same-origin-data-url branch from beaf91d to 95a7482 Oct 1, 2016
@KiChjang
Copy link
Member

KiChjang commented Oct 1, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2016

📌 Commit 95a7482 has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2016

Testing commit 95a7482 with merge 389a798...

bors-servo added a commit that referenced this pull request Oct 1, 2016
Remove same-origin-data-url flag from fetch implementation

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

The spec removed it. Check the scheme instead, data is always same origin now,
except for workers.
Closes #13362

---
<!-- 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 #13362 .

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they only remove code.

<!-- 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/13467)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2016

💔 Test failed - mac-rel-wpt2

@KiChjang
Copy link
Member

KiChjang commented Oct 1, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2016

Testing commit 95a7482 with merge e494ded...

bors-servo added a commit that referenced this pull request Oct 1, 2016
Remove same-origin-data-url flag from fetch implementation

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

The spec removed it. Check the scheme instead, data is always same origin now,
except for workers.
Closes #13362

---
<!-- 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 #13362 .

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they only remove code.

<!-- 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/13467)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2016

@bors-servo bors-servo merged commit 95a7482 into servo:master Oct 1, 2016
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
@JanZerebecki JanZerebecki deleted the JanZerebecki:rm-same-origin-data-url branch Oct 1, 2016
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.