summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Namespace.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-03-18 10:39:37 -0400
committerJelle Raaijmakers <jelle@gmta.nl>2023-03-18 19:50:45 +0100
commitdb2ba5f1d9234b51a547ce01c3da8ecd5006ee87 (patch)
treef373c2bbafe8b1f52724eec7b90ad42883537e53 /Userland/Libraries/LibWeb/Namespace.h
parent0d0b87fd46453e533e6f73a7fd3c13fc9655e85c (diff)
downloadserenity-db2ba5f1d9234b51a547ce01c3da8ecd5006ee87.zip
LibWeb: Initialize static web strings during main-thread VM creation
These are currently initialized in a [[gnu::constructor]], which has a weird initialization order. These constructors are invoked before main() and, incidentally, before any user-defined default constructors of the static strings they are initializing. This will become an issue when these strings are ported to FlyString, which has a user-defined default constructor. In that scenario, when the FlyString constructor is executed after the [[gnu::constructor]], the strings will be "reset" to the empty string. Instead of relying on a non-standard compiler extension here, let's just initialize these strings explicitly during main-thread VM creation, as this now happens in WebContent's main().
Diffstat (limited to 'Userland/Libraries/LibWeb/Namespace.h')
-rw-r--r--Userland/Libraries/LibWeb/Namespace.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Namespace.h b/Userland/Libraries/LibWeb/Namespace.h
index 330663dfbf..ea13e25874 100644
--- a/Userland/Libraries/LibWeb/Namespace.h
+++ b/Userland/Libraries/LibWeb/Namespace.h
@@ -7,6 +7,7 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
+#include <AK/Error.h>
namespace Web::Namespace {
@@ -22,4 +23,6 @@ namespace Web::Namespace {
ENUMERATE_NAMESPACES
#undef __ENUMERATE_NAMESPACE
+ErrorOr<void> initialize_strings();
+
}