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

Implement dissimilar-origin window.parent and window.top #15799

Merged
merged 1 commit into from Mar 17, 2017

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented Mar 2, 2017

This PR implements window.parent and window.top for dissimilar-origin windows.

This PR builds on #15536, only the last commit is part of this PR.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14996 and fix #11660.
  • These changes do not require tests because there's already a parentage test in mozilla/cross-origin-objects/cross-origin-objects.html.

This change is Reviewable

@highfive
Copy link

highfive commented Mar 2, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/location.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs, components/script/script_thread.rs, components/script/devtools.rs, components/script/dom/browsingcontext.rs, components/script/dom/history.rs, components/script/webdriver_handlers.rs, components/script/dom/webidls/Document.webidl, components/script/dom/dissimilaroriginwindow.rs, components/script/dom/window.rs, components/script/dom/document.rs, components/script/dom/webidls/Location.webidl, components/script/dom/htmliframeelement.rs
  • @KiChjang: components/script/dom/location.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs, components/net_traits/pub_domains.rs, components/net_traits/pub_domains.rs, components/script/script_thread.rs, components/script/devtools.rs, components/script/dom/browsingcontext.rs, components/script/dom/history.rs, components/script/webdriver_handlers.rs, components/script/dom/webidls/Document.webidl, components/script/dom/dissimilaroriginwindow.rs, components/script/dom/window.rs, components/script/dom/document.rs, components/script/dom/webidls/Location.webidl, components/script/dom/htmliframeelement.rs
@highfive
Copy link

highfive commented Mar 2, 2017

warning Warning warning

  • These commits include an empty title element (<title></title>). Consider adding appropriate metadata.
  • These commits modify unsafe code. Please review it carefully!
@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 2, 2017

@KiChjang
Copy link
Member

KiChjang commented Mar 2, 2017

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned KiChjang Mar 2, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 2, 2017

Accidentally fixes #11660.

@Ms2ger
Copy link
Contributor

Ms2ger commented Mar 3, 2017

Is there anyone else who could review this?

@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 3, 2017

The obvious candidate is @jdm, but he's away next week. @nox?

@nox
Copy link
Member

nox commented Mar 3, 2017

I will as soon as #15536 lands and this gets rebased on top of master.

@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 3, 2017

@nox: thanks! If you wanted to take a look at #15536 too, that would be great, it's already gone through quite a bit of review by @jdm and @Ms2ger.

@Ms2ger Ms2ger assigned nox and unassigned Ms2ger Mar 14, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Mar 15, 2017

The latest upstream changes (presumably #15536) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-window-xorigin-parent branch from 60de134 to 166eeea Mar 15, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 15, 2017

@nox: ready when you are!

@bors-servo
Copy link
Contributor

bors-servo commented Mar 15, 2017

The latest upstream changes (presumably #15679) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-window-xorigin-parent branch from 166eeea to b2531fc Mar 15, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 15, 2017

Rebased.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-window-xorigin-parent branch from 8e2c901 to 2563a31 Mar 16, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Mar 16, 2017

The latest upstream changes (presumably #15906) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

nox left a comment

Some questions.

result_receiver.recv().expect("Failed to get frame id from constellation.")
}

fn remote_browsing_context(&self,

This comment has been minimized.

Copy link
@nox

nox Mar 17, 2017

Member

What does this do?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Gets a browsing context for a pipeline in another script thread. I'll add a comment.

Some(browsing_context)
}

fn local_browsing_context(&self,

This comment has been minimized.

Copy link
@nox

nox Mar 17, 2017

Member

What does this do?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Gets a browsing context for a pipeline in this script thread. I'll add a comment.

-> Root<BrowsingContext>
{
if let Some(browsing_context) = self.browsing_contexts.borrow().get(&frame_id) {
browsing_context.set_currently_active(&*window);

This comment has been minimized.

Copy link
@nox

nox Mar 17, 2017

Member

Why?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

The browsing context already exists, but another window is currently active.

This comment has been minimized.

Copy link
@nox

nox Mar 17, 2017

Member

I don't get it. Why does getting a browsing context for a pipeline in this script thread should change the active window?


FromScriptMsg::GetFrameId(pipeline_id, sender) => {
let result = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
let _ = sender.send(result);

This comment has been minimized.

Copy link
@nox

nox Mar 17, 2017

Member

No warn! on send error?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Fixed.

}
FromScriptMsg::GetParentInfo(pipeline_id, sender) => {
let result = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.parent_info);
let _ = sender.send(result);

This comment has been minimized.

Copy link
@nox

nox Mar 17, 2017

Member

No warn! on send error?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Fixed.

Copy link
Member Author

asajeffrey left a comment

Thanks for the review!


FromScriptMsg::GetFrameId(pipeline_id, sender) => {
let result = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
let _ = sender.send(result);

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Fixed.

}
FromScriptMsg::GetParentInfo(pipeline_id, sender) => {
let result = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.parent_info);
let _ = sender.send(result);

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Fixed.

result_receiver.recv().expect("Failed to get frame id from constellation.")
}

fn remote_browsing_context(&self,

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Gets a browsing context for a pipeline in another script thread. I'll add a comment.

Some(browsing_context)
}

fn local_browsing_context(&self,

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

Gets a browsing context for a pipeline in this script thread. I'll add a comment.

-> Root<BrowsingContext>
{
if let Some(browsing_context) = self.browsing_contexts.borrow().get(&frame_id) {
browsing_context.set_currently_active(&*window);

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Mar 17, 2017

Author Member

The browsing context already exists, but another window is currently active.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-window-xorigin-parent branch from 97bbf4f to 2155054 Mar 17, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 17, 2017

Rebased.

@nox
Copy link
Member

nox commented Mar 17, 2017

Squash it and r=me.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-window-xorigin-parent branch from 2155054 to 6bcb5f6 Mar 17, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Mar 17, 2017

Squashed. @bors-servo r=nox

@bors-servo
Copy link
Contributor

bors-servo commented Mar 17, 2017

📌 Commit 6bcb5f6 has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Mar 17, 2017

Testing commit 6bcb5f6 with merge 0a3b373...

bors-servo added a commit that referenced this pull request Mar 17, 2017
Implement dissimilar-origin window.parent and window.top

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

This PR implements `window.parent` and `window.top` for dissimilar-origin windows.

This PR builds on #15536, 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] These changes fix #14996 and fix #11660.
- [X] These changes do not require tests because there's already a parentage test in `mozilla/cross-origin-objects/cross-origin-objects.html`.

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

bors-servo commented Mar 17, 2017

☀️ 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-msvc-dev
Approved by: nox
Pushing 0a3b373 to master...

@bors-servo bors-servo merged commit 6bcb5f6 into servo:master Mar 17, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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.