mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Bug 1172897 - Rename Tab Actor to BrowsingContextActor
As part of [Bug 1172987](https://bugzilla.mozilla.org/show_bug.cgi?id=1172897) we renamed TabActor, as the actor does not represent tabs (as in a browser tab), it instead represents a browsing context as defined by the the [HTML standard](https://html.spec.whatwg.org/multipage/browsers.html#windows). In a later PR I will mirror the structure we have on devtools to have a targets folder, which contains all target types. At the moment it looks like servo only represents workers and browsing contexts.
This commit is contained in:
parent
196bec2b87
commit
86b78629c3
3 changed files with 34 additions and 34 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Liberally derived from the [Firefox JS implementation]
|
||||
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webbrowser.js).
|
||||
//! Connection point for remote devtools that wish to investigate a particular tab's contents.
|
||||
//! Connection point for remote devtools that wish to investigate a particular Browsing Context's contents.
|
||||
//! Supports dynamic attaching and detaching which control notifications of navigation, etc.
|
||||
|
||||
use actor::{Actor, ActorMessageStatus, ActorRegistry};
|
||||
|
@ -15,21 +15,21 @@ use serde_json::{Map, Value};
|
|||
use std::net::TcpStream;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct TabTraits;
|
||||
struct BrowsingContextTraits;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct TabAttachedReply {
|
||||
struct BrowsingContextAttachedReply {
|
||||
from: String,
|
||||
#[serde(rename = "type")]
|
||||
type_: String,
|
||||
threadActor: String,
|
||||
cacheDisabled: bool,
|
||||
javascriptEnabled: bool,
|
||||
traits: TabTraits,
|
||||
traits: BrowsingContextTraits,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct TabDetachedReply {
|
||||
struct BrowsingContextDetachedReply {
|
||||
from: String,
|
||||
#[serde(rename = "type")]
|
||||
type_: String,
|
||||
|
@ -55,7 +55,7 @@ struct FrameMsg {
|
|||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct TabActorMsg {
|
||||
pub struct BrowsingContextActorMsg {
|
||||
actor: String,
|
||||
title: String,
|
||||
url: String,
|
||||
|
@ -67,7 +67,7 @@ pub struct TabActorMsg {
|
|||
performanceActor: String,
|
||||
}
|
||||
|
||||
pub struct TabActor {
|
||||
pub struct BrowsingContextActor {
|
||||
pub name: String,
|
||||
pub title: String,
|
||||
pub url: String,
|
||||
|
@ -79,7 +79,7 @@ pub struct TabActor {
|
|||
pub thread: String,
|
||||
}
|
||||
|
||||
impl Actor for TabActor {
|
||||
impl Actor for BrowsingContextActor {
|
||||
fn name(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
@ -107,16 +107,16 @@ impl Actor for TabActor {
|
|||
ActorMessageStatus::Processed
|
||||
},
|
||||
|
||||
// https://wiki.mozilla.org/Remote_Debugging_Protocol#Listing_Browser_Tabs
|
||||
// (see "To attach to a _tabActor_")
|
||||
// https://docs.firefox-dev.tools/backend/protocol.html#listing-browser-tabs
|
||||
// (see "To attach to a _targetActor_")
|
||||
"attach" => {
|
||||
let msg = TabAttachedReply {
|
||||
let msg = BrowsingContextAttachedReply {
|
||||
from: self.name(),
|
||||
type_: "tabAttached".to_owned(),
|
||||
type_: "targetAttached".to_owned(),
|
||||
threadActor: self.thread.clone(),
|
||||
cacheDisabled: false,
|
||||
javascriptEnabled: true,
|
||||
traits: TabTraits,
|
||||
traits: BrowsingContextTraits,
|
||||
};
|
||||
let console_actor = registry.find::<ConsoleActor>(&self.console);
|
||||
console_actor
|
||||
|
@ -134,7 +134,7 @@ impl Actor for TabActor {
|
|||
//FIXME: The current implementation won't work for multiple connections. Need to ensure 105
|
||||
// that the correct stream is removed.
|
||||
"detach" => {
|
||||
let msg = TabDetachedReply {
|
||||
let msg = BrowsingContextDetachedReply {
|
||||
from: self.name(),
|
||||
type_: "detached".to_owned(),
|
||||
};
|
||||
|
@ -162,9 +162,9 @@ impl Actor for TabActor {
|
|||
}
|
||||
}
|
||||
|
||||
impl TabActor {
|
||||
pub fn encodable(&self) -> TabActorMsg {
|
||||
TabActorMsg {
|
||||
impl BrowsingContextActor {
|
||||
pub fn encodable(&self) -> BrowsingContextActorMsg {
|
||||
BrowsingContextActorMsg {
|
||||
actor: self.name(),
|
||||
title: self.title.clone(),
|
||||
url: self.url.clone(),
|
|
@ -5,10 +5,10 @@
|
|||
/// Liberally derived from the [Firefox JS implementation]
|
||||
/// (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js).
|
||||
/// Connection point for all new remote devtools interactions, providing lists of know actors
|
||||
/// that perform more specific actions (tabs, addons, browser chrome, etc.)
|
||||
/// that perform more specific actions (targets, addons, browser chrome, etc.)
|
||||
use actor::{Actor, ActorMessageStatus, ActorRegistry};
|
||||
use actors::browsing_context::{BrowsingContextActor, BrowsingContextActorMsg};
|
||||
use actors::performance::PerformanceActor;
|
||||
use actors::tab::{TabActor, TabActorMsg};
|
||||
use protocol::{ActorDescription, JsonPacketStream};
|
||||
use serde_json::{Map, Value};
|
||||
use std::net::TcpStream;
|
||||
|
@ -34,7 +34,7 @@ enum AddonMsg {}
|
|||
struct ListTabsReply {
|
||||
from: String,
|
||||
selected: u32,
|
||||
tabs: Vec<TabActorMsg>,
|
||||
tabs: Vec<BrowsingContextActorMsg>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
@ -81,7 +81,7 @@ impl Actor for RootActor {
|
|||
ActorMessageStatus::Processed
|
||||
},
|
||||
|
||||
//https://wiki.mozilla.org/Remote_Debugging_Protocol#Listing_Browser_Tabs
|
||||
// https://docs.firefox-dev.tools/backend/protocol.html#listing-browser-tabs
|
||||
"listTabs" => {
|
||||
let actor = ListTabsReply {
|
||||
from: "root".to_owned(),
|
||||
|
@ -89,7 +89,7 @@ impl Actor for RootActor {
|
|||
tabs: self
|
||||
.tabs
|
||||
.iter()
|
||||
.map(|tab| registry.find::<TabActor>(tab).encodable())
|
||||
.map(|target| registry.find::<BrowsingContextActor>(target).encodable())
|
||||
.collect(),
|
||||
};
|
||||
stream.write_json_packet(&actor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue