mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Merge d49689bf09
into 4ae72ecb8e
This commit is contained in:
commit
0b89e23f45
13 changed files with 103 additions and 10 deletions
|
@ -68,6 +68,7 @@ impl DissimilarOriginWindow {
|
|||
global_to_clone_from.wgpu_id_hub(),
|
||||
Some(global_to_clone_from.is_secure_context()),
|
||||
false,
|
||||
global_to_clone_from.registered_protocols().clone(),
|
||||
),
|
||||
window_proxy: Dom::from_ref(window_proxy),
|
||||
location: Default::default(),
|
||||
|
|
|
@ -56,7 +56,7 @@ use net_traits::policy_container::PolicyContainer;
|
|||
use net_traits::request::{InsecureRequestsPolicy, Referrer, RequestBuilder};
|
||||
use net_traits::response::HttpsState;
|
||||
use net_traits::{
|
||||
CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend, ReferrerPolicy,
|
||||
CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend, Protocols, ReferrerPolicy,
|
||||
ResourceThreads, fetch_async,
|
||||
};
|
||||
use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time};
|
||||
|
@ -374,6 +374,11 @@ pub(crate) struct GlobalScope {
|
|||
#[ignore_malloc_size_of = "Rc<T> is hard"]
|
||||
notification_permission_request_callback_map:
|
||||
DomRefCell<HashMap<String, Rc<NotificationPermissionCallback>>>,
|
||||
|
||||
/// Registered custom protocols
|
||||
#[no_trace]
|
||||
#[ignore_malloc_size_of = "Arc"]
|
||||
protocols: Arc<Protocols>,
|
||||
}
|
||||
|
||||
/// A wrapper for glue-code between the ipc router and the event-loop.
|
||||
|
@ -735,6 +740,7 @@ impl GlobalScope {
|
|||
#[cfg(feature = "webgpu")] gpu_id_hub: Arc<IdentityHub>,
|
||||
inherited_secure_context: Option<bool>,
|
||||
unminify_js: bool,
|
||||
protocols: Arc<Protocols>,
|
||||
) -> Self {
|
||||
Self {
|
||||
task_manager: Default::default(),
|
||||
|
@ -779,6 +785,7 @@ impl GlobalScope {
|
|||
byte_length_queuing_strategy_size_function: OnceCell::new(),
|
||||
count_queuing_strategy_size_function: OnceCell::new(),
|
||||
notification_permission_request_callback_map: Default::default(),
|
||||
protocols,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2472,6 +2479,11 @@ impl GlobalScope {
|
|||
&self.creation_url
|
||||
}
|
||||
|
||||
/// Get registered custom protocols
|
||||
pub(crate) fn registered_protocols(&self) -> &Arc<Protocols> {
|
||||
&self.protocols
|
||||
}
|
||||
|
||||
pub(crate) fn image_cache(&self) -> Arc<dyn ImageCache> {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.image_cache();
|
||||
|
@ -3206,7 +3218,7 @@ impl GlobalScope {
|
|||
if creation_url.scheme() == "blob" && Some(true) == self.inherited_secure_context {
|
||||
return true;
|
||||
}
|
||||
return creation_url.is_potentially_trustworthy();
|
||||
return self.protocols.is_url_potentially_trustworthy(creation_url);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
|
|
@ -53,11 +53,11 @@ use js::rust::{
|
|||
};
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
use media::WindowGLContext;
|
||||
use net_traits::ResourceThreads;
|
||||
use net_traits::image_cache::{
|
||||
ImageCache, ImageResponder, ImageResponse, PendingImageId, PendingImageResponse,
|
||||
};
|
||||
use net_traits::storage_thread::StorageType;
|
||||
use net_traits::{Protocols, ResourceThreads};
|
||||
use num_traits::ToPrimitive;
|
||||
use profile_traits::ipc as ProfiledIpc;
|
||||
use profile_traits::mem::ProfilerChan as MemProfilerChan;
|
||||
|
@ -3033,6 +3033,7 @@ impl Window {
|
|||
player_context: WindowGLContext,
|
||||
#[cfg(feature = "webgpu")] gpu_id_hub: Arc<IdentityHub>,
|
||||
inherited_secure_context: Option<bool>,
|
||||
protocols: Arc<Protocols>,
|
||||
) -> DomRoot<Self> {
|
||||
let error_reporter = CSSErrorReporter {
|
||||
pipelineid: pipeline_id,
|
||||
|
@ -3060,6 +3061,7 @@ impl Window {
|
|||
gpu_id_hub,
|
||||
inherited_secure_context,
|
||||
unminify_js,
|
||||
protocols,
|
||||
),
|
||||
script_chan,
|
||||
layout: RefCell::new(layout),
|
||||
|
|
|
@ -86,6 +86,7 @@ pub(crate) fn prepare_workerscope_init(
|
|||
origin: global.origin().immutable().clone(),
|
||||
creation_url: global.creation_url().clone(),
|
||||
inherited_secure_context: Some(global.is_secure_context()),
|
||||
protocols: global.registered_protocols().clone(),
|
||||
};
|
||||
|
||||
init
|
||||
|
@ -158,6 +159,7 @@ impl WorkerGlobalScope {
|
|||
Some(..) => Some(devtools_receiver),
|
||||
None => None,
|
||||
};
|
||||
let protocols = init.protocols;
|
||||
|
||||
Self {
|
||||
globalscope: GlobalScope::new_inherited(
|
||||
|
@ -174,6 +176,7 @@ impl WorkerGlobalScope {
|
|||
gpu_id_hub,
|
||||
init.inherited_secure_context,
|
||||
false,
|
||||
protocols,
|
||||
),
|
||||
worker_id: init.worker_id,
|
||||
worker_name,
|
||||
|
|
|
@ -12,8 +12,8 @@ use dom_struct::dom_struct;
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
use net_traits::ResourceThreads;
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use net_traits::{Protocols, ResourceThreads};
|
||||
use profile_traits::{mem, time};
|
||||
use script_bindings::realms::InRealm;
|
||||
use script_traits::Painter;
|
||||
|
@ -110,6 +110,7 @@ impl WorkletGlobalScope {
|
|||
init.gpu_id_hub.clone(),
|
||||
init.inherited_secure_context,
|
||||
false,
|
||||
init.protocols.clone(),
|
||||
),
|
||||
base_url,
|
||||
to_script_thread_sender: init.to_script_thread_sender.clone(),
|
||||
|
@ -200,6 +201,8 @@ pub(crate) struct WorkletGlobalScopeInit {
|
|||
pub(crate) gpu_id_hub: Arc<IdentityHub>,
|
||||
/// Is considered secure
|
||||
pub(crate) inherited_secure_context: Option<bool>,
|
||||
/// Registered custom protocols
|
||||
pub(crate) protocols: Arc<Protocols>,
|
||||
}
|
||||
|
||||
/// <https://drafts.css-houdini.org/worklets/#worklet-global-scope-type>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue