Skip to content

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

Merged
bors-servo merged 1 commit into
servo:masterfrom
asajeffrey:script-window-xorigin-parent
Mar 17, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
asajeffrey:script-window-xorigin-parent

Conversation

@asajeffrey

@asajeffrey asajeffrey commented Mar 2, 2017 •

Copy link
Copy Markdown
Contributor

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.



This change is Reviewable

@highfive

highfive commented Mar 2, 2017

Copy link
Copy Markdown

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

highfive commented Mar 2, 2017

Copy link
Copy Markdown

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!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 2, 2017
@asajeffrey asajeffrey added A-content/script Related to the script thread S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 2, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

cc @jdm @Ms2ger

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 2, 2017
@asajeffrey asajeffrey added the S-needs-squash Some (or all) of the commits in the PR should be combined. label Mar 2, 2017
@KiChjang

KiChjang commented Mar 2, 2017

Copy link
Copy Markdown
Contributor

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned KiChjang Mar 2, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Accidentally fixes #11660.

@Ms2ger

Ms2ger commented Mar 3, 2017

Copy link
Copy Markdown
Contributor

Is there anyone else who could review this?

@asajeffrey

Copy link
Copy Markdown
Contributor Author

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

@nox

nox commented Mar 3, 2017 •

Copy link
Copy Markdown
Contributor

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

@asajeffrey

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 15, 2017
@asajeffrey
asajeffrey force-pushed the script-window-xorigin-parent branch from 60de134 to 166eeea Compare March 15, 2017 19:15
@asajeffrey

Copy link
Copy Markdown
Contributor Author

@nox: ready when you are!

@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 15, 2017
@asajeffrey
asajeffrey force-pushed the script-window-xorigin-parent branch from 166eeea to b2531fc Compare March 15, 2017 21:24
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Rebased.

@asajeffrey asajeffrey removed the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Mar 15, 2017
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 16, 2017
@asajeffrey
asajeffrey force-pushed the script-window-xorigin-parent branch from 8e2c901 to 2563a31 Compare March 16, 2017 15:43
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 16, 2017

@nox nox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions.

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

fn remote_browsing_context(&self,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Some(browsing_context)
}

fn local_browsing_context(&self,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No warn! on send error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No warn! on send error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@nox nox added S-awaiting-answer Someone asked a question that requires an answer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 17, 2017

@asajeffrey asajeffrey left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

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

fn remote_browsing_context(&self,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Some(browsing_context)
}

fn local_browsing_context(&self,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 17, 2017
@asajeffrey
asajeffrey force-pushed the script-window-xorigin-parent branch from 97bbf4f to 2155054 Compare March 17, 2017 15:19
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Rebased.

@nox nox added S-needs-squash Some (or all) of the commits in the PR should be combined. and removed S-awaiting-answer Someone asked a question that requires an answer. S-awaiting-review There is new code that needs to be reviewed. S-fails-tidy `./mach test-tidy` reported errors. S-needs-rebase There are merge conflict errors. labels Mar 17, 2017
@nox

nox commented Mar 17, 2017

Copy link
Copy Markdown
Contributor

Squash it and r=me.

@asajeffrey
asajeffrey force-pushed the script-window-xorigin-parent branch from 2155054 to 6bcb5f6 Compare March 17, 2017 15:53
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 17, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Squashed. @bors-servo r=nox

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 6bcb5f6 has been approved by nox

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-squash Some (or all) of the commits in the PR should be combined. labels Mar 17, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 6bcb5f6 with merge 0a3b373...

bors-servo pushed 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
Copy Markdown
Contributor

☀️ 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
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-origin window.parent Get window.frameElement to return null

6 participants