Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd ImmutableOrigin to allow for serializing origins #15438
Conversation
highfive
commented
Feb 8, 2017
|
Heads up! This PR modifies the following files:
|
|
The original work on this was by @cbrewster. r? @jdm |
| @@ -2154,7 +2153,7 @@ impl Document { | |||
| HasBrowsingContext::No, | |||
| None, | |||
| // https://github.com/whatwg/html/issues/2109 | |||
| Origin::opaque_identifier(), | |||
| self.origin.clone(), | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Feb 12, 2017
Author
Member
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.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Feb 21, 2017
Author
Member
Is this the only remaining issue? I can revert it if we want to keep the old behaviour.
This comment has been minimized.
This comment has been minimized.
| * 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; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -80,7 +80,7 @@ impl DOMImplementationMethods for DOMImplementation { | |||
| let doc = XMLDocument::new(win, | |||
| HasBrowsingContext::No, | |||
| None, | |||
| self.document.origin().alias(), | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Feb 12, 2017
Author
Member
The Rust naming contention seems to be that clone copies the reference to Rc.
This comment has been minimized.
This comment has been minimized.
jdm
Feb 21, 2017
Member
Since the spec does not talk about aliasing any more there is no need for a special name here.
| @@ -2410,14 +2411,18 @@ impl DocumentMethods for Document { | |||
| // https://html.spec.whatwg.org/multipage/#relaxing-the-same-origin-restriction | |||
| fn Domain(&self) -> DOMString { | |||
| // Step 1. | |||
| if self.browsing_context().is_none() { | |||
| if self.has_browsing_context { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@jdm ping? |
b07059c
to
3087ea2
|
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 |
|
|
3087ea2
to
b7055cb
|
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
| url = "1.2" | ||
| url_serde = {version = "0.1", optional = true} | ||
| servo_rand = {path = "../rand"} |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I intend to complete me review today. |
|
@jdm: thanks! |
|
Only a couple small comments. Sorry about the delay! |
| @@ -2154,7 +2153,7 @@ impl Document { | |||
| HasBrowsingContext::No, | |||
| None, | |||
| // https://github.com/whatwg/html/issues/2109 | |||
| Origin::opaque_identifier(), | |||
| self.origin.clone(), | |||
This comment has been minimized.
This comment has been minimized.
| @@ -80,7 +80,7 @@ impl DOMImplementationMethods for DOMImplementation { | |||
| let doc = XMLDocument::new(win, | |||
| HasBrowsingContext::No, | |||
| None, | |||
| self.document.origin().alias(), | |||
This comment has been minimized.
This comment has been minimized.
jdm
Feb 21, 2017
Member
Since the spec does not talk about aliasing any more there is no need for a special name here.
| @@ -155,7 +154,8 @@ struct InProgressLoad { | |||
| is_visible: bool, | |||
| /// The requested URL of the load. | |||
| url: ServoUrl, | |||
| origin: Origin, | |||
| /// The origin for the document | |||
| origin: MutableOrigin, | |||
This comment has been minimized.
This comment has been minimized.
jdm
Feb 21, 2017
Member
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.
This comment has been minimized.
This comment has been minimized.
1c8c7af
to
66049a0
|
@nox suggests a forced push then an r+, so... @bors-servo: r=jdm |
|
|
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 -->
|
|
66049a0
to
bfd7b95
|
Oh yes |
|
@bors-servo r=jdm |
|
|
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 -->
|
|
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 -->
asajeffrey commentedFeb 8, 2017
•
edited by larsbergstrom
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