LibWeb: Enable EXPLICIT_SYMBOL_EXPORT

This commit is contained in:
ayeteadoe 2025-07-19 19:35:33 -07:00 committed by Andrew Kaster
commit 3df8e00d91
Notes: github-actions[bot] 2025-08-23 22:05:58 +00:00
256 changed files with 728 additions and 512 deletions

View file

@ -7,13 +7,14 @@
#pragma once
#include <LibJS/Script.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Scripting/Script.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#classic-script
class ClassicScript final : public Script {
class WEB_API ClassicScript final : public Script {
GC_CELL(ClassicScript, Script);
GC_DECLARE_ALLOCATOR(ClassicScript);

View file

@ -6,13 +6,14 @@
#pragma once
#include <LibWeb/Export.h>
#include <LibWeb/HTML/PolicyContainers.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
namespace Web::HTML {
class EnvironmentSettingsSnapshot final
class WEB_API EnvironmentSettingsSnapshot final
: public EnvironmentSettingsObject {
GC_CELL(EnvironmentSettingsSnapshot, EnvironmentSettingsObject);
GC_DECLARE_ALLOCATOR(EnvironmentSettingsSnapshot);

View file

@ -11,6 +11,7 @@
#include <LibJS/Forward.h>
#include <LibURL/Origin.h>
#include <LibURL/URL.h>
#include <LibWeb/Export.h>
#include <LibWeb/Fetch/Infrastructure/FetchRecord.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
@ -21,7 +22,7 @@
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#environment
struct Environment : public JS::Cell {
struct WEB_API Environment : public JS::Cell {
GC_CELL(Environment, JS::Cell);
public:
@ -73,7 +74,7 @@ enum class RunScriptDecision {
};
// https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
struct EnvironmentSettingsObject : public Environment {
struct WEB_API EnvironmentSettingsObject : public Environment {
GC_CELL(EnvironmentSettingsObject, Environment);
public:
@ -179,38 +180,38 @@ bool is_scripting_enabled(JS::Realm const&);
bool is_scripting_disabled(JS::Realm const&);
void prepare_to_run_script(JS::Realm&);
void clean_up_after_running_script(JS::Realm const&);
void prepare_to_run_callback(JS::Realm&);
void clean_up_after_running_callback(JS::Realm const&);
ModuleMap& module_map_of_realm(JS::Realm&);
bool module_type_allowed(JS::Realm const&, StringView module_type);
WEB_API void prepare_to_run_callback(JS::Realm&);
WEB_API void clean_up_after_running_callback(JS::Realm const&);
WEB_API ModuleMap& module_map_of_realm(JS::Realm&);
WEB_API bool module_type_allowed(JS::Realm const&, StringView module_type);
void add_module_to_resolved_module_set(JS::Realm&, String const& serialized_base_url, String const& normalized_specifier, Optional<URL::URL> const& as_url);
WEB_API void add_module_to_resolved_module_set(JS::Realm&, String const& serialized_base_url, String const& normalized_specifier, Optional<URL::URL> const& as_url);
EnvironmentSettingsObject& incumbent_settings_object();
JS::Realm& incumbent_realm();
WEB_API JS::Realm& incumbent_realm();
JS::Object& incumbent_global_object();
JS::Realm& current_principal_realm();
EnvironmentSettingsObject& principal_realm_settings_object(JS::Realm&);
EnvironmentSettingsObject& current_principal_settings_object();
JS::Realm& principal_realm(GC::Ref<JS::Realm>);
JS::Object& current_principal_global_object();
WEB_API JS::Realm& principal_realm(GC::Ref<JS::Realm>);
WEB_API JS::Object& current_principal_global_object();
JS::Realm& relevant_realm(JS::Object const&);
WEB_API JS::Realm& relevant_realm(JS::Object const&);
JS::Realm& relevant_principal_realm(JS::Object const&);
EnvironmentSettingsObject& relevant_settings_object(JS::Object const&);
WEB_API EnvironmentSettingsObject& relevant_settings_object(JS::Object const&);
EnvironmentSettingsObject& relevant_settings_object(DOM::Node const&);
EnvironmentSettingsObject& relevant_principal_settings_object(JS::Object const&);
WEB_API EnvironmentSettingsObject& relevant_principal_settings_object(JS::Object const&);
JS::Object& relevant_global_object(JS::Object const&);
JS::Object& relevant_principal_global_object(JS::Object const&);
WEB_API JS::Object& relevant_global_object(JS::Object const&);
WEB_API JS::Object& relevant_principal_global_object(JS::Object const&);
JS::Realm& entry_realm();
EnvironmentSettingsObject& entry_settings_object();
JS::Object& entry_global_object();
[[nodiscard]] bool is_secure_context(Environment const&);
[[nodiscard]] WEB_API bool is_secure_context(Environment const&);
[[nodiscard]] bool is_non_secure_context(Environment const&);
}

View file

@ -7,6 +7,7 @@
#pragma once
#include <LibJS/Forward.h>
#include <LibWeb/Export.h>
namespace Web::HTML {
@ -16,7 +17,7 @@ enum class ErrorInPromise {
};
void report_exception_to_console(JS::Value, JS::Realm&, ErrorInPromise);
void report_exception(JS::Completion const&, JS::Realm&);
WEB_API void report_exception(JS::Completion const&, JS::Realm&);
template<typename T>
inline void report_exception(JS::ThrowCompletionOr<T> const& result, JS::Realm& realm)

View file

@ -6,6 +6,7 @@
#pragma once
#include <LibWeb/Export.h>
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
#include <LibWeb/HTML/CORSSettingAttribute.h>
@ -24,8 +25,8 @@ enum class TopLevelModule {
using OnFetchScriptComplete = GC::Ref<GC::Function<void(GC::Ptr<Script>)>>;
using PerformTheFetchHook = GC::Ptr<GC::Function<WebIDL::ExceptionOr<void>(GC::Ref<Fetch::Infrastructure::Request>, TopLevelModule, Fetch::Infrastructure::FetchAlgorithms::ProcessResponseConsumeBodyFunction)>>;
OnFetchScriptComplete create_on_fetch_script_complete(GC::Heap& heap, Function<void(GC::Ptr<Script>)> function);
PerformTheFetchHook create_perform_the_fetch_hook(GC::Heap& heap, Function<WebIDL::ExceptionOr<void>(GC::Ref<Fetch::Infrastructure::Request>, TopLevelModule, Fetch::Infrastructure::FetchAlgorithms::ProcessResponseConsumeBodyFunction)> function);
WEB_API OnFetchScriptComplete create_on_fetch_script_complete(GC::Heap& heap, Function<void(GC::Ptr<Script>)> function);
WEB_API PerformTheFetchHook create_perform_the_fetch_hook(GC::Heap& heap, Function<WebIDL::ExceptionOr<void>(GC::Ref<Fetch::Infrastructure::Request>, TopLevelModule, Fetch::Infrastructure::FetchAlgorithms::ProcessResponseConsumeBodyFunction)> function);
// https://html.spec.whatwg.org/multipage/webappapis.html#script-fetch-options
struct ScriptFetchOptions {
@ -89,9 +90,9 @@ Optional<URL::URL> resolve_url_like_module_specifier(StringView specifier, URL::
ScriptFetchOptions get_descendant_script_fetch_options(ScriptFetchOptions const& original_options, URL::URL const& url, EnvironmentSettingsObject& settings_object);
String resolve_a_module_integrity_metadata(URL::URL const& url, EnvironmentSettingsObject& settings_object);
WebIDL::ExceptionOr<void> fetch_classic_script(GC::Ref<HTMLScriptElement>, URL::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete);
WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
WEB_API WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
WebIDL::ExceptionOr<GC::Ref<ClassicScript>> fetch_a_classic_worker_imported_script(URL::URL const&, HTML::EnvironmentSettingsObject&, PerformTheFetchHook = nullptr);
WebIDL::ExceptionOr<void> fetch_module_worker_script_graph(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
WEB_API WebIDL::ExceptionOr<void> fetch_module_worker_script_graph(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
WebIDL::ExceptionOr<void> fetch_worklet_module_worker_script_graph(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
void fetch_external_module_script_graph(JS::Realm&, URL::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const&, OnFetchScriptComplete on_complete);
void fetch_inline_module_script_graph(JS::Realm&, ByteString const& filename, ByteString const& source_text, URL::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete);

View file

@ -9,6 +9,7 @@
#include <LibGC/Function.h>
#include <LibJS/Heap/Cell.h>
#include <LibURL/URL.h>
#include <LibWeb/Export.h>
#include <LibWeb/HTML/Scripting/ModuleScript.h>
namespace Web::HTML {
@ -35,7 +36,7 @@ private:
};
// https://html.spec.whatwg.org/multipage/webappapis.html#module-map
class ModuleMap final : public JS::Cell {
class WEB_API ModuleMap final : public JS::Cell {
GC_CELL(ModuleMap, JS::Cell);
GC_DECLARE_ALLOCATOR(ModuleMap);

View file

@ -7,6 +7,7 @@
#pragma once
#include <LibJS/SourceTextModule.h>
#include <LibWeb/Export.h>
#include <LibWeb/HTML/Scripting/Script.h>
namespace Web::HTML {
@ -25,7 +26,7 @@ private:
virtual bool is_module_script() const final { return true; }
};
class JavaScriptModuleScript final : public ModuleScript {
class WEB_API JavaScriptModuleScript final : public ModuleScript {
GC_CELL(JavaScriptModuleScript, ModuleScript);
GC_DECLARE_ALLOCATOR(JavaScriptModuleScript);

View file

@ -9,13 +9,14 @@
#include <LibJS/Heap/Cell.h>
#include <LibJS/Script.h>
#include <LibURL/URL.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script
// https://whatpr.org/html/9893/webappapis.html#concept-script
class Script
class WEB_API Script
: public JS::Cell
, public JS::Script::HostDefined {
GC_CELL(Script, JS::Cell);

View file

@ -10,6 +10,7 @@
#include <LibIPC/Forward.h>
#include <LibURL/Origin.h>
#include <LibURL/URL.h>
#include <LibWeb/Export.h>
#include <LibWeb/HTML/SerializedPolicyContainer.h>
namespace Web::HTML {
@ -39,9 +40,9 @@ struct SerializedEnvironmentSettingsObject {
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Web::HTML::SerializedEnvironmentSettingsObject const&);
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SerializedEnvironmentSettingsObject const&);
template<>
ErrorOr<Web::HTML::SerializedEnvironmentSettingsObject> decode(Decoder&);
WEB_API ErrorOr<Web::HTML::SerializedEnvironmentSettingsObject> decode(Decoder&);
}

View file

@ -12,6 +12,7 @@
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Agent.h>
#include <LibWeb/DOM/MutationObserver.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/CustomElements/CustomElementReactionsStack.h>
#include <LibWeb/HTML/Scripting/Agent.h>
@ -50,6 +51,6 @@ private:
}
};
SimilarOriginWindowAgent& relevant_similar_origin_window_agent(JS::Object const&);
WEB_API SimilarOriginWindowAgent& relevant_similar_origin_window_agent(JS::Object const&);
}

View file

@ -7,14 +7,14 @@
#pragma once
#include <LibGC/Ptr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Export.h>
namespace Web::HTML {
// When JS is run from outside the context of any user script, we currently do not have a running execution context.
// This results in a crash when we access VM::running_execution_context(). This is a spec issue. Until it is resolved,
// this is a workaround to temporarily push an execution context.
class [[nodiscard]] TemporaryExecutionContext {
class [[nodiscard]] WEB_API TemporaryExecutionContext {
public:
enum class CallbacksEnabled {
No,

View file

@ -8,11 +8,12 @@
#include <LibURL/URL.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
class WorkerEnvironmentSettingsObject final
class WEB_API WorkerEnvironmentSettingsObject final
: public EnvironmentSettingsObject {
GC_CELL(WorkerEnvironmentSettingsObject, EnvironmentSettingsObject);
GC_DECLARE_ALLOCATOR(WorkerEnvironmentSettingsObject);