Repository navigation
Add ImmutableOrigin to allow for serializing origins - #15438
Conversation
|
Heads up! This PR modifies the following files:
|
|
The original work on this was by @cbrewster. r? @jdm |
| None, | ||
| // https://github.com/whatwg/html/issues/2109 | ||
| Origin::opaque_identifier(), | ||
| self.origin.clone(), |
There was a problem hiding this comment.
Well the latest opinion on that discussion was @smaug---- saying whatwg/html#2109 (comment) which looks like it's coming down on the side of a template inheriting its origin, rather than generating a new opaque origin. Can the template document cause script to run? If so, we may need to make sure it runs in the right script thread.
There was a problem hiding this comment.
Is this the only remaining issue? I can revert it if we want to keep the old behaviour.
There was a problem hiding this comment.
Let's leave this as it is until that issue resolves one way or another.
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| // #[cfg(feature = "servo")] use heapsize::HeapSizeOf; |
| let doc = XMLDocument::new(win, | ||
| HasBrowsingContext::No, | ||
| None, | ||
| self.document.origin().alias(), |
There was a problem hiding this comment.
I feel we should keep the alias/copy distinction.
There was a problem hiding this comment.
The Rust naming contention seems to be that clone copies the reference to Rc.
There was a problem hiding this comment.
Since the spec does not talk about aliasing any more there is no need for a special name here.
| fn Domain(&self) -> DOMString { | ||
| // Step 1. | ||
| if self.browsing_context().is_none() { | ||
| if self.has_browsing_context { |
|
@jdm ping? |
b07059c to
3087ea2
Compare
|
Clearly the original origin code is older than March 2016, and I've somehow missed that whatwg/html@438155d happened in the meantime. |
|
Yes, the "alias" concept is gone, we may as well use the Rust naming convention for |
|
☔ The latest upstream changes (presumably #15588) made this pull request unmergeable. Please resolve the merge conflicts. |
3087ea2 to
b7055cb
Compare
|
This is blocked because the Serde implementation for IRC conversation with @SimonSapin and @nox at http://logs.glob.uno/?c=mozilla%23servo&s=20+Feb+2017&e=20+Feb+2017#c615535 |
|
Should be unblocked now: servo/rust-url#280 (comment) |
|
Thanks! |
b7055cb to
5d703b9
Compare
| serde_derive = {version = "0.9", optional = true} | ||
| url = "1.2" | ||
| url_serde = {version = "0.1", optional = true} | ||
| servo_rand = {path = "../rand"} |
|
I intend to complete me review today. |
|
@jdm: thanks! |
jdm
left a comment
There was a problem hiding this comment.
Only a couple small comments. Sorry about the delay!
| None, | ||
| // https://github.com/whatwg/html/issues/2109 | ||
| Origin::opaque_identifier(), | ||
| self.origin.clone(), |
There was a problem hiding this comment.
Let's leave this as it is until that issue resolves one way or another.
| let doc = XMLDocument::new(win, | ||
| HasBrowsingContext::No, | ||
| None, | ||
| self.document.origin().alias(), |
There was a problem hiding this comment.
Since the spec does not talk about aliasing any more there is no need for a special name here.
| url: ServoUrl, | ||
| origin: Origin, | ||
| /// The origin for the document | ||
| origin: MutableOrigin, |
There was a problem hiding this comment.
I think it might be clearer if we left this as an immutable one, since the domain of the origin can't change while the document is being fetch.
The one case I'm unsure about is if this can represent the origin of an about:blank loaded in a document that has set document.domain. If we need to provide a MutableOrigin for that, then I guess this needs to stay as-is.
There was a problem hiding this comment.
Indeed, that is the one case.
1c8c7af to
66049a0
Compare
|
@nox suggests a forced push then an r+, so... @bors-servo: r=jdm |
|
📌 Commit 66049a0 has been approved by |
Add ImmutableOrigin to allow for serializing origins <!-- Please describe your changes on the following line: --> This PR adds a serializable type `ImmutableOrigin` and a non-serializable type `MutableOrigin`. The immutable type represents an origin with `null` domain, and the mutable type represents an origin with a mutable domain. This separation is needed for implementing setting `document.domain`. --- <!-- 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 #14892. - [X] These changes do not require tests because it's a refactoring which will enable other features. <!-- 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/15438) <!-- Reviewable:end -->
|
💔 Test failed - mac-dev-unit |
66049a0 to
bfd7b95
Compare
|
Oh yes |
|
@bors-servo r=jdm |
|
📌 Commit bfd7b95 has been approved by |
Add ImmutableOrigin to allow for serializing origins <!-- Please describe your changes on the following line: --> This PR adds a serializable type `ImmutableOrigin` and a non-serializable type `MutableOrigin`. The immutable type represents an origin with `null` domain, and the mutable type represents an origin with a mutable domain. This separation is needed for implementing setting `document.domain`. --- <!-- 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 #14892. - [X] These changes do not require tests because it's a refactoring which will enable other features. <!-- 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/15438) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
Implement setter for document.domain <!-- Please describe your changes on the following line: --> This PR implements the setter for `document.domain`. It builds on #15438 and #15478, only the last commit is part of this PR. It includes tests for similar-origin security checks. --- <!-- 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 #934. - [X] There are tests for these changes. <!-- 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/15536) <!-- Reviewable:end -->
Implement setter for document.domain <!-- Please describe your changes on the following line: --> This PR implements the setter for `document.domain`. It builds on #15438 and #15478, only the last commit is part of this PR. It includes tests for similar-origin security checks. --- <!-- 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 #934. - [X] There are tests for these changes. <!-- 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/15536) <!-- Reviewable:end -->
Implement cross-thread postMessage <!-- Please describe your changes on the following line: --> This PR implements cross-thread postMessage, It builds on #15438 and #15478, only the last commit is part of this PR. --- <!-- 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] There are tests for these changes <!-- 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/15679) <!-- Reviewable:end -->
This PR adds a serializable type
ImmutableOriginand a non-serializable typeMutableOrigin. The immutable type represents an origin withnulldomain, and the mutable type represents an origin with a mutable domain. This separation is needed for implementing settingdocument.domain../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is