Skip to content

Commit

Permalink
Add a new RPC call for getting a child browsing context ID
Browse files Browse the repository at this point in the history
  • Loading branch information
KiChjang committed Apr 30, 2018
1 parent 847115b commit 4383b30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/constellation/constellation.rs
Expand Up @@ -1231,6 +1231,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
warn!("Sending reply to get parent info failed ({:?}).", e);
}
}
FromScriptMsg::GetChildBrowsingContextId(browsing_context_id, index, sender) => {
// We increment here because the 0th element is the parent browsing context itself
let result = self.all_descendant_browsing_contexts_iter(browsing_context_id)
.nth(index + 1)
.map(|bc| bc.id);
if let Err(e) = sender.send(result) {
warn!("Sending reply to get child browsing context ID failed ({:?}).", e);
}
}
FromScriptMsg::RegisterServiceWorker(scope_things, scope) => {
debug!("constellation got store registration scope message");
self.handle_register_serviceworker(scope_things, scope);
Expand Down
2 changes: 2 additions & 0 deletions components/script_traits/script_msg.rs
Expand Up @@ -90,6 +90,8 @@ pub enum ScriptMsg {
GetBrowsingContextId(PipelineId, IpcSender<Option<BrowsingContextId>>),
/// Get the parent info for a given pipeline.
GetParentInfo(PipelineId, IpcSender<Option<PipelineId>>),
/// Get the nth child browsing context ID for a given browsing context, sorted in tree order.
GetChildBrowsingContextId(BrowsingContextId, usize, IpcSender<Option<BrowsingContextId>>),
/// <head> tag finished parsing
HeadParsed,
/// All pending loads are complete, and the `load` event for this pipeline
Expand Down

0 comments on commit 4383b30

Please sign in to comment.