LibWeb: Handle JavaScript source code with non-UTF-8 encoding

When fetching scripts in HTMLScriptElement's "prepare a script"
algorithm, we now re-encode the script sources to UTF-8.
This commit is contained in:
Andreas Kling 2022-09-17 17:44:11 +02:00
parent da451467b1
commit 83c69fa62e
Notes: sideshowbarker 2024-07-17 06:54:10 +09:00
2 changed files with 37 additions and 22 deletions

View file

@ -13,7 +13,9 @@
namespace Web::HTML {
class HTMLScriptElement final : public HTMLElement {
class HTMLScriptElement final
: public HTMLElement
, public ResourceClient {
WEB_PLATFORM_OBJECT(HTMLScriptElement, HTMLElement);
public:
@ -49,9 +51,12 @@ public:
void set_source_line_number(Badge<HTMLParser>, size_t source_line_number) { m_source_line_number = source_line_number; }
private:
public:
HTMLScriptElement(DOM::Document&, DOM::QualifiedName);
virtual void resource_did_load() override;
virtual void resource_did_fail() override;
virtual void visit_edges(Cell::Visitor&) override;
void prepare_script();