2021-09-09 13:03:01 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2021-2023, Andreas Kling <andreas@ladybird.org>
|
2021-09-09 13:03:01 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2023-02-25 14:42:45 -03:00
|
|
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
2021-09-09 13:03:01 -03:00
|
|
|
#include <LibWeb/HTML/Scripting/Script.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(Script);
|
2023-11-19 15:47:52 -03:00
|
|
|
|
2026-04-03 13:12:46 -03:00
|
|
|
Script::Script(Optional<URL::URL> base_url, ByteString filename, EnvironmentSettingsObject& settings)
|
2021-09-09 13:03:01 -03:00
|
|
|
: m_base_url(move(base_url))
|
Libraries: Clean up UTF-16 source text paths
Store parser errors, source range filenames, source code filenames,
module source, and Rust parser errors as UTF-16 where they flow back
into JavaScript-visible strings. Keep byte-oriented source buffers
byte-backed.
Remove temporary PrimitiveString, ByteString, and UTF-8 detours from
JSON, RegExp, module debug logging, print formatting, and tests.
2026-06-21 14:03:19 -03:00
|
|
|
, m_filename(filename)
|
|
|
|
|
, m_display_filename(Utf16String::from_utf8(filename))
|
2026-04-03 13:12:46 -03:00
|
|
|
, m_settings(settings)
|
2021-09-09 13:03:01 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 16:21:51 -03:00
|
|
|
Script::~Script() = default;
|
2021-09-09 13:03:01 -03:00
|
|
|
|
2024-10-25 00:27:26 -03:00
|
|
|
EnvironmentSettingsObject& Script::settings_object()
|
|
|
|
|
{
|
2026-04-03 13:12:46 -03:00
|
|
|
return m_settings;
|
2024-10-25 00:27:26 -03:00
|
|
|
}
|
|
|
|
|
|
2022-10-02 18:17:33 -03:00
|
|
|
void Script::visit_host_defined_self(JS::Cell::Visitor& visitor)
|
|
|
|
|
{
|
2023-11-19 00:18:00 -03:00
|
|
|
visitor.visit(*this);
|
2022-10-02 18:17:33 -03:00
|
|
|
}
|
|
|
|
|
|
2023-05-18 14:05:56 -03:00
|
|
|
void Script::visit_edges(Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
2026-04-03 13:12:46 -03:00
|
|
|
visitor.visit(m_settings);
|
2023-05-18 14:05:56 -03:00
|
|
|
visitor.visit(m_parse_error);
|
|
|
|
|
visitor.visit(m_error_to_rethrow);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 13:03:01 -03:00
|
|
|
}
|