mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Make XMLSerializer GC-allocated
This commit is contained in:
parent
6b7a1d13e9
commit
233208b640
Notes:
sideshowbarker
2024-07-17 17:49:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/233208b640 Pull-request: https://github.com/SerenityOS/serenity/pull/14816 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg ✅
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/XMLSerializerPrototype.h>
|
||||
#include <LibWeb/DOM/CDATASection.h>
|
||||
#include <LibWeb/DOM/Comment.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
@ -20,7 +21,17 @@
|
||||
|
||||
namespace Web::DOMParsing {
|
||||
|
||||
XMLSerializer::XMLSerializer() = default;
|
||||
JS::NonnullGCPtr<XMLSerializer> XMLSerializer::create_with_global_object(HTML::Window& window)
|
||||
{
|
||||
return *window.heap().allocate<XMLSerializer>(window.realm(), window);
|
||||
}
|
||||
|
||||
XMLSerializer::XMLSerializer(HTML::Window& window)
|
||||
: PlatformObject(window.realm())
|
||||
{
|
||||
set_prototype(&window.ensure_web_prototype<Bindings::XMLSerializerPrototype>("XMLSerializer"));
|
||||
}
|
||||
|
||||
XMLSerializer::~XMLSerializer() = default;
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dom-xmlserializer-serializetostring
|
||||
|
@ -6,29 +6,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
namespace Web::DOMParsing {
|
||||
|
||||
class XMLSerializer final
|
||||
: public RefCounted<XMLSerializer>
|
||||
, public Bindings::Wrappable {
|
||||
public:
|
||||
using WrapperType = Bindings::XMLSerializerWrapper;
|
||||
class XMLSerializer final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(XMLSerializer, Bindings::PlatformObject);
|
||||
|
||||
static NonnullRefPtr<XMLSerializer> create_with_global_object(HTML::Window&)
|
||||
{
|
||||
return adopt_ref(*new XMLSerializer());
|
||||
}
|
||||
public:
|
||||
static JS::NonnullGCPtr<XMLSerializer> create_with_global_object(HTML::Window&);
|
||||
|
||||
virtual ~XMLSerializer() override;
|
||||
|
||||
DOM::ExceptionOr<String> serialize_to_string(JS::NonnullGCPtr<DOM::Node> root);
|
||||
|
||||
private:
|
||||
XMLSerializer();
|
||||
explicit XMLSerializer(HTML::Window&);
|
||||
};
|
||||
|
||||
enum class RequireWellFormed {
|
||||
@ -39,3 +32,5 @@ enum class RequireWellFormed {
|
||||
DOM::ExceptionOr<String> serialize_node_to_xml_string(JS::NonnullGCPtr<DOM::Node> root, RequireWellFormed require_well_formed);
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(XMLSerializer, Web::DOMParsing)
|
||||
|
@ -479,7 +479,6 @@ class WorkerNavigatorWrapper;
|
||||
class Wrappable;
|
||||
class Wrapper;
|
||||
class XMLHttpRequestPrototype;
|
||||
class XMLSerializerWrapper;
|
||||
enum class CanPlayTypeResult;
|
||||
enum class CanvasFillRule;
|
||||
enum class EndingType;
|
||||
|
@ -50,7 +50,7 @@ libweb_js_wrapper(DOM/ShadowRoot NO_INSTANCE)
|
||||
libweb_js_wrapper(DOM/StaticRange NO_INSTANCE)
|
||||
libweb_js_wrapper(DOM/Text NO_INSTANCE)
|
||||
libweb_js_wrapper(DOM/TreeWalker NO_INSTANCE)
|
||||
libweb_js_wrapper(DOMParsing/XMLSerializer)
|
||||
libweb_js_wrapper(DOMParsing/XMLSerializer NO_INSTANCE)
|
||||
libweb_js_wrapper(Encoding/TextDecoder)
|
||||
libweb_js_wrapper(Encoding/TextEncoder)
|
||||
libweb_js_wrapper(Fetch/Headers ITERABLE)
|
||||
|
Loading…
Reference in New Issue
Block a user