1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:27:45 +00:00

LibWeb: Update "has style sheet that blocking scripts" for navigables

This commit is contained in:
Aliaksandr Kalenik 2023-09-04 15:53:19 +02:00 committed by Andreas Kling
parent 1f2ed7effc
commit 57e53fa844

View file

@ -1995,15 +1995,23 @@ DeprecatedString Document::dump_dom_tree_as_json() const
// https://html.spec.whatwg.org/multipage/semantics.html#has-a-style-sheet-that-is-blocking-scripts // https://html.spec.whatwg.org/multipage/semantics.html#has-a-style-sheet-that-is-blocking-scripts
bool Document::has_a_style_sheet_that_is_blocking_scripts() const bool Document::has_a_style_sheet_that_is_blocking_scripts() const
{ {
// A Document has a style sheet that is blocking scripts if its script-blocking style sheet counter is greater than 0, // FIXME: 1. If document's script-blocking style sheet set is not empty, then return true.
if (m_script_blocking_style_sheet_counter > 0) if (m_script_blocking_style_sheet_counter > 0)
return true; return true;
// ...or if that Document has a non-null browsing context whose container document is non-null and has a script-blocking style sheet counter greater than 0. // 2. If document's node navigable is null, then return false.
if (!browsing_context() || !browsing_context()->container_document()) if (!navigable())
return false; return false;
return browsing_context()->container_document()->m_script_blocking_style_sheet_counter > 0; // 3. Let containerDocument be document's node navigable's container document.
auto container_document = navigable()->container_document();
// FIXME: 4. If containerDocument is non-null and containerDocument's script-blocking style sheet set is not empty, then return true.
if (container_document && container_document->m_script_blocking_style_sheet_counter > 0)
return true;
// 5. Return false
return false;
} }
DeprecatedString Document::referrer() const DeprecatedString Document::referrer() const