mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 15:42:07 +00:00
LibWeb: Implement the "error to rethrow" mechanism in HTML::Script
This allows JS module loads to fail and throw without crashing the WebContent process due to a TODO() assertion.
This commit is contained in:
parent
2959c2f2eb
commit
819fb39a87
6 changed files with 47 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -27,15 +27,29 @@ public:
|
|||
|
||||
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(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
|
||||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
|
||||
|
||||
AK::URL m_base_url;
|
||||
DeprecatedString 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue