mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #16997 - asajeffrey:webdriver-browsing-contexts-not-pipelines, r=jgraham
Webdriver browsing contexts not pipelines <!-- Please describe your changes on the following line: --> At the moment, a webdriver session stores a `pipeline_id`s, which causes a mismatch with the spec, which asks a session to store a browsing context and a top-level browsing context. This PR fixes this mismatch. --- <!-- 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 do not require tests because we are not testing webdriver <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- 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/16997) <!-- Reviewable:end -->
This commit is contained in:
commit
0bc7e2fddf
12 changed files with 263 additions and 244 deletions
|
@ -44,10 +44,9 @@ impl History {
|
|||
if !self.window.Document().is_fully_active() {
|
||||
return Err(Error::Security);
|
||||
}
|
||||
let global_scope = self.window.upcast::<GlobalScope>();
|
||||
let pipeline = global_scope.pipeline_id();
|
||||
let msg = ConstellationMsg::TraverseHistory(Some(pipeline), direction);
|
||||
let _ = global_scope.constellation_chan().send(msg);
|
||||
let top_level_browsing_context_id = self.window.window_proxy().top_level_browsing_context_id();
|
||||
let msg = ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
|
||||
let _ = self.window.upcast::<GlobalScope>().constellation_chan().send(msg);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -58,13 +57,12 @@ impl HistoryMethods for History {
|
|||
if !self.window.Document().is_fully_active() {
|
||||
return Err(Error::Security);
|
||||
}
|
||||
let global_scope = self.window.upcast::<GlobalScope>();
|
||||
let pipeline = global_scope.pipeline_id();
|
||||
let top_level_browsing_context_id = self.window.window_proxy().top_level_browsing_context_id();
|
||||
let (sender, recv) = ipc::channel().expect("Failed to create channel to send jsh length.");
|
||||
let msg = ConstellationMsg::JointSessionHistoryLength(pipeline, sender);
|
||||
let _ = global_scope.constellation_chan().send(msg);
|
||||
let msg = ConstellationMsg::JointSessionHistoryLength(top_level_browsing_context_id, sender);
|
||||
let _ = self.window.upcast::<GlobalScope>().constellation_chan().send(msg);
|
||||
Ok(recv.recv().unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-history-go
|
||||
fn Go(&self, delta: i32) -> ErrorResult {
|
||||
|
|
|
@ -540,18 +540,16 @@ unsafe fn build_mozbrowser_event_detail(event: MozBrowserEvent,
|
|||
|
||||
pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult {
|
||||
if iframe.Mozbrowser() {
|
||||
if iframe.upcast::<Node>().is_in_doc_with_browsing_context() {
|
||||
if let Some(top_level_browsing_context_id) = iframe.top_level_browsing_context_id() {
|
||||
let window = window_from_node(iframe);
|
||||
let msg = ConstellationMsg::TraverseHistory(iframe.pipeline_id(), direction);
|
||||
let msg = ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
|
||||
window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap();
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
debug!(concat!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top",
|
||||
"level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)"));
|
||||
Err(Error::NotSupported)
|
||||
}
|
||||
debug!(concat!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top",
|
||||
"level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)"));
|
||||
Err(Error::NotSupported)
|
||||
}
|
||||
|
||||
impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue