script: Do not unnecessary clone CSP list in Document::get_csp_list (#42716)

We previously clonsed the CSP list unnecessarily which consisted of
roughly 2.7%. 1.2% spend in Document::get_csp_list.
We can easily avoid it with Ref and cloning it deliberately when needed.

Testing: This is functionally identical to the previous code as it is a
change from clone to a Ref<>.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger
2026-02-23 20:49:58 +09:00
committed by GitHub
parent 158742f72c
commit c6a5eb584a
3 changed files with 7 additions and 7 deletions

View File

@@ -547,7 +547,7 @@ impl WindowProxy {
target_window.as_global_scope().get_referrer()
};
// Propagate CSP list and about-base-url from opener to new document
let csp_list = existing_document.get_csp_list();
let csp_list = existing_document.get_csp_list().clone();
target_document.set_csp_list(csp_list);
// Step 15.5 Otherwise, navigate targetNavigable to urlRecord using sourceDocument,