mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
base: Finish rename of TopLevelBrowsingContextId
to WebViewId
(#35896)
The `WebViewId` name is a lot more descriptive these days to the casual reader, so I think we can go ahead and finish the rename. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
81fe4bbb1e
commit
2464d0937f
22 changed files with 416 additions and 570 deletions
|
@ -6,7 +6,7 @@ use std::sync::Arc;
|
|||
use std::sync::atomic::AtomicBool;
|
||||
use std::thread::{self, JoinHandle};
|
||||
|
||||
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId};
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
use crossbeam_channel::{Receiver, Sender, unbounded};
|
||||
use devtools_traits::DevtoolScriptControlMsg;
|
||||
use dom_struct::dom_struct;
|
||||
|
@ -349,7 +349,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
insecure_requests_policy: InsecureRequestsPolicy,
|
||||
) -> JoinHandle<()> {
|
||||
let serialized_worker_url = worker_url.to_string();
|
||||
let top_level_browsing_context_id = TopLevelBrowsingContextId::installed();
|
||||
let webview_id = WebViewId::installed();
|
||||
let current_global = GlobalScope::current().expect("No current global object");
|
||||
let origin = current_global.origin().immutable().clone();
|
||||
let referrer = current_global.get_referrer();
|
||||
|
@ -361,8 +361,8 @@ impl DedicatedWorkerGlobalScope {
|
|||
.spawn(move || {
|
||||
thread_state::initialize(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
|
||||
if let Some(top_level_browsing_context_id) = top_level_browsing_context_id {
|
||||
TopLevelBrowsingContextId::install(top_level_browsing_context_id);
|
||||
if let Some(webview_id) = webview_id {
|
||||
WebViewId::install(webview_id);
|
||||
}
|
||||
|
||||
let roots = RootCollection::new();
|
||||
|
@ -376,21 +376,17 @@ impl DedicatedWorkerGlobalScope {
|
|||
|
||||
let referrer = referrer_url.map(Referrer::ReferrerUrl).unwrap_or(referrer);
|
||||
|
||||
let request = RequestBuilder::new(
|
||||
top_level_browsing_context_id,
|
||||
worker_url.clone(),
|
||||
referrer,
|
||||
)
|
||||
.destination(Destination::Worker)
|
||||
.mode(RequestMode::SameOrigin)
|
||||
.credentials_mode(CredentialsMode::CredentialsSameOrigin)
|
||||
.parser_metadata(ParserMetadata::NotParserInserted)
|
||||
.use_url_credentials(true)
|
||||
.pipeline_id(Some(pipeline_id))
|
||||
.referrer_policy(referrer_policy)
|
||||
.referrer_policy(referrer_policy)
|
||||
.insecure_requests_policy(insecure_requests_policy)
|
||||
.origin(origin);
|
||||
let request = RequestBuilder::new(webview_id, worker_url.clone(), referrer)
|
||||
.destination(Destination::Worker)
|
||||
.mode(RequestMode::SameOrigin)
|
||||
.credentials_mode(CredentialsMode::CredentialsSameOrigin)
|
||||
.parser_metadata(ParserMetadata::NotParserInserted)
|
||||
.use_url_credentials(true)
|
||||
.pipeline_id(Some(pipeline_id))
|
||||
.referrer_policy(referrer_policy)
|
||||
.referrer_policy(referrer_policy)
|
||||
.insecure_requests_policy(insecure_requests_policy)
|
||||
.origin(origin);
|
||||
|
||||
let runtime = unsafe {
|
||||
let task_source = SendableTaskSource {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::cell::Cell;
|
||||
|
||||
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
use bitflags::bitflags;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix, local_name, namespace_url, ns};
|
||||
|
@ -74,7 +74,7 @@ enum ProcessingMode {
|
|||
pub(crate) struct HTMLIFrameElement {
|
||||
htmlelement: HTMLElement,
|
||||
#[no_trace]
|
||||
top_level_browsing_context_id: Cell<Option<TopLevelBrowsingContextId>>,
|
||||
webview_id: Cell<Option<WebViewId>>,
|
||||
#[no_trace]
|
||||
browsing_context_id: Cell<Option<BrowsingContextId>>,
|
||||
#[no_trace]
|
||||
|
@ -143,7 +143,7 @@ impl HTMLIFrameElement {
|
|||
Some(id) => id,
|
||||
};
|
||||
|
||||
let top_level_browsing_context_id = match self.top_level_browsing_context_id() {
|
||||
let webview_id = match self.webview_id() {
|
||||
None => return warn!("Attempted to start a new pipeline on an unattached iframe."),
|
||||
Some(id) => id,
|
||||
};
|
||||
|
@ -188,7 +188,7 @@ impl HTMLIFrameElement {
|
|||
let load_info = IFrameLoadInfo {
|
||||
parent_pipeline_id: window.pipeline_id(),
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
webview_id,
|
||||
new_pipeline_id,
|
||||
is_private: false, // FIXME
|
||||
inherited_secure_context: load_data.inherited_secure_context,
|
||||
|
@ -223,7 +223,7 @@ impl HTMLIFrameElement {
|
|||
parent_info: Some(window.pipeline_id()),
|
||||
new_pipeline_id,
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
webview_id,
|
||||
opener: None,
|
||||
load_data,
|
||||
window_size,
|
||||
|
@ -406,11 +406,10 @@ impl HTMLIFrameElement {
|
|||
Some(document.insecure_requests_policy()),
|
||||
);
|
||||
let browsing_context_id = BrowsingContextId::new();
|
||||
let top_level_browsing_context_id = window.window_proxy().top_level_browsing_context_id();
|
||||
let webview_id = window.window_proxy().webview_id();
|
||||
self.pipeline_id.set(None);
|
||||
self.pending_pipeline_id.set(None);
|
||||
self.top_level_browsing_context_id
|
||||
.set(Some(top_level_browsing_context_id));
|
||||
self.webview_id.set(Some(webview_id));
|
||||
self.browsing_context_id.set(Some(browsing_context_id));
|
||||
self.start_new_pipeline(
|
||||
load_data,
|
||||
|
@ -424,7 +423,7 @@ impl HTMLIFrameElement {
|
|||
self.pipeline_id.set(None);
|
||||
self.pending_pipeline_id.set(None);
|
||||
self.about_blank_pipeline_id.set(None);
|
||||
self.top_level_browsing_context_id.set(None);
|
||||
self.webview_id.set(None);
|
||||
self.browsing_context_id.set(None);
|
||||
}
|
||||
|
||||
|
@ -460,7 +459,7 @@ impl HTMLIFrameElement {
|
|||
HTMLIFrameElement {
|
||||
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
|
||||
browsing_context_id: Cell::new(None),
|
||||
top_level_browsing_context_id: Cell::new(None),
|
||||
webview_id: Cell::new(None),
|
||||
pipeline_id: Cell::new(None),
|
||||
pending_pipeline_id: Cell::new(None),
|
||||
about_blank_pipeline_id: Cell::new(None),
|
||||
|
@ -500,8 +499,8 @@ impl HTMLIFrameElement {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn top_level_browsing_context_id(&self) -> Option<TopLevelBrowsingContextId> {
|
||||
self.top_level_browsing_context_id.get()
|
||||
pub(crate) fn webview_id(&self) -> Option<WebViewId> {
|
||||
self.webview_id.get()
|
||||
}
|
||||
|
||||
pub(crate) fn set_throttled(&self, throttled: bool) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
|
||||
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::local_name;
|
||||
use indexmap::map::IndexMap;
|
||||
|
@ -81,7 +81,7 @@ pub(crate) struct WindowProxy {
|
|||
/// The frame id of the top-level ancestor browsing context.
|
||||
/// In the case that this is a top-level window, this is our id.
|
||||
#[no_trace]
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
webview_id: WebViewId,
|
||||
|
||||
/// The name of the browsing context (sometimes, but not always,
|
||||
/// equal to the name of a container element)
|
||||
|
@ -128,7 +128,7 @@ pub(crate) struct WindowProxy {
|
|||
impl WindowProxy {
|
||||
fn new_inherited(
|
||||
browsing_context_id: BrowsingContextId,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
webview_id: WebViewId,
|
||||
currently_active: Option<PipelineId>,
|
||||
frame_element: Option<&Element>,
|
||||
parent: Option<&WindowProxy>,
|
||||
|
@ -141,7 +141,7 @@ impl WindowProxy {
|
|||
WindowProxy {
|
||||
reflector: Reflector::new(),
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
webview_id,
|
||||
name: DomRefCell::new(name),
|
||||
currently_active: Cell::new(currently_active),
|
||||
discarded: Cell::new(false),
|
||||
|
@ -161,7 +161,7 @@ impl WindowProxy {
|
|||
pub(crate) fn new(
|
||||
window: &Window,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
webview_id: WebViewId,
|
||||
frame_element: Option<&Element>,
|
||||
parent: Option<&WindowProxy>,
|
||||
opener: Option<BrowsingContextId>,
|
||||
|
@ -187,7 +187,7 @@ impl WindowProxy {
|
|||
let current = Some(window.global().pipeline_id());
|
||||
let window_proxy = Box::new(WindowProxy::new_inherited(
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
webview_id,
|
||||
current,
|
||||
frame_element,
|
||||
parent,
|
||||
|
@ -221,7 +221,7 @@ impl WindowProxy {
|
|||
pub(crate) fn new_dissimilar_origin(
|
||||
global_to_clone_from: &GlobalScope,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
webview_id: WebViewId,
|
||||
parent: Option<&WindowProxy>,
|
||||
opener: Option<BrowsingContextId>,
|
||||
creator: CreatorBrowsingContextInfo,
|
||||
|
@ -234,7 +234,7 @@ impl WindowProxy {
|
|||
// Create a new browsing context.
|
||||
let window_proxy = Box::new(WindowProxy::new_inherited(
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
webview_id,
|
||||
None,
|
||||
None,
|
||||
parent,
|
||||
|
@ -322,7 +322,7 @@ impl WindowProxy {
|
|||
parent_info: None,
|
||||
new_pipeline_id: response.new_pipeline_id,
|
||||
browsing_context_id: new_browsing_context_id,
|
||||
top_level_browsing_context_id: response.new_webview_id,
|
||||
webview_id: response.new_webview_id,
|
||||
opener: Some(self.browsing_context_id),
|
||||
load_data,
|
||||
window_size: window.window_size(),
|
||||
|
@ -585,8 +585,8 @@ impl WindowProxy {
|
|||
self.browsing_context_id
|
||||
}
|
||||
|
||||
pub(crate) fn top_level_browsing_context_id(&self) -> TopLevelBrowsingContextId {
|
||||
self.top_level_browsing_context_id
|
||||
pub(crate) fn webview_id(&self) -> WebViewId {
|
||||
self.webview_id
|
||||
}
|
||||
|
||||
pub(crate) fn frame_element(&self) -> Option<&Element> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue