[WebDriver] Grant top_level_script_command and browsing_context_script_command freedom to not verify existence of pipeline (#37632)

Sometimes, it is redundant to verify existence of pipeline over and over
again.
Sometimes, it is just wrong to check it. See [Switch to Parent
Frame](https://w3c.github.io/webdriver/#switch-to-parent-frame), where
we only care about existence of parent frame.
1. This PR adds a constant compile-time bool flag to enable this. This
will be essential to fix "no_browsing_context" next.
2. Fix some wrong usage of `top_level_script_command` in `is_selected`
and `is_enabled`.
3. Add and unify some WARN info related to pipeline in Constellation

Testing: All WebDriver test with new passing cases

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-06-24 14:42:34 +08:00 committed by GitHub
parent e0f3679d55
commit 94a7428912
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 65 additions and 65 deletions

View file

@ -3137,7 +3137,10 @@ where
.send(EmbedderMsg::WebViewClosed(webview_id));
let Some(browsing_context) = browsing_context else {
return;
return warn!(
"fn handle_close_top_level_browsing_context {}: Closing twice",
browsing_context_id
);
};
// https://html.spec.whatwg.org/multipage/#bcg-remove
let bc_group_id = browsing_context.bc_group_id;
@ -5523,7 +5526,7 @@ where
let browsing_context = match self.browsing_contexts.remove(&browsing_context_id) {
Some(ctx) => ctx,
None => {
warn!("{browsing_context_id}: Closing twice");
warn!("fn close_browsing_context: {browsing_context_id}: Closing twice");
return None;
},
};
@ -5679,7 +5682,7 @@ where
// the pipeline.
let pipeline = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline,
None => return warn!("{}: Closing twice", pipeline_id),
None => return warn!("fn close_pipeline: {pipeline_id}: Closing twice"),
};
// Remove this pipeline from pending changes if it hasn't loaded yet.