ladybird/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
Andreas Kling cc4b3cbacc
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Meta: Update my e-mail address everywhere
2024-10-04 13:19:50 +02:00

56 lines
1.6 KiB
C++

/*
* Copyright (c) 2021-2023, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Heap/Cell.h>
#include <LibJS/Script.h>
#include <LibURL/URL.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script
class Script
: public JS::Cell
, public JS::Script::HostDefined {
JS_CELL(Script, JS::Cell);
JS_DECLARE_ALLOCATOR(Script);
public:
virtual ~Script() override;
URL::URL const& base_url() const { return m_base_url; }
ByteString const& filename() const { return m_filename; }
EnvironmentSettingsObject& settings_object() { return m_settings_object; }
[[nodiscard]] JS::Value error_to_rethrow() const { return m_error_to_rethrow; }
void set_error_to_rethrow(JS::Value value) { m_error_to_rethrow = value; }
[[nodiscard]] JS::Value parse_error() const { return m_parse_error; }
void set_parse_error(JS::Value value) { m_parse_error = value; }
protected:
Script(URL::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Visitor&) override;
private:
virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
URL::URL m_base_url;
ByteString m_filename;
JS::NonnullGCPtr<EnvironmentSettingsObject> m_settings_object;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-parse-error
JS::Value m_parse_error;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-error-to-rethrow
JS::Value m_error_to_rethrow;
};
}