Repository navigation
Implement cross-thread postMessage - #15679
Conversation
|
Heads up! This PR modifies the following files:
|
|
cc @jdm |
|
☔ The latest upstream changes (presumably #15438) made this pull request unmergeable. Please resolve the merge conflicts. |
6ea3d04 to
53043b3
Compare
|
☔ The latest upstream changes (presumably #14962) made this pull request unmergeable. Please resolve the merge conflicts. |
53043b3 to
73acf86
Compare
73acf86 to
72cd111
Compare
|
☔ The latest upstream changes (presumably #15536) made this pull request unmergeable. Please resolve the merge conflicts. |
72cd111 to
f560c80
Compare
|
|
||
| fn handle_post_message_msg(&mut self, frame_id: FrameId, origin: Option<ImmutableOrigin>, data: Vec<u8>) { | ||
| let pipeline_id = match self.frames.get(&frame_id) { | ||
| None => return warn!("postMessage to closed frame {}.", frame_id), |
There was a problem hiding this comment.
(As a side note, I seriously believe that we should convert all these to panics during testing).
There was a problem hiding this comment.
That's an interesting idea. These warnings can happen during correct execution (e.g. post a message to an iframe's content window after it's been removed from the frame tree) but I don't think that should come up in wpt testing. File an issue?
| @@ -0,0 +1,13 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
There was a problem hiding this comment.
A lot of the tags here (and in the other tests) can go away and would make this a bit less noisy, but your choice :)
There was a problem hiding this comment.
I like my html old skool :)
| <body> | ||
| <script> | ||
| window.addEventListener("message", function(e) { | ||
| window.location.href = e.data; |
There was a problem hiding this comment.
heh. this is quite tricky. I guess it works :)
| // child1 is a dissimilar-origin document | ||
| var childURL1 = new URL("cross-origin-postMessage-child1.html", document.location); | ||
| childURL1.hostname = "127.0.0.1"; | ||
| // child2 is a same-orogin document |
asajeffrey
left a comment
There was a problem hiding this comment.
Thanks for the quick review!
|
|
||
| fn handle_post_message_msg(&mut self, frame_id: FrameId, origin: Option<ImmutableOrigin>, data: Vec<u8>) { | ||
| let pipeline_id = match self.frames.get(&frame_id) { | ||
| None => return warn!("postMessage to closed frame {}.", frame_id), |
There was a problem hiding this comment.
That's an interesting idea. These warnings can happen during correct execution (e.g. post a message to an iframe's content window after it's been removed from the frame tree) but I don't think that should come up in wpt testing. File an issue?
| @@ -0,0 +1,13 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
There was a problem hiding this comment.
I like my html old skool :)
| <body> | ||
| <script> | ||
| window.addEventListener("message", function(e) { | ||
| window.location.href = e.data; |
| // child1 is a dissimilar-origin document | ||
| var childURL1 = new URL("cross-origin-postMessage-child1.html", document.location); | ||
| childURL1.hostname = "127.0.0.1"; | ||
| // child2 is a same-orogin document |
f560c80 to
f9c5d0c
Compare
|
@bors-servo r=emilio |
|
📌 Commit f9c5d0c has been approved by |
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 -->
|
☀️ 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 |
This PR implements cross-thread postMessage,
It builds on #15438 and #15478, only the last commit is part of this PR.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is