mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
db2ba5f1d9
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().
29 lines
885 B
C++
29 lines
885 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/DeprecatedFlyString.h>
|
|
#include <AK/Error.h>
|
|
|
|
namespace Web::Namespace {
|
|
|
|
#define ENUMERATE_NAMESPACES \
|
|
__ENUMERATE_NAMESPACE(HTML, "http://www.w3.org/1999/xhtml") \
|
|
__ENUMERATE_NAMESPACE(MathML, "http://www.w3.org/1998/Math/MathML") \
|
|
__ENUMERATE_NAMESPACE(SVG, "http://www.w3.org/2000/svg") \
|
|
__ENUMERATE_NAMESPACE(XLink, "http://www.w3.org/1999/xlink") \
|
|
__ENUMERATE_NAMESPACE(XML, "http://www.w3.org/XML/1998/namespace") \
|
|
__ENUMERATE_NAMESPACE(XMLNS, "http://www.w3.org/2000/xmlns/")
|
|
|
|
#define __ENUMERATE_NAMESPACE(name, namespace_) extern DeprecatedFlyString name;
|
|
ENUMERATE_NAMESPACES
|
|
#undef __ENUMERATE_NAMESPACE
|
|
|
|
ErrorOr<void> initialize_strings();
|
|
|
|
}
|