mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add support for Upgrade request to a potentially trustworthy URL. (#34986)
* Add support for Upgrade request to a potentially trustworthy URL. Signed-off-by: Shubham Gupta <shubham13297@gmail.com> * script: Support inheritable insecure request policy in documents and workers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
7b36f2beb3
commit
1e164738d8
57 changed files with 264 additions and 346 deletions
|
@ -48,7 +48,7 @@ use net_traits::filemanager_thread::{
|
|||
};
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use net_traits::policy_container::PolicyContainer;
|
||||
use net_traits::request::{Referrer, RequestBuilder};
|
||||
use net_traits::request::{InsecureRequestsPolicy, Referrer, RequestBuilder};
|
||||
use net_traits::response::HttpsState;
|
||||
use net_traits::{
|
||||
fetch_async, CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend,
|
||||
|
@ -2379,6 +2379,18 @@ impl GlobalScope {
|
|||
self.downcast::<Window>().expect("expected a Window scope")
|
||||
}
|
||||
|
||||
/// Returns a policy that should be used for fetches initiated from this global.
|
||||
pub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.Document().insecure_requests_policy();
|
||||
}
|
||||
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
return worker.insecure_requests_policy();
|
||||
}
|
||||
debug!("unsupported global, defaulting insecure requests policy to DoNotUpgrade");
|
||||
InsecureRequestsPolicy::DoNotUpgrade
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#report-the-error>
|
||||
pub(crate) fn report_an_error(&self, error_info: ErrorInfo, value: HandleValue, can_gc: CanGc) {
|
||||
// Step 1.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue