mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Include WebViewId
into EmbedderMsg variants where possible (#35211)
`EmbedderMsg` was previously paired with an implicit `Option<WebViewId>`, even though almost all variants were either always `Some` or always `None`, depending on whether there was a `WebView involved. This patch adds the `WebViewId` to as many `EmbedderMsg` variants as possible, so we can call their associated `WebView` delegate methods without needing to check and unwrap the `Option`. In many cases, this required more changes to plumb through the `WebViewId`. Notably, all `Request`s now explicitly need a `WebView` or not, in order to ensure that it is passed when appropriate. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
9eeb602f7a
commit
5e9de2cb61
70 changed files with 809 additions and 753 deletions
|
@ -11,7 +11,7 @@ use std::ptr;
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use base::id::PipelineId;
|
||||
use base::id::{PipelineId, WebViewId};
|
||||
use content_security_policy as csp;
|
||||
use dom_struct::dom_struct;
|
||||
use encoding_rs::Encoding;
|
||||
|
@ -542,6 +542,7 @@ impl PreInvoke for ClassicContext {}
|
|||
/// Steps 1-2 of <https://html.spec.whatwg.org/multipage/#fetch-a-classic-script>
|
||||
// This function is also used to prefetch a script in `script::dom::servoparser::prefetch`.
|
||||
pub(crate) fn script_fetch_request(
|
||||
webview_id: WebViewId,
|
||||
url: ServoUrl,
|
||||
cors_setting: Option<CorsSettings>,
|
||||
origin: ImmutableOrigin,
|
||||
|
@ -551,6 +552,7 @@ pub(crate) fn script_fetch_request(
|
|||
// We intentionally ignore options' credentials_mode member for classic scripts.
|
||||
// The mode is initialized by create_a_potential_cors_request.
|
||||
create_a_potential_cors_request(
|
||||
Some(webview_id),
|
||||
url,
|
||||
Destination::Script,
|
||||
cors_setting,
|
||||
|
@ -576,6 +578,7 @@ fn fetch_a_classic_script(
|
|||
// Step 1, 2.
|
||||
let doc = script.owner_document();
|
||||
let request = script_fetch_request(
|
||||
doc.webview_id(),
|
||||
url.clone(),
|
||||
cors_setting,
|
||||
doc.origin().immutable().clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue