From 834202aeb9a47c544ab4e61deb813de50bc03946 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 10 Jan 2023 06:28:20 -0500 Subject: [PATCH] LibWeb: Move setting of Web object prototypes to initialize() This needs to happen before prototype/constructor intitialization can be made lazy. Otherwise, GC could run during the C++ constructor and try to collect the object currently being created. --- Userland/Libraries/LibWeb/Bindings/LocationObject.cpp | 3 ++- Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp | 7 ++++++- Userland/Libraries/LibWeb/CSS/CSSConditionRule.h | 2 ++ Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp | 5 +++++ Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.h | 1 + Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp | 7 ++++++- Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h | 2 ++ Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp | 8 ++++++-- Userland/Libraries/LibWeb/CSS/CSSImportRule.h | 1 + Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp | 5 +++++ Userland/Libraries/LibWeb/CSS/CSSMediaRule.h | 1 + Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp | 5 +++++ Userland/Libraries/LibWeb/CSS/CSSStyleRule.h | 1 + Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp | 8 ++++++-- Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h | 1 + Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp | 5 +++++ Userland/Libraries/LibWeb/CSS/CSSSupportsRule.h | 1 + Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp | 7 ++++++- Userland/Libraries/LibWeb/CSS/MediaQueryList.h | 1 + Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.h | 2 ++ Userland/Libraries/LibWeb/CSS/Screen.cpp | 7 ++++++- Userland/Libraries/LibWeb/CSS/Screen.h | 1 + Userland/Libraries/LibWeb/Crypto/Crypto.cpp | 2 +- Userland/Libraries/LibWeb/Crypto/Crypto.h | 2 +- Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp | 7 ++++++- Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h | 1 + Userland/Libraries/LibWeb/DOM/AbortController.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/AbortController.h | 1 + Userland/Libraries/LibWeb/DOM/AbortSignal.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/AbortSignal.h | 1 + Userland/Libraries/LibWeb/DOM/Attr.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/Attr.h | 1 + Userland/Libraries/LibWeb/DOM/CDATASection.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/CDATASection.h | 2 ++ Userland/Libraries/LibWeb/DOM/CharacterData.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/CharacterData.h | 2 ++ Userland/Libraries/LibWeb/DOM/CustomEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/CustomEvent.h | 1 + Userland/Libraries/LibWeb/DOM/Document.cpp | 8 ++++++-- Userland/Libraries/LibWeb/DOM/Document.h | 1 + Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/DocumentFragment.h | 1 + Userland/Libraries/LibWeb/DOM/DocumentType.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/DocumentType.h | 2 ++ Userland/Libraries/LibWeb/DOM/Element.cpp | 3 ++- Userland/Libraries/LibWeb/DOM/MutationObserver.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/MutationObserver.h | 3 +++ Userland/Libraries/LibWeb/DOM/MutationRecord.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/MutationRecord.h | 2 ++ Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h | 2 ++ Userland/Libraries/LibWeb/DOM/Range.cpp | 8 ++++++-- Userland/Libraries/LibWeb/DOM/Range.h | 2 ++ Userland/Libraries/LibWeb/DOM/StaticRange.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOM/StaticRange.h | 2 ++ Userland/Libraries/LibWeb/DOM/Text.cpp | 8 ++++++-- Userland/Libraries/LibWeb/DOM/Text.h | 1 + Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp | 7 ++++++- Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h | 2 ++ Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp | 7 ++++++- Userland/Libraries/LibWeb/Encoding/TextDecoder.h | 2 ++ Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp | 7 ++++++- Userland/Libraries/LibWeb/Encoding/TextEncoder.h | 2 ++ Userland/Libraries/LibWeb/Fetch/Headers.cpp | 7 ++++++- Userland/Libraries/LibWeb/Fetch/Headers.h | 1 + Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp | 7 ++++++- Userland/Libraries/LibWeb/Fetch/HeadersIterator.h | 1 + Userland/Libraries/LibWeb/Fetch/Request.cpp | 7 ++++++- Userland/Libraries/LibWeb/Fetch/Request.h | 1 + Userland/Libraries/LibWeb/Fetch/Response.cpp | 7 ++++++- Userland/Libraries/LibWeb/Fetch/Response.h | 1 + Userland/Libraries/LibWeb/FileAPI/Blob.cpp | 9 ++++++--- Userland/Libraries/LibWeb/FileAPI/Blob.h | 2 ++ Userland/Libraries/LibWeb/FileAPI/File.cpp | 7 ++++++- Userland/Libraries/LibWeb/FileAPI/File.h | 2 ++ Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp | 7 ++++++- Userland/Libraries/LibWeb/Geometry/DOMPoint.h | 2 ++ Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp | 7 ++++++- Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h | 2 ++ Userland/Libraries/LibWeb/Geometry/DOMRect.cpp | 7 ++++++- Userland/Libraries/LibWeb/Geometry/DOMRect.h | 2 ++ Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp | 7 ++++++- Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h | 2 ++ Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/CanvasGradient.h | 2 ++ .../Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp | 7 ++++++- .../Libraries/LibWeb/HTML/CanvasRenderingContext2D.h | 1 + Userland/Libraries/LibWeb/HTML/CloseEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/CloseEvent.h | 2 ++ Userland/Libraries/LibWeb/HTML/DOMParser.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/DOMParser.h | 2 ++ Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/ErrorEvent.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLBRElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDListElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDataElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLDivElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLElement.cpp | 3 ++- Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLFontElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLFormElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h | 3 +++ Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLHRElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/HTMLImageElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/HTMLInputElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLLIElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp | 8 +++++++- Userland/Libraries/LibWeb/HTML/HTMLMapElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLModElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLOListElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLParamElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLPreElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h | 1 + .../Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTableElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h | 1 + .../Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp | 3 ++- Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h | 1 + Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLUListElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h | 2 ++ Userland/Libraries/LibWeb/HTML/History.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/History.h | 1 + Userland/Libraries/LibWeb/HTML/ImageData.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/ImageData.h | 1 + Userland/Libraries/LibWeb/HTML/MessageChannel.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/MessageChannel.h | 1 + Userland/Libraries/LibWeb/HTML/MessageEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/MessageEvent.h | 1 + Userland/Libraries/LibWeb/HTML/MessagePort.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/MessagePort.h | 1 + Userland/Libraries/LibWeb/HTML/Navigator.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/Navigator.h | 2 ++ Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h | 2 ++ Userland/Libraries/LibWeb/HTML/Path2D.cpp | 8 ++++++-- Userland/Libraries/LibWeb/HTML/Path2D.h | 2 ++ Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h | 1 + Userland/Libraries/LibWeb/HTML/Storage.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/Storage.h | 2 ++ Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/SubmitEvent.h | 1 + Userland/Libraries/LibWeb/HTML/TextMetrics.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/TextMetrics.h | 2 ++ Userland/Libraries/LibWeb/HTML/Worker.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/Worker.h | 1 + Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp | 7 ++++++- Userland/Libraries/LibWeb/HTML/WorkerNavigator.h | 2 ++ .../Libraries/LibWeb/HighResolutionTime/Performance.cpp | 7 ++++++- .../Libraries/LibWeb/HighResolutionTime/Performance.h | 1 + .../LibWeb/IntersectionObserver/IntersectionObserver.cpp | 7 ++++++- .../LibWeb/IntersectionObserver/IntersectionObserver.h | 2 ++ .../LibWeb/NavigationTiming/PerformanceTiming.cpp | 7 ++++++- .../LibWeb/NavigationTiming/PerformanceTiming.h | 1 + .../LibWeb/RequestIdleCallback/IdleDeadline.cpp | 7 ++++++- .../Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h | 2 ++ .../Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp | 7 ++++++- .../Libraries/LibWeb/ResizeObserver/ResizeObserver.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp | 8 ++++++-- Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h | 1 + Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGCircleElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGDefsElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGElement.h | 1 + Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h | 2 ++ .../Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp | 2 +- Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGLength.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGLength.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGLineElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGPathElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGRectElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGSVGElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp | 7 ++++++- Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h | 2 ++ Userland/Libraries/LibWeb/Selection/Selection.cpp | 7 ++++++- Userland/Libraries/LibWeb/Selection/Selection.h | 1 + Userland/Libraries/LibWeb/Streams/ReadableStream.cpp | 7 ++++++- Userland/Libraries/LibWeb/Streams/ReadableStream.h | 1 + Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/UIEvents/FocusEvent.h | 2 ++ Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h | 2 ++ Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/UIEvents/MouseEvent.h | 2 ++ Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp | 8 ++++++-- Userland/Libraries/LibWeb/UIEvents/UIEvent.h | 1 + Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/UIEvents/WheelEvent.h | 2 ++ Userland/Libraries/LibWeb/URL/URL.cpp | 7 ++++++- Userland/Libraries/LibWeb/URL/URL.h | 1 + Userland/Libraries/LibWeb/URL/URLSearchParams.cpp | 7 ++++++- Userland/Libraries/LibWeb/URL/URLSearchParams.h | 1 + .../Libraries/LibWeb/URL/URLSearchParamsIterator.cpp | 7 ++++++- Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h | 1 + Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h | 2 ++ .../Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp | 7 ++++++- Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h | 2 ++ Userland/Libraries/LibWeb/WebIDL/DOMException.cpp | 7 ++++++- Userland/Libraries/LibWeb/WebIDL/DOMException.h | 2 ++ Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp | 8 ++++++-- Userland/Libraries/LibWeb/WebSockets/WebSocket.h | 1 + Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp | 7 ++++++- Userland/Libraries/LibWeb/XHR/ProgressEvent.h | 2 ++ Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 7 ++++++- Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h | 1 + 339 files changed, 1294 insertions(+), 187 deletions(-) diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index ae44fe8c33e..a9a65d4940f 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -24,7 +24,6 @@ namespace Web::Bindings { LocationObject::LocationObject(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&cached_web_prototype(realm, "Location")); } LocationObject::~LocationObject() = default; @@ -41,6 +40,8 @@ void LocationObject::initialize(JS::Realm& realm) auto& vm = this->vm(); Object::initialize(realm); + set_prototype(&ensure_web_prototype(realm, "Location")); + u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable; define_native_accessor(realm, "href", href_getter, href_setter, attr); define_native_accessor(realm, "host", host_getter, {}, attr); diff --git a/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp index b6d142d06cf..d3d416fd2c7 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp @@ -14,7 +14,6 @@ namespace Web::CSS { CSSConditionRule::CSSConditionRule(JS::Realm& realm, CSSRuleList& rules) : CSSGroupingRule(realm, rules) { - set_prototype(&Bindings::ensure_web_prototype(realm, "CSSConditionRule")); } void CSSConditionRule::for_each_effective_style_rule(Function const& callback) const @@ -23,4 +22,10 @@ void CSSConditionRule::for_each_effective_style_rule(Function(realm, "CSSConditionRule")); +} + } diff --git a/Userland/Libraries/LibWeb/CSS/CSSConditionRule.h b/Userland/Libraries/LibWeb/CSS/CSSConditionRule.h index ca431328cf9..34b8013d9be 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSConditionRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSConditionRule.h @@ -26,6 +26,8 @@ public: protected: CSSConditionRule(JS::Realm&, CSSRuleList&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp index b4a784d66bc..11dba3358f0 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp @@ -21,6 +21,11 @@ CSSFontFaceRule::CSSFontFaceRule(JS::Realm& realm, FontFace&& font_face) : CSSRule(realm) , m_font_face(move(font_face)) { +} + +void CSSFontFaceRule::initialize(JS::Realm& realm) +{ + Base::initialize(realm); set_prototype(&Bindings::ensure_web_prototype(realm, "CSSFontFaceRule")); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.h b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.h index 6a7d7d3adfa..03e9fcb92bf 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.h @@ -28,6 +28,7 @@ public: private: CSSFontFaceRule(JS::Realm&, FontFace&&); + virtual void initialize(JS::Realm&) override; virtual DeprecatedString serialized() const override; FontFace m_font_face; diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp index 6977aa9ab4a..01d9ef86437 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp @@ -18,11 +18,16 @@ CSSGroupingRule::CSSGroupingRule(JS::Realm& realm, CSSRuleList& rules) : CSSRule(realm) , m_rules(rules) { - set_prototype(&Bindings::ensure_web_prototype(realm, "CSSGroupingRule")); for (auto& rule : m_rules) rule.set_parent_rule(this); } +void CSSGroupingRule::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CSSGroupingRule")); +} + void CSSGroupingRule::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h index 406a0310377..3b77a75457d 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h @@ -32,6 +32,8 @@ public: protected: CSSGroupingRule(JS::Realm&, CSSRuleList&); + + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp index e4ec8b58832..965cc450d34 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp @@ -29,8 +29,6 @@ CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document) , m_url(move(url)) , m_document(document) { - set_prototype(&Bindings::ensure_web_prototype(document.realm(), "CSSImportRule")); - dbgln_if(CSS_LOADER_DEBUG, "CSSImportRule: Loading import URL: {}", m_url); auto request = LoadRequest::create_for_url_on_page(m_url, document.page()); @@ -41,6 +39,12 @@ CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document) set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request)); } +void CSSImportRule::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CSSImportRule")); +} + void CSSImportRule::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h index 9d013690c73..68b87938fdf 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h @@ -40,6 +40,7 @@ public: private: CSSImportRule(AK::URL, DOM::Document&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual DeprecatedString serialized() const override; diff --git a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp index c8393713477..7f8ce6afc91 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp @@ -21,6 +21,11 @@ CSSMediaRule::CSSMediaRule(JS::Realm& realm, MediaList& media, CSSRuleList& rule : CSSConditionRule(realm, rules) , m_media(media) { +} + +void CSSMediaRule::initialize(JS::Realm& realm) +{ + Base::initialize(realm); set_prototype(&Bindings::ensure_web_prototype(realm, "CSSMediaRule")); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h index 3d32120661c..75b4d66857c 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h @@ -35,6 +35,7 @@ public: private: CSSMediaRule(JS::Realm&, MediaList&, CSSRuleList&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual DeprecatedString serialized() const override; diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp index bef547ead4f..ec597f12d6f 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp @@ -21,6 +21,11 @@ CSSStyleRule::CSSStyleRule(JS::Realm& realm, NonnullRefPtrVector&& sel , m_selectors(move(selectors)) , m_declaration(declaration) { +} + +void CSSStyleRule::initialize(JS::Realm& realm) +{ + Base::initialize(realm); set_prototype(&Bindings::ensure_web_prototype(realm, "CSSStyleRule")); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h index fc67a33900e..21b800f4cae 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h @@ -36,6 +36,7 @@ public: private: CSSStyleRule(JS::Realm&, NonnullRefPtrVector&&, CSSStyleDeclaration&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual DeprecatedString serialized() const override; diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp index 92ee1f3fcfe..fd4eec41555 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp @@ -23,8 +23,6 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me : StyleSheet(realm, media) , m_rules(&rules) { - set_prototype(&Bindings::ensure_web_prototype(realm, "CSSStyleSheet")); - if (location.has_value()) set_location(location->to_deprecated_string()); @@ -32,6 +30,12 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me rule.set_parent_style_sheet(this); } +void CSSStyleSheet::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CSSStyleSheet")); +} + void CSSStyleSheet::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h index 58d83138390..747f2549f3e 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h @@ -52,6 +52,7 @@ public: private: CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional location); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; CSSRuleList* m_rules { nullptr }; diff --git a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp index ee5eda4895f..ffcbd1057ef 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp @@ -20,6 +20,11 @@ CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr&& sup : CSSConditionRule(realm, rules) , m_supports(move(supports)) { +} + +void CSSSupportsRule::initialize(JS::Realm& realm) +{ + Base::initialize(realm); set_prototype(&Bindings::ensure_web_prototype(realm, "CSSSupportsRule")); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.h b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.h index 13d6bdda11a..fc91a0af16d 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.h @@ -33,6 +33,7 @@ public: private: CSSSupportsRule(JS::Realm&, NonnullRefPtr&&, CSSRuleList&); + virtual void initialize(JS::Realm&) override; virtual DeprecatedString serialized() const override; NonnullRefPtr m_supports; diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp index 91b2d64c709..be77857aab5 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp @@ -25,10 +25,15 @@ MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector(document.realm(), "MediaQueryList")); evaluate(); } +void MediaQueryList::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MediaQueryList")); +} + void MediaQueryList::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h index 5ad1998993b..12382afe517 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h @@ -34,6 +34,7 @@ public: private: MediaQueryList(DOM::Document&, NonnullRefPtrVector&&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_document; diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp index f33518add55..212790f537b 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp @@ -20,9 +20,14 @@ MediaQueryListEvent::MediaQueryListEvent(JS::Realm& realm, DeprecatedFlyString c , m_media(event_init.media) , m_matches(event_init.matches) { - set_prototype(&Bindings::ensure_web_prototype(realm, "MediaQueryListEvent")); } MediaQueryListEvent::~MediaQueryListEvent() = default; +void MediaQueryListEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MediaQueryListEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.h b/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.h index 8ab1863441f..395f7bf099a 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.h +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.h @@ -29,6 +29,8 @@ public: private: MediaQueryListEvent(JS::Realm&, DeprecatedFlyString const& event_name, MediaQueryListEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + DeprecatedString m_media; bool m_matches; }; diff --git a/Userland/Libraries/LibWeb/CSS/Screen.cpp b/Userland/Libraries/LibWeb/CSS/Screen.cpp index 15762d036bd..f51e5d51e0a 100644 --- a/Userland/Libraries/LibWeb/CSS/Screen.cpp +++ b/Userland/Libraries/LibWeb/CSS/Screen.cpp @@ -22,7 +22,12 @@ Screen::Screen(HTML::Window& window) : PlatformObject(window.realm()) , m_window(window) { - set_prototype(&Bindings::ensure_web_prototype(window.realm(), "Screen")); +} + +void Screen::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Screen")); } void Screen::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/Screen.h b/Userland/Libraries/LibWeb/CSS/Screen.h index d13600933ec..c0ef644c415 100644 --- a/Userland/Libraries/LibWeb/CSS/Screen.h +++ b/Userland/Libraries/LibWeb/CSS/Screen.h @@ -29,6 +29,7 @@ public: private: explicit Screen(HTML::Window&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; HTML::Window const& window() const { return *m_window; } diff --git a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp index 61dde15e80b..453287a78ea 100644 --- a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp @@ -22,7 +22,6 @@ JS::NonnullGCPtr Crypto::create(JS::Realm& realm) Crypto::Crypto(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "Crypto")); } Crypto::~Crypto() = default; @@ -30,6 +29,7 @@ Crypto::~Crypto() = default; void Crypto::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Crypto")); m_subtle = SubtleCrypto::create(realm); } diff --git a/Userland/Libraries/LibWeb/Crypto/Crypto.h b/Userland/Libraries/LibWeb/Crypto/Crypto.h index b1baabdd181..29a4e313e91 100644 --- a/Userland/Libraries/LibWeb/Crypto/Crypto.h +++ b/Userland/Libraries/LibWeb/Crypto/Crypto.h @@ -26,11 +26,11 @@ public: DeprecatedString random_uuid() const; protected: + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: explicit Crypto(JS::Realm&); - virtual void initialize(JS::Realm&) override; JS::GCPtr m_subtle; }; diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 077e48ec83a..a525d8200e0 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -22,11 +22,16 @@ JS::NonnullGCPtr SubtleCrypto::create(JS::Realm& realm) SubtleCrypto::SubtleCrypto(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "SubtleCrypto")); } SubtleCrypto::~SubtleCrypto() = default; +void SubtleCrypto::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SubtleCrypto")); +} + // https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-digest JS::Promise* SubtleCrypto::digest(DeprecatedString const& algorithm, JS::Handle const& data) { diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h index 5fca39d5f81..23a07eb6499 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h @@ -23,6 +23,7 @@ public: private: explicit SubtleCrypto(JS::Realm&); + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/DOM/AbortController.cpp b/Userland/Libraries/LibWeb/DOM/AbortController.cpp index 9764c1586ef..3152d92b72a 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortController.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbortController.cpp @@ -21,11 +21,16 @@ AbortController::AbortController(JS::Realm& realm, JS::NonnullGCPtr : PlatformObject(realm) , m_signal(move(signal)) { - set_prototype(&Bindings::cached_web_prototype(realm, "AbortController")); } AbortController::~AbortController() = default; +void AbortController::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "AbortController")); +} + void AbortController::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/DOM/AbortController.h b/Userland/Libraries/LibWeb/DOM/AbortController.h index 040ed58a2e3..b02bbca182a 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortController.h +++ b/Userland/Libraries/LibWeb/DOM/AbortController.h @@ -28,6 +28,7 @@ public: private: AbortController(JS::Realm&, JS::NonnullGCPtr); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://dom.spec.whatwg.org/#abortcontroller-signal diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp index 24e89a4275d..d49254aa157 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp @@ -20,7 +20,12 @@ JS::NonnullGCPtr AbortSignal::construct_impl(JS::Realm& realm) AbortSignal::AbortSignal(JS::Realm& realm) : EventTarget(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "AbortSignal")); +} + +void AbortSignal::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "AbortSignal")); } // https://dom.spec.whatwg.org/#abortsignal-add diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.h b/Userland/Libraries/LibWeb/DOM/AbortSignal.h index 9020eeeb492..e25557e4df2 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.h +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.h @@ -43,6 +43,7 @@ public: private: explicit AbortSignal(JS::Realm&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(JS::Cell::Visitor&) override; // https://dom.spec.whatwg.org/#abortsignal-abort-reason diff --git a/Userland/Libraries/LibWeb/DOM/Attr.cpp b/Userland/Libraries/LibWeb/DOM/Attr.cpp index b1c81848e6f..c09031cb082 100644 --- a/Userland/Libraries/LibWeb/DOM/Attr.cpp +++ b/Userland/Libraries/LibWeb/DOM/Attr.cpp @@ -29,7 +29,12 @@ Attr::Attr(Document& document, QualifiedName qualified_name, DeprecatedString va , m_value(move(value)) , m_owner_element(owner_element) { - set_prototype(&Bindings::cached_web_prototype(document.realm(), "Attr")); +} + +void Attr::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Attr")); } void Attr::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/Attr.h b/Userland/Libraries/LibWeb/DOM/Attr.h index 3c88b7457c4..ddc81336146 100644 --- a/Userland/Libraries/LibWeb/DOM/Attr.h +++ b/Userland/Libraries/LibWeb/DOM/Attr.h @@ -45,6 +45,7 @@ public: private: Attr(Document&, QualifiedName, DeprecatedString value, Element const*); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; QualifiedName m_qualified_name; diff --git a/Userland/Libraries/LibWeb/DOM/CDATASection.cpp b/Userland/Libraries/LibWeb/DOM/CDATASection.cpp index 35f7dc14b71..d738f2fd4ec 100644 --- a/Userland/Libraries/LibWeb/DOM/CDATASection.cpp +++ b/Userland/Libraries/LibWeb/DOM/CDATASection.cpp @@ -12,9 +12,14 @@ namespace Web::DOM { CDATASection::CDATASection(Document& document, DeprecatedString const& data) : Text(document, NodeType::CDATA_SECTION_NODE, data) { - set_prototype(&Bindings::cached_web_prototype(realm(), "CDATASection")); } CDATASection::~CDATASection() = default; +void CDATASection::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CDATASection")); +} + } diff --git a/Userland/Libraries/LibWeb/DOM/CDATASection.h b/Userland/Libraries/LibWeb/DOM/CDATASection.h index ad338e65ace..148dad1c8d3 100644 --- a/Userland/Libraries/LibWeb/DOM/CDATASection.h +++ b/Userland/Libraries/LibWeb/DOM/CDATASection.h @@ -22,6 +22,8 @@ public: private: CDATASection(Document&, DeprecatedString const&); + + virtual void initialize(JS::Realm&) override; }; template<> diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp index fcd298bd0e0..1a5a6712c75 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp @@ -17,7 +17,12 @@ CharacterData::CharacterData(Document& document, NodeType type, DeprecatedString : Node(document, type) , m_data(data) { - set_prototype(&Bindings::ensure_web_prototype(document.realm(), "CharacterData")); +} + +void CharacterData::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CharacterData")); } // https://dom.spec.whatwg.org/#dom-characterdata-data diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.h b/Userland/Libraries/LibWeb/DOM/CharacterData.h index c5e62411ae8..328a14a0dbe 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.h +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.h @@ -36,6 +36,8 @@ public: protected: CharacterData(Document&, NodeType, DeprecatedString const&); + virtual void initialize(JS::Realm&) override; + private: DeprecatedString m_data; }; diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp b/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp index 9bc3b4c466e..be20d60880a 100644 --- a/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp +++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp @@ -25,11 +25,16 @@ CustomEvent::CustomEvent(JS::Realm& realm, DeprecatedFlyString const& event_name : Event(realm, event_name, event_init) , m_detail(event_init.detail) { - set_prototype(&Bindings::cached_web_prototype(realm, "CustomEvent")); } CustomEvent::~CustomEvent() = default; +void CustomEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CustomEvent")); +} + void CustomEvent::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.h b/Userland/Libraries/LibWeb/DOM/CustomEvent.h index a42f917846a..adab99322e0 100644 --- a/Userland/Libraries/LibWeb/DOM/CustomEvent.h +++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.h @@ -28,6 +28,7 @@ public: // https://dom.spec.whatwg.org/#dom-customevent-detail JS::Value detail() const { return m_detail; } + virtual void initialize(JS::Realm&) override; virtual void visit_edges(JS::Cell::Visitor&) override; void init_custom_event(DeprecatedString const& type, bool bubbles, bool cancelable, JS::Value detail); diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 8c4d0abad84..ef391c340ad 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -297,8 +297,6 @@ Document::Document(JS::Realm& realm, const AK::URL& url) , m_style_computer(make(*this)) , m_url(url) { - set_prototype(&Bindings::cached_web_prototype(realm, "Document")); - HTML::main_thread_event_loop().register_document({}, *this); m_style_update_timer = Platform::Timer::create_single_shot(0, [this] { @@ -315,6 +313,12 @@ Document::~Document() HTML::main_thread_event_loop().unregister_document({}, *this); } +void Document::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Document")); +} + void Document::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 5757519dd41..67ce6c5ef6c 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -450,6 +450,7 @@ public: DeprecatedString dump_accessibility_tree_as_json(); protected: + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp index 2f9c183568e..44bb492e8ae 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp @@ -12,7 +12,12 @@ namespace Web::DOM { DocumentFragment::DocumentFragment(Document& document) : ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE) { - set_prototype(&Bindings::cached_web_prototype(realm(), "DocumentFragment")); +} + +void DocumentFragment::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DocumentFragment")); } void DocumentFragment::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.h b/Userland/Libraries/LibWeb/DOM/DocumentFragment.h index 47116712a82..0d5aa5e4c3f 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.h +++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.h @@ -33,6 +33,7 @@ public: protected: explicit DocumentFragment(Document& document); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.cpp b/Userland/Libraries/LibWeb/DOM/DocumentType.cpp index cf2310c85d9..567ff1eca05 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.cpp @@ -17,7 +17,12 @@ JS::NonnullGCPtr DocumentType::create(Document& document) DocumentType::DocumentType(Document& document) : Node(document, NodeType::DOCUMENT_TYPE_NODE) { - set_prototype(&Bindings::cached_web_prototype(realm(), "DocumentType")); +} + +void DocumentType::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DocumentType")); } } diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.h b/Userland/Libraries/LibWeb/DOM/DocumentType.h index deb8b96a374..44e0f1d7f57 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.h +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.h @@ -36,6 +36,8 @@ public: private: explicit DocumentType(Document&); + virtual void initialize(JS::Realm&) override; + DeprecatedString m_name; DeprecatedString m_public_id; DeprecatedString m_system_id; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 135e27f3c9f..413a3faf5b1 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -56,7 +56,6 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name) : ParentNode(document, NodeType::ELEMENT_NODE) , m_qualified_name(move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(document.realm(), "Element")); make_html_uppercased_qualified_name(); } @@ -65,6 +64,8 @@ Element::~Element() = default; void Element::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Element")); + m_attributes = NamedNodeMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp index 8d242f7227b..7f01b98f765 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp @@ -21,7 +21,6 @@ MutationObserver::MutationObserver(JS::Realm& realm, JS::GCPtr(realm, "MutationObserver")); +} + void MutationObserver::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.h b/Userland/Libraries/LibWeb/DOM/MutationObserver.h index 863839231c5..edc57223940 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationObserver.h +++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.h @@ -52,6 +52,7 @@ public: private: MutationObserver(JS::Realm&, JS::GCPtr); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://dom.spec.whatwg.org/#concept-mo-callback @@ -81,6 +82,7 @@ public: protected: RegisteredObserver(MutationObserver& observer, MutationObserverInit const& options); + virtual void visit_edges(Cell::Visitor&) override; private: @@ -100,6 +102,7 @@ public: private: TransientRegisteredObserver(MutationObserver& observer, MutationObserverInit const& options, RegisteredObserver& source); + virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_source; diff --git a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp index 9f29f539d68..8765e832ee6 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp @@ -29,11 +29,16 @@ MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type , m_attribute_namespace(attribute_namespace) , m_old_value(old_value) { - set_prototype(&Bindings::cached_web_prototype(realm, "MutationRecord")); } MutationRecord::~MutationRecord() = default; +void MutationRecord::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MutationRecord")); +} + void MutationRecord::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/DOM/MutationRecord.h b/Userland/Libraries/LibWeb/DOM/MutationRecord.h index 5c5f296c013..76a5f747b9b 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationRecord.h +++ b/Userland/Libraries/LibWeb/DOM/MutationRecord.h @@ -31,6 +31,8 @@ public: private: MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value); + + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedFlyString m_type; diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp index 54e51264568..791d8eede77 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp @@ -15,7 +15,12 @@ ProcessingInstruction::ProcessingInstruction(Document& document, DeprecatedStrin : CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data) , m_target(target) { - set_prototype(&Bindings::cached_web_prototype(document.realm(), "ProcessingInstruction")); +} + +void ProcessingInstruction::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "ProcessingInstruction")); } } diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h index f4f989b98ba..ad5e4484680 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h @@ -24,6 +24,8 @@ public: private: ProcessingInstruction(Document&, DeprecatedString const& data, DeprecatedString const& target); + virtual void initialize(JS::Realm&) override; + DeprecatedString m_target; }; diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index e7ffac96b04..75f723b201c 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -52,13 +52,11 @@ JS::NonnullGCPtr Range::construct_impl(JS::Realm& realm) Range::Range(Document& document) : Range(document, 0, document, 0) { - set_prototype(&Bindings::cached_web_prototype(document.realm(), "Range")); } Range::Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset) : AbstractRange(start_container, start_offset, end_container, end_offset) { - set_prototype(&Bindings::cached_web_prototype(start_container.realm(), "Range")); live_ranges().set(this); } @@ -67,6 +65,12 @@ Range::~Range() live_ranges().remove(this); } +void Range::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Range")); +} + // https://dom.spec.whatwg.org/#concept-range-root Node& Range::root() { diff --git a/Userland/Libraries/LibWeb/DOM/Range.h b/Userland/Libraries/LibWeb/DOM/Range.h index 12b293f96e6..697e281de87 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.h +++ b/Userland/Libraries/LibWeb/DOM/Range.h @@ -88,6 +88,8 @@ private: explicit Range(Document&); Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset); + virtual void initialize(JS::Realm&) override; + Node& root(); Node const& root() const; diff --git a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp index 45140d78d2b..f86bf5204d7 100644 --- a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp +++ b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp @@ -17,7 +17,6 @@ namespace Web::DOM { StaticRange::StaticRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset) : AbstractRange(start_container, start_offset, end_container, end_offset) { - set_prototype(&Bindings::cached_web_prototype(start_container.realm(), "StaticRange")); } StaticRange::~StaticRange() = default; @@ -36,4 +35,10 @@ WebIDL::ExceptionOr StaticRange::construct_impl(JS::Realm& realm, return realm.heap().allocate(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset).ptr(); } +void StaticRange::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "StaticRange")); +} + } diff --git a/Userland/Libraries/LibWeb/DOM/StaticRange.h b/Userland/Libraries/LibWeb/DOM/StaticRange.h index f554d5fc5d3..012714423de 100644 --- a/Userland/Libraries/LibWeb/DOM/StaticRange.h +++ b/Userland/Libraries/LibWeb/DOM/StaticRange.h @@ -28,6 +28,8 @@ public: StaticRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset); virtual ~StaticRange() override; + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 9fb0967b52b..33fe4b7d83b 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -17,13 +17,17 @@ namespace Web::DOM { Text::Text(Document& document, DeprecatedString const& data) : CharacterData(document, NodeType::TEXT_NODE, data) { - set_prototype(&Bindings::cached_web_prototype(realm(), "Text")); } Text::Text(Document& document, NodeType type, DeprecatedString const& data) : CharacterData(document, type, data) { - set_prototype(&Bindings::cached_web_prototype(realm(), "Text")); +} + +void Text::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Text")); } void Text::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/Text.h b/Userland/Libraries/LibWeb/DOM/Text.h index 86663192e15..aed9f5f0fc4 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.h +++ b/Userland/Libraries/LibWeb/DOM/Text.h @@ -38,6 +38,7 @@ protected: Text(Document&, DeprecatedString const&); Text(Document&, NodeType, DeprecatedString const&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp index a06ff25f4ab..262fa0dcb3a 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp @@ -28,11 +28,16 @@ JS::NonnullGCPtr XMLSerializer::construct_impl(JS::Realm& realm) XMLSerializer::XMLSerializer(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "XMLSerializer")); } XMLSerializer::~XMLSerializer() = default; +void XMLSerializer::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "XMLSerializer")); +} + // https://w3c.github.io/DOM-Parsing/#dom-xmlserializer-serializetostring WebIDL::ExceptionOr XMLSerializer::serialize_to_string(JS::NonnullGCPtr root) { diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h index 7f43c6d782d..ee5e311d99e 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h @@ -22,6 +22,8 @@ public: private: explicit XMLSerializer(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; enum class RequireWellFormed { diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp index 1979ef261c2..0a300d6f42c 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp @@ -29,11 +29,16 @@ TextDecoder::TextDecoder(JS::Realm& realm, TextCodec::Decoder& decoder, Deprecat , m_fatal(fatal) , m_ignore_bom(ignore_bom) { - set_prototype(&Bindings::cached_web_prototype(realm, "TextDecoder")); } TextDecoder::~TextDecoder() = default; +void TextDecoder::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "TextDecoder")); +} + // https://encoding.spec.whatwg.org/#dom-textdecoder-decode WebIDL::ExceptionOr TextDecoder::decode(JS::Handle const& input) const { diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.h b/Userland/Libraries/LibWeb/Encoding/TextDecoder.h index 450ca2dbb5d..c68447d0787 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.h +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.h @@ -35,6 +35,8 @@ private: // https://encoding.spec.whatwg.org/#dom-textdecoder TextDecoder(JS::Realm&, TextCodec::Decoder&, DeprecatedFlyString encoding, bool fatal, bool ignore_bom); + virtual void initialize(JS::Realm&) override; + TextCodec::Decoder& m_decoder; DeprecatedFlyString m_encoding; bool m_fatal { false }; diff --git a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp index c1a44767dc0..78fbd0b1316 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp @@ -19,11 +19,16 @@ JS::NonnullGCPtr TextEncoder::construct_impl(JS::Realm& realm) TextEncoder::TextEncoder(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "TextEncoder")); } TextEncoder::~TextEncoder() = default; +void TextEncoder::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "TextEncoder")); +} + // https://encoding.spec.whatwg.org/#dom-textencoder-encode JS::Uint8Array* TextEncoder::encode(DeprecatedString const& input) const { diff --git a/Userland/Libraries/LibWeb/Encoding/TextEncoder.h b/Userland/Libraries/LibWeb/Encoding/TextEncoder.h index 02eb55d736b..2da540f5d5e 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextEncoder.h +++ b/Userland/Libraries/LibWeb/Encoding/TextEncoder.h @@ -31,6 +31,8 @@ public: protected: // https://encoding.spec.whatwg.org/#dom-textencoder explicit TextEncoder(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp index 759dac9596b..7db1bb36912 100644 --- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp @@ -33,11 +33,16 @@ Headers::Headers(JS::Realm& realm, JS::NonnullGCPtr : PlatformObject(realm) , m_header_list(header_list) { - set_prototype(&Bindings::cached_web_prototype(realm, "Headers")); } Headers::~Headers() = default; +void Headers::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Headers")); +} + void Headers::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.h b/Userland/Libraries/LibWeb/Fetch/Headers.h index 5a905240ed2..2a9b6b54745 100644 --- a/Userland/Libraries/LibWeb/Fetch/Headers.h +++ b/Userland/Libraries/LibWeb/Fetch/Headers.h @@ -60,6 +60,7 @@ private: Headers(JS::Realm&, JS::NonnullGCPtr); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(JS::Cell::Visitor&) override; WebIDL::ExceptionOr validate(Infrastructure::Header const&) const; diff --git a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp index 342f290c1e9..9a1f682dfa4 100644 --- a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp +++ b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp @@ -33,11 +33,16 @@ HeadersIterator::HeadersIterator(Headers const& headers, JS::Object::PropertyKin , m_headers(headers) , m_iteration_kind(iteration_kind) { - set_prototype(&Bindings::ensure_web_prototype(headers.realm(), "HeadersIterator")); } HeadersIterator::~HeadersIterator() = default; +void HeadersIterator::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HeadersIterator")); +} + void HeadersIterator::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.h b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.h index a6a8c25ee14..68771b4134e 100644 --- a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.h +++ b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.h @@ -22,6 +22,7 @@ public: JS::ThrowCompletionOr next(); private: + virtual void initialize(JS::Realm&) override; virtual void visit_edges(JS::Cell::Visitor&) override; HeadersIterator(Headers const&, JS::Object::PropertyKind iteration_kind); diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 47b7a0fc22b..bb46a039c59 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -25,11 +25,16 @@ Request::Request(JS::Realm& realm, JS::NonnullGCPtr req : PlatformObject(realm) , m_request(request) { - set_prototype(&Bindings::cached_web_prototype(realm, "Request")); } Request::~Request() = default; +void Request::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Request")); +} + void Request::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/Fetch/Request.h b/Userland/Libraries/LibWeb/Fetch/Request.h index c7d17f24e52..1a4ff6d9141 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.h +++ b/Userland/Libraries/LibWeb/Fetch/Request.h @@ -98,6 +98,7 @@ public: private: Request(JS::Realm&, JS::NonnullGCPtr); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://fetch.spec.whatwg.org/#concept-request-request diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp index 7a3b53b9d4d..92bf6188e40 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp @@ -22,11 +22,16 @@ Response::Response(JS::Realm& realm, JS::NonnullGCPtr : PlatformObject(realm) , m_response(response) { - set_prototype(&Bindings::cached_web_prototype(realm, "Response")); } Response::~Response() = default; +void Response::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Response")); +} + void Response::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/Fetch/Response.h b/Userland/Libraries/LibWeb/Fetch/Response.h index 4adb0afbda6..74879111085 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.h +++ b/Userland/Libraries/LibWeb/Fetch/Response.h @@ -62,6 +62,7 @@ public: private: Response(JS::Realm&, JS::NonnullGCPtr); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; WebIDL::ExceptionOr initialize_response(ResponseInit const&, Optional const&); diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp index d2d19a093dd..6a76a7cbd4e 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp @@ -115,7 +115,6 @@ bool is_basic_latin(StringView view) Blob::Blob(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "Blob")); } Blob::Blob(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString type) @@ -123,18 +122,22 @@ Blob::Blob(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString type) , m_byte_buffer(move(byte_buffer)) , m_type(move(type)) { - set_prototype(&Bindings::cached_web_prototype(realm, "Blob")); } Blob::Blob(JS::Realm& realm, ByteBuffer byte_buffer) : PlatformObject(realm) , m_byte_buffer(move(byte_buffer)) { - set_prototype(&Bindings::cached_web_prototype(realm, "Blob")); } Blob::~Blob() = default; +void Blob::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Blob")); +} + // https://w3c.github.io/FileAPI/#ref-for-dom-blob-blob WebIDL::ExceptionOr> Blob::create(JS::Realm& realm, Optional> const& blob_parts, Optional const& options) { diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.h b/Userland/Libraries/LibWeb/FileAPI/Blob.h index 7a7150994b6..f3d482eb0a9 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.h +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.h @@ -53,6 +53,8 @@ protected: Blob(JS::Realm&, ByteBuffer, DeprecatedString type); Blob(JS::Realm&, ByteBuffer); + virtual void initialize(JS::Realm&) override; + private: explicit Blob(JS::Realm&); diff --git a/Userland/Libraries/LibWeb/FileAPI/File.cpp b/Userland/Libraries/LibWeb/FileAPI/File.cpp index 5435b82abe4..bd1c68ba9bd 100644 --- a/Userland/Libraries/LibWeb/FileAPI/File.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/File.cpp @@ -16,7 +16,12 @@ File::File(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString file_name, , m_name(move(file_name)) , m_last_modified(last_modified) { - set_prototype(&Bindings::cached_web_prototype(realm, "File")); +} + +void File::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "File")); } File::~File() = default; diff --git a/Userland/Libraries/LibWeb/FileAPI/File.h b/Userland/Libraries/LibWeb/FileAPI/File.h index da43c79a7dc..143f61ac3d1 100644 --- a/Userland/Libraries/LibWeb/FileAPI/File.h +++ b/Userland/Libraries/LibWeb/FileAPI/File.h @@ -31,6 +31,8 @@ public: private: File(JS::Realm&, ByteBuffer, DeprecatedString file_name, DeprecatedString type, i64 last_modified); + virtual void initialize(JS::Realm&) override; + DeprecatedString m_name; i64 m_last_modified { 0 }; }; diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp index 93fc4bdd575..cd2a1606292 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp @@ -18,7 +18,6 @@ JS::NonnullGCPtr DOMPoint::construct_impl(JS::Realm& realm, double x, DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w) : DOMPointReadOnly(realm, x, y, z, w) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMPoint")); } // https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint @@ -30,4 +29,10 @@ JS::NonnullGCPtr DOMPoint::from_point(JS::VM& vm, DOMPointInit const& DOMPoint::~DOMPoint() = default; +void DOMPoint::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DOMPoint")); +} + } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPoint.h b/Userland/Libraries/LibWeb/Geometry/DOMPoint.h index c758d2784c4..8d9bdc4c9e4 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPoint.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMPoint.h @@ -34,6 +34,8 @@ public: private: DOMPoint(JS::Realm&, double x, double y, double z, double w); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp index a24a192bd16..0b43b00f382 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp @@ -22,7 +22,6 @@ DOMPointReadOnly::DOMPointReadOnly(JS::Realm& realm, double x, double y, double , m_z(z) , m_w(w) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMPointReadOnly")); } // https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint @@ -34,4 +33,10 @@ JS::NonnullGCPtr DOMPointReadOnly::from_point(JS::VM& vm, DOMP DOMPointReadOnly::~DOMPointReadOnly() = default; +void DOMPointReadOnly::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DOMPointReadOnly")); +} + } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h index aadc16f202c..be5819b57f8 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h @@ -39,6 +39,8 @@ public: protected: DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w); + virtual void initialize(JS::Realm&) override; + double m_x; double m_y; double m_z; diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp index b732bcf211e..f74c4c74f33 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp @@ -22,9 +22,14 @@ JS::NonnullGCPtr DOMRect::create(JS::Realm& realm, Gfx::FloatRect const DOMRect::DOMRect(JS::Realm& realm, double x, double y, double width, double height) : DOMRectReadOnly(realm, x, y, width, height) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMRect")); } DOMRect::~DOMRect() = default; +void DOMRect::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DOMRect")); +} + } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.h b/Userland/Libraries/LibWeb/Geometry/DOMRect.h index babc4897b36..b8398102d80 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.h @@ -32,6 +32,8 @@ public: private: DOMRect(JS::Realm&, double x, double y, double width, double height); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp index 82b778a9306..c6a3286aefe 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp @@ -18,9 +18,14 @@ DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double wi : PlatformObject(realm) , m_rect(x, y, width, height) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMRectReadOnly")); } DOMRectReadOnly::~DOMRectReadOnly() = default; +void DOMRectReadOnly::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DOMRectReadOnly")); +} + } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h index e34665faa66..f0abdf72c54 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h @@ -34,6 +34,8 @@ public: protected: DOMRectReadOnly(JS::Realm&, double x, double y, double width, double height); + virtual void initialize(JS::Realm&) override; + Gfx::FloatRect m_rect; }; } diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp index e1468820b6a..e704ceebf27 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp @@ -43,11 +43,16 @@ CanvasGradient::CanvasGradient(JS::Realm& realm, Type type) : PlatformObject(realm) , m_type(type) { - set_prototype(&Bindings::cached_web_prototype(realm, "CanvasGradient")); } CanvasGradient::~CanvasGradient() = default; +void CanvasGradient::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CanvasGradient")); +} + // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop WebIDL::ExceptionOr CanvasGradient::add_color_stop(double offset, DeprecatedString const& color) { diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.h b/Userland/Libraries/LibWeb/HTML/CanvasGradient.h index 72aad2570df..92f2c1f5514 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.h @@ -32,6 +32,8 @@ public: private: CanvasGradient(JS::Realm&, Type); + virtual void initialize(JS::Realm&) override; + Type m_type {}; struct ColorStop { diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 39ac26198fd..2b7a30705f1 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -33,11 +33,16 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(JS::Realm& realm, HTMLCanvasE , CanvasPath(static_cast(*this)) , m_element(element) { - set_prototype(&Bindings::cached_web_prototype(realm, "CanvasRenderingContext2D")); } CanvasRenderingContext2D::~CanvasRenderingContext2D() = default; +void CanvasRenderingContext2D::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CanvasRenderingContext2D")); +} + void CanvasRenderingContext2D::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h index 995517eb9e1..66fe6511767 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h @@ -86,6 +86,7 @@ public: private: explicit CanvasRenderingContext2D(JS::Realm&, HTMLCanvasElement&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; struct PreparedTextGlyph { diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp index 1dbd77d1d1f..d74105da246 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp @@ -25,9 +25,14 @@ CloseEvent::CloseEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, , m_code(event_init.code) , m_reason(event_init.reason) { - set_prototype(&Bindings::cached_web_prototype(realm, "CloseEvent")); } CloseEvent::~CloseEvent() = default; +void CloseEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "CloseEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.h b/Userland/Libraries/LibWeb/HTML/CloseEvent.h index 6c94be526db..548f4d489d8 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.h +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.h @@ -33,6 +33,8 @@ public: private: CloseEvent(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + bool m_was_clean { false }; u16 m_code { 0 }; DeprecatedString m_reason; diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp index 987447a0347..bb40b3574c3 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp @@ -21,11 +21,16 @@ WebIDL::ExceptionOr> DOMParser::construct_impl(JS::R DOMParser::DOMParser(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMParser")); } DOMParser::~DOMParser() = default; +void DOMParser::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DOMParser")); +} + // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring JS::NonnullGCPtr DOMParser::parse_from_string(DeprecatedString const& string, Bindings::DOMParserSupportedType type) { diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.h b/Userland/Libraries/LibWeb/HTML/DOMParser.h index 58ed38f0b8b..85f696e46bc 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.h +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.h @@ -27,6 +27,8 @@ public: private: explicit DOMParser(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp index e557705fc7b..2e83004d956 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp @@ -27,11 +27,16 @@ ErrorEvent::ErrorEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, , m_colno(event_init.colno) , m_error(event_init.error) { - set_prototype(&Bindings::cached_web_prototype(realm, "ErrorEvent")); } ErrorEvent::~ErrorEvent() = default; +void ErrorEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "ErrorEvent")); +} + void ErrorEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.h b/Userland/Libraries/LibWeb/HTML/ErrorEvent.h index e4ce4ba2fdb..c34b6cf4306 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.h +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.h @@ -47,6 +47,7 @@ public: private: ErrorEvent(JS::Realm&, DeprecatedFlyString const& event_name, ErrorEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedString m_message { "" }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index 6482ff09c07..8a6956f3c61 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -13,8 +13,6 @@ namespace Web::HTML { HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAnchorElement")); - activation_behavior = [this](auto const& event) { run_activation_behavior(event); }; @@ -22,6 +20,12 @@ HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName HTMLAnchorElement::~HTMLAnchorElement() = default; +void HTMLAnchorElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLAnchorElement")); +} + void HTMLAnchorElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h index 88cba8c5540..3b0805a9abf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h @@ -32,6 +32,8 @@ public: private: HTMLAnchorElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + void run_activation_behavior(Web::DOM::Event const&); // ^DOM::Element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp index ab3efa3f347..dea9e96b16b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLAreaElement::HTMLAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAreaElement")); } HTMLAreaElement::~HTMLAreaElement() = default; +void HTMLAreaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLAreaElement")); +} + void HTMLAreaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h index 4140fdea31b..f38a79f846d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h @@ -23,6 +23,8 @@ public: private: HTMLAreaElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; virtual i32 default_tab_index_value() const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp index 86bd83230d4..f480581aa2e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLAudioElement::HTMLAudioElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLMediaElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAudioElement")); } HTMLAudioElement::~HTMLAudioElement() = default; + +void HTMLAudioElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLAudioElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h index e2117f069ed..4d32b7e9b38 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h @@ -18,6 +18,8 @@ public: private: HTMLAudioElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp index 3dc799c88bf..a13ae969570 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLBRElement::HTMLBRElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLBRElement")); } HTMLBRElement::~HTMLBRElement() = default; +void HTMLBRElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLBRElement")); +} + JS::GCPtr HTMLBRElement::create_layout_node(NonnullRefPtr style) { return heap().allocate_without_realm(document(), *this, move(style)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h index d3c8af74405..f6b1cf2f7e0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h @@ -20,6 +20,8 @@ public: private: HTMLBRElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp index 4bbbf5584c7..7b515c87b1d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLBaseElement::HTMLBaseElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLBaseElement")); } HTMLBaseElement::~HTMLBaseElement() = default; +void HTMLBaseElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLBaseElement")); +} + void HTMLBaseElement::inserted() { HTMLElement::inserted(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h index 3634f847d90..2a69da35ef1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h @@ -28,6 +28,7 @@ public: private: HTMLBaseElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual bool is_html_base_element() const override { return true; } // https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index ea1f4015e2d..4edc01ca4cb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -15,11 +15,16 @@ namespace Web::HTML { HTMLBodyElement::HTMLBodyElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLBodyElement")); } HTMLBodyElement::~HTMLBodyElement() = default; +void HTMLBodyElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLBodyElement")); +} + void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index 1fb06052d55..fe5679114b5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -29,6 +29,8 @@ public: private: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^HTML::GlobalEventHandlers virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const& event_name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp index ad62b38fc62..6705b3e5fbd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp @@ -13,8 +13,6 @@ namespace Web::HTML { HTMLButtonElement::HTMLButtonElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLButtonElement")); - // https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element:activation-behaviour activation_behavior = [this](auto&) { // 1. If element is disabled, then return. @@ -53,6 +51,12 @@ HTMLButtonElement::HTMLButtonElement(DOM::Document& document, DOM::QualifiedName HTMLButtonElement::~HTMLButtonElement() = default; +void HTMLButtonElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLButtonElement")); +} + DeprecatedString HTMLButtonElement::type() const { auto value = attribute(HTML::AttributeNames::type); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h index 82f9646fdd3..86d88e5e95c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h @@ -26,6 +26,8 @@ class HTMLButtonElement final public: virtual ~HTMLButtonElement() override; + virtual void initialize(JS::Realm&) override; + enum class TypeAttributeState { #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(_, state) state, ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 3c4eb53e67b..52090b55d55 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -21,11 +21,16 @@ static constexpr auto max_canvas_area = 16384 * 16384; HTMLCanvasElement::HTMLCanvasElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLCanvasElement")); } HTMLCanvasElement::~HTMLCanvasElement() = default; +void HTMLCanvasElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLCanvasElement")); +} + void HTMLCanvasElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h index b9e88a7a536..51a0f112925 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h @@ -40,6 +40,7 @@ public: private: HTMLCanvasElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp index 384407b89c0..eed2efc7091 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDListElement::HTMLDListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDListElement")); } HTMLDListElement::~HTMLDListElement() = default; + +void HTMLDListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h index 020dc63cafd..d0c1dbdd8ef 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h @@ -18,6 +18,8 @@ public: private: HTMLDListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp index 982dfd649fa..0ec6a42b80b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDataElement::HTMLDataElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDataElement")); } HTMLDataElement::~HTMLDataElement() = default; + +void HTMLDataElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDataElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h index 45b4e0aa34c..6fd5497aa1c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h @@ -22,6 +22,8 @@ public: private: HTMLDataElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp index 60bc4e31df7..7c3f9619ca5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDataListElement::HTMLDataListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDataListElement")); } HTMLDataListElement::~HTMLDataListElement() = default; + +void HTMLDataListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDataListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h index 1decc6f6a0d..df60c1b2c5f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h @@ -21,6 +21,8 @@ public: private: HTMLDataListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp index 57a416647ae..a6f6401ae3f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDetailsElement::HTMLDetailsElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDetailsElement")); } HTMLDetailsElement::~HTMLDetailsElement() = default; + +void HTMLDetailsElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDetailsElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h index 11082c9ea42..46c2ce8236d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h @@ -22,6 +22,8 @@ public: private: HTMLDetailsElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp index b63e78faead..f283602cc66 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDialogElement::HTMLDialogElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDialogElement")); } HTMLDialogElement::~HTMLDialogElement() = default; + +void HTMLDialogElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDialogElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h index 4dbb6fc0345..89e42c47c72 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h @@ -22,6 +22,8 @@ public: private: HTMLDialogElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp index 3f44578d1fc..7e76c9ee3c1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDirectoryElement::HTMLDirectoryElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDirectoryElement")); } HTMLDirectoryElement::~HTMLDirectoryElement() = default; + +void HTMLDirectoryElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDirectoryElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h index d0d8cb0cc9d..fd53d1dc37d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h @@ -19,6 +19,8 @@ public: private: HTMLDirectoryElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp index 7ff717f1e07..050187c9169 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDivElement::HTMLDivElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDivElement")); } HTMLDivElement::~HTMLDivElement() = default; + +void HTMLDivElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLDivElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h index 064515fa9bc..0d7c9172cdc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h @@ -22,6 +22,8 @@ public: private: HTMLDivElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 35a146ac07a..701699ddade 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -36,7 +36,6 @@ namespace Web::HTML { HTMLElement::HTMLElement(DOM::Document& document, DOM::QualifiedName qualified_name) : Element(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLElement")); } HTMLElement::~HTMLElement() = default; @@ -44,6 +43,8 @@ HTMLElement::~HTMLElement() = default; void HTMLElement::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLElement")); + m_dataset = DOMStringMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp index 9e9b8c22119..7ba220f5c12 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLEmbedElement::HTMLEmbedElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLEmbedElement")); } HTMLEmbedElement::~HTMLEmbedElement() = default; + +void HTMLEmbedElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLEmbedElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h index ff30ccab6c1..311ad16d3ae 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h @@ -18,6 +18,8 @@ public: private: HTMLEmbedElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp index 9df7a9e9a47..59297ca6cca 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLFieldSetElement::HTMLFieldSetElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFieldSetElement")); } HTMLFieldSetElement::~HTMLFieldSetElement() = default; +void HTMLFieldSetElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLFieldSetElement")); +} + // https://html.spec.whatwg.org/multipage/form-elements.html#concept-fieldset-disabled bool HTMLFieldSetElement::is_disabled() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index 6b2e3ab1fa4..bf1e54c4ec1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -40,6 +40,8 @@ public: private: HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp index 89032edfd07..75243d89c41 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLFontElement::HTMLFontElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFontElement")); } HTMLFontElement::~HTMLFontElement() = default; +void HTMLFontElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLFontElement")); +} + void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h index 44be85a8a2f..89a3b0783dc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h @@ -20,6 +20,8 @@ public: private: HTMLFontElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 9149a10c77e..54c13cbea71 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -26,11 +26,16 @@ namespace Web::HTML { HTMLFormElement::HTMLFormElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFormElement")); } HTMLFormElement::~HTMLFormElement() = default; +void HTMLFormElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLFormElement")); +} + void HTMLFormElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h index 928c469d3be..df6bc49fe6e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h @@ -43,6 +43,7 @@ public: private: HTMLFormElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool m_firing_submission_events { false }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp index 75597fed8d9..3256104e30a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLFrameElement::HTMLFrameElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFrameElement")); } HTMLFrameElement::~HTMLFrameElement() = default; +void HTMLFrameElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLFrameElement")); +} + // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex i32 HTMLFrameElement::default_tab_index_value() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h index de3a5cc3a8c..ab365071021 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h @@ -19,6 +19,9 @@ public: private: HTMLFrameElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual i32 default_tab_index_value() const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp index 90af8cf9103..b36b77f4945 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFrameSetElement")); } HTMLFrameSetElement::~HTMLFrameSetElement() = default; +void HTMLFrameSetElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLFrameSetElement")); +} + void HTMLFrameSetElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h index 0a3ef76f588..24a4c295c92 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h @@ -23,9 +23,9 @@ public: private: HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override; -private: // ^HTML::GlobalEventHandlers virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const& event_name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp index 73122657579..f97a7814f89 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLHRElement::HTMLHRElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHRElement")); } HTMLHRElement::~HTMLHRElement() = default; + +void HTMLHRElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLHRElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h index e1c4e9ef84e..7176ba61b4e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h @@ -22,6 +22,8 @@ public: private: HTMLHRElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp index e6bc7a47546..ff171910369 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLHeadElement::HTMLHeadElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHeadElement")); } HTMLHeadElement::~HTMLHeadElement() = default; + +void HTMLHeadElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLHeadElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h index 921bdfd6db1..6d88ab80345 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h @@ -18,6 +18,8 @@ public: private: HTMLHeadElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp index b1bc336ee99..e6fe3dddfc7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLHeadingElement::HTMLHeadingElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHeadingElement")); } HTMLHeadingElement::~HTMLHeadingElement() = default; +void HTMLHeadingElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLHeadingElement")); +} + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h index 892c1fcbe0e..82896790772 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h @@ -29,6 +29,8 @@ public: private: HTMLHeadingElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp index d8d0eeff008..f2758c9c67f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHtmlElement")); } HTMLHtmlElement::~HTMLHtmlElement() = default; +void HTMLHtmlElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLHtmlElement")); +} + bool HTMLHtmlElement::should_use_body_background_properties() const { auto background_color = layout_node()->computed_values().background_color(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h index 88014cdaeb0..6cc03a8f710 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h @@ -25,6 +25,7 @@ public: private: HTMLHtmlElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual bool is_html_html_element() const override { return true; } }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 92b760a7e24..98131a22a18 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -17,11 +17,16 @@ namespace Web::HTML { HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, DOM::QualifiedName qualified_name) : BrowsingContextContainer(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLIFrameElement")); } HTMLIFrameElement::~HTMLIFrameElement() = default; +void HTMLIFrameElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLIFrameElement")); +} + JS::GCPtr HTMLIFrameElement::create_layout_node(NonnullRefPtr style) { return heap().allocate_without_realm(document(), *this, move(style)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h index d10dd68e305..e0a5f897e11 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -28,6 +28,8 @@ public: private: HTMLIFrameElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual void inserted() override; virtual void removed_from(Node*) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 411717ee0bf..13f6da07e2f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -23,8 +23,6 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q : HTMLElement(document, move(qualified_name)) , m_image_loader(*this) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLImageElement")); - m_image_loader.on_load = [this] { set_needs_style_update(true); this->document().set_needs_layout(); @@ -50,6 +48,12 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q HTMLImageElement::~HTMLImageElement() = default; +void HTMLImageElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLImageElement")); +} + void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index 94b6d8a5c54..4119f3dad63 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -48,6 +48,7 @@ public: private: HTMLImageElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; void animate(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 3c20012d638..ef6a08ef94e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -29,8 +29,6 @@ HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName q : HTMLElement(document, move(qualified_name)) , m_value(DeprecatedString::empty()) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLInputElement")); - activation_behavior = [this](auto&) { // The activation behavior for input elements are these steps: @@ -43,6 +41,12 @@ HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName q HTMLInputElement::~HTMLInputElement() = default; +void HTMLInputElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLInputElement")); +} + void HTMLInputElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index f9e0b369dc6..3a6a863a14e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -134,6 +134,7 @@ private: // ^DOM::Element virtual i32 default_tab_index_value() const override; + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; static TypeAttributeState parse_type_attribute(StringView); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp index 307461215f5..41cf0533e6c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLLIElement::HTMLLIElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLIElement")); } HTMLLIElement::~HTMLLIElement() = default; + +void HTMLLIElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLLIElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h index 082670302ae..2e4c0baeca8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h @@ -22,6 +22,8 @@ public: private: HTMLLIElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp index 940d8800076..6d8372bf23d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLLabelElement::HTMLLabelElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLabelElement")); } HTMLLabelElement::~HTMLLabelElement() = default; +void HTMLLabelElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLLabelElement")); +} + JS::GCPtr HTMLLabelElement::create_layout_node(NonnullRefPtr style) { return heap().allocate_without_realm(document(), this, move(style)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h index 7ebdd6e129c..489ab4db4b9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h @@ -22,6 +22,8 @@ public: private: HTMLLabelElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp index c1f5c4fb957..dd004bc08d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLLegendElement::HTMLLegendElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLegendElement")); } HTMLLegendElement::~HTMLLegendElement() = default; + +void HTMLLegendElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLLegendElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h index 3e1d94e2252..dc10820edac 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h @@ -18,6 +18,8 @@ public: private: HTMLLegendElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index e0f657d2466..7787da4572d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -22,11 +22,16 @@ namespace Web::HTML { HTMLLinkElement::HTMLLinkElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLinkElement")); } HTMLLinkElement::~HTMLLinkElement() = default; +void HTMLLinkElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLLinkElement")); +} + void HTMLLinkElement::inserted() { if (has_attribute(AttributeNames::disabled) && (m_relationship & Relationship::Stylesheet)) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h index 73edcfe1376..bb8cdfbc346 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -33,6 +33,7 @@ public: private: HTMLLinkElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override; // ^ResourceClient diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp index 43c3dce152a..ebcfa407b33 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLMapElement::HTMLMapElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMapElement")); } HTMLMapElement::~HTMLMapElement() = default; + +void HTMLMapElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLMapElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h index c0afa994b10..c862ba7cc14 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h @@ -18,6 +18,8 @@ public: private: HTMLMapElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index ed5b5232971..194f9e9cb7b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLMarqueeElement::HTMLMarqueeElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMarqueeElement")); } HTMLMarqueeElement::~HTMLMarqueeElement() = default; +void HTMLMarqueeElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLMarqueeElement")); +} + void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const { HTMLElement::apply_presentational_hints(style); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h index 996c4473731..3c85d41bc2e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h @@ -19,6 +19,8 @@ public: private: HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 5273e680d08..a1325ce3592 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLMediaElement::HTMLMediaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMediaElement")); } HTMLMediaElement::~HTMLMediaElement() = default; +void HTMLMediaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLMediaElement")); +} + // https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(DeprecatedString const& type) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h index a809226085a..d1f3139bb6f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -23,6 +23,8 @@ public: protected: HTMLMediaElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp index 1499835d440..b4b7575005e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLMenuElement::HTMLMenuElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMenuElement")); } HTMLMenuElement::~HTMLMenuElement() = default; +void HTMLMenuElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLMenuElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h index 7517b6a9272..1577bce29ff 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h @@ -22,6 +22,8 @@ public: private: HTMLMenuElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp index 425f077fb06..b40bb5507ea 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLMetaElement::HTMLMetaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMetaElement")); } HTMLMetaElement::~HTMLMetaElement() = default; +void HTMLMetaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLMetaElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h index 743d0042e4b..bd21f42c14f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h @@ -18,6 +18,8 @@ public: private: HTMLMetaElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp index f299750c9de..6f8ce5e8fa0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLMeterElement::HTMLMeterElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMeterElement")); } HTMLMeterElement::~HTMLMeterElement() = default; +void HTMLMeterElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLMeterElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h index 9bb413df888..0c2907461bf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h @@ -27,6 +27,8 @@ public: private: HTMLMeterElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp index b8326ea34a3..bc5a40c4c75 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLModElement::HTMLModElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLModElement")); } HTMLModElement::~HTMLModElement() = default; +void HTMLModElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLModElement")); +} + DeprecatedFlyString HTMLModElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-del diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h index 908f56c12f2..710cf9a4718 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h @@ -21,6 +21,8 @@ public: private: HTMLModElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp index 7f4b85e1c51..74de79aa2b0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLOListElement::HTMLOListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOListElement")); } HTMLOListElement::~HTMLOListElement() = default; +void HTMLOListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLOListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h index 81f63c1247d..776fd1fb2bd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h @@ -22,6 +22,8 @@ public: private: HTMLOListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 68a1a1c87fa..dbbfada928a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -19,8 +19,6 @@ namespace Web::HTML { HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : BrowsingContextContainer(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLObjectElement")); - // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element // Whenever one of the following conditions occur: // - the element is created, @@ -32,6 +30,12 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName HTMLObjectElement::~HTMLObjectElement() = default; +void HTMLObjectElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLObjectElement")); +} + void HTMLObjectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { BrowsingContextContainer::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index a83ecafc4d5..46567c275e4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -46,6 +46,8 @@ public: private: HTMLObjectElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp index 81cc1c0afe9..77c433c961f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLOptGroupElement::HTMLOptGroupElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOptGroupElement")); } HTMLOptGroupElement::~HTMLOptGroupElement() = default; +void HTMLOptGroupElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLOptGroupElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h index d6875b1dc65..cef892b5c74 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h @@ -22,6 +22,8 @@ public: private: HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp index 9c2cfc224d3..17027c98b56 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp @@ -21,11 +21,16 @@ namespace Web::HTML { HTMLOptionElement::HTMLOptionElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOptionElement")); } HTMLOptionElement::~HTMLOptionElement() = default; +void HTMLOptionElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLOptionElement")); +} + void HTMLOptionElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h index 1f0c9546ea5..9633a7c85bf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h @@ -38,6 +38,8 @@ private: HTMLOptionElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; void did_remove_attribute(DeprecatedFlyString const& name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp index 4782523d10f..61fd9220533 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp @@ -21,11 +21,16 @@ JS::NonnullGCPtr HTMLOptionsCollection::create(DOM::Paren HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function filter) : DOM::HTMLCollection(root, move(filter)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOptionsCollection")); } HTMLOptionsCollection::~HTMLOptionsCollection() = default; +void HTMLOptionsCollection::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLOptionsCollection")); +} + // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmloptionscollection-add WebIDL::ExceptionOr HTMLOptionsCollection::add(HTMLOptionOrOptGroupElement element, Optional before) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h index 813b202ded6..ee3d7ff5a07 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h @@ -26,6 +26,8 @@ public: private: HTMLOptionsCollection(DOM::ParentNode& root, Function filter); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp index a50ac4232bf..99a9d89ba96 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLOutputElement::HTMLOutputElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOutputElement")); } HTMLOutputElement::~HTMLOutputElement() = default; +void HTMLOutputElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLOutputElement")); +} + // https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element:concept-form-reset-control void HTMLOutputElement::reset_algorithm() { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index 9d46c7d8b6f..bc4a574b9e3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -49,6 +49,8 @@ public: private: HTMLOutputElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp index f6057fea888..72a77736ef8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLParagraphElement::HTMLParagraphElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLParagraphElement")); } HTMLParagraphElement::~HTMLParagraphElement() = default; +void HTMLParagraphElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLParagraphElement")); +} + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& style) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h index e0572366ec6..d124674decc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h @@ -24,6 +24,8 @@ public: private: HTMLParagraphElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp index aded0af35ba..b71bdbaed98 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLParamElement::HTMLParamElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLParamElement")); } HTMLParamElement::~HTMLParamElement() = default; +void HTMLParamElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLParamElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h index 17004cbdc0f..8ae224061aa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h @@ -18,6 +18,8 @@ public: private: HTMLParamElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp index 31986daad6f..d9e4bb99a51 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLPictureElement::HTMLPictureElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLPictureElement")); } HTMLPictureElement::~HTMLPictureElement() = default; +void HTMLPictureElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLPictureElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h index 6aaa861419e..c27e99ee340 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h @@ -18,6 +18,8 @@ public: private: HTMLPictureElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp index 70e641396a1..684e4e49f1b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLPreElement")); } HTMLPreElement::~HTMLPreElement() = default; +void HTMLPreElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLPreElement")); +} + void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const { HTMLElement::apply_presentational_hints(style); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h index bfb623ab529..d2fc64fa2fd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h @@ -22,6 +22,8 @@ public: private: HTMLPreElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index d31e5e8107d..cde41d25949 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -17,11 +17,16 @@ namespace Web::HTML { HTMLProgressElement::HTMLProgressElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLProgressElement")); } HTMLProgressElement::~HTMLProgressElement() = default; +void HTMLProgressElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLProgressElement")); +} + JS::GCPtr HTMLProgressElement::create_layout_node(NonnullRefPtr style) { if (style->appearance().value_or(CSS::Appearance::Auto) == CSS::Appearance::None) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h index 00689839f53..aa39a9f9dbe 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h @@ -39,6 +39,8 @@ public: private: HTMLProgressElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + void progress_position_updated(); bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp index 116842758e8..2547d64dd79 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLQuoteElement")); } HTMLQuoteElement::~HTMLQuoteElement() = default; +void HTMLQuoteElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLQuoteElement")); +} + DeprecatedFlyString HTMLQuoteElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-blockquote diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h index 79748de6f33..f12877b04c0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h @@ -20,6 +20,8 @@ public: private: HTMLQuoteElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 4a39299a277..0af9dd888dc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -26,11 +26,16 @@ namespace Web::HTML { HTMLScriptElement::HTMLScriptElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLScriptElement")); } HTMLScriptElement::~HTMLScriptElement() = default; +void HTMLScriptElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLScriptElement")); +} + void HTMLScriptElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h index b4537d68807..049e5aa9945 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h @@ -57,6 +57,7 @@ public: virtual void resource_did_load() override; virtual void resource_did_fail() override; + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index 5ed7612b836..cc5ddb69067 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -16,11 +16,16 @@ namespace Web::HTML { HTMLSelectElement::HTMLSelectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSelectElement")); } HTMLSelectElement::~HTMLSelectElement() = default; +void HTMLSelectElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLSelectElement")); +} + void HTMLSelectElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h index 0e1c211bdab..985edd49fc5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h @@ -65,6 +65,7 @@ public: private: HTMLSelectElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // ^DOM::Element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp index 49a434777a1..7a43cb4ee19 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSlotElement")); } HTMLSlotElement::~HTMLSlotElement() = default; +void HTMLSlotElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLSlotElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h index 8924b5847fc..9f7cc04950b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h @@ -18,6 +18,8 @@ public: private: HTMLSlotElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp index 40f6d0141a0..5031b6b25bd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLSourceElement::HTMLSourceElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSourceElement")); } HTMLSourceElement::~HTMLSourceElement() = default; +void HTMLSourceElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLSourceElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h index 2fba7bb28d5..98c98a4e05a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h @@ -18,6 +18,8 @@ public: private: HTMLSourceElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp index b7f41ee0c62..dd5559e20c6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLSpanElement::HTMLSpanElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSpanElement")); } HTMLSpanElement::~HTMLSpanElement() = default; +void HTMLSpanElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLSpanElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h index 75e165fcad7..20d6a7d7bd8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h @@ -22,6 +22,8 @@ public: private: HTMLSpanElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index 7624f261521..cf42ecc56a9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLStyleElement::HTMLStyleElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLStyleElement")); } HTMLStyleElement::~HTMLStyleElement() = default; +void HTMLStyleElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLStyleElement")); +} + void HTMLStyleElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h index 413ceb04d59..522390128b9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h @@ -29,6 +29,7 @@ public: private: HTMLStyleElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://www.w3.org/TR/cssom/#associated-css-style-sheet diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp index 82074e21ecd..25354fdb424 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLTableCaptionElement::HTMLTableCaptionElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableCaptionElement")); } HTMLTableCaptionElement::~HTMLTableCaptionElement() = default; +void HTMLTableCaptionElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTableCaptionElement")); +} + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& style) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h index 259dbb101d8..94f44b41a8f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h @@ -24,6 +24,8 @@ public: private: HTMLTableCaptionElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index a97862b517f..e554128132c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLTableCellElement::HTMLTableCellElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableCellElement")); } HTMLTableCellElement::~HTMLTableCellElement() = default; +void HTMLTableCellElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTableCellElement")); +} + void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h index c3e02ded3bb..7eb0138762e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h @@ -26,6 +26,8 @@ public: private: HTMLTableCellElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp index 4055e3bddf4..06e94dd8b6f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLTableColElement::HTMLTableColElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableColElement")); } HTMLTableColElement::~HTMLTableColElement() = default; +void HTMLTableColElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTableColElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h index c887819d2f2..6b4a0f1da9a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h @@ -18,6 +18,8 @@ public: private: HTMLTableColElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 9d78f4fd818..821d0e684f0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -20,11 +20,16 @@ namespace Web::HTML { HTMLTableElement::HTMLTableElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableElement")); } HTMLTableElement::~HTMLTableElement() = default; +void HTMLTableElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTableElement")); +} + void HTMLTableElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h index 40b8eff6820..5ed3f57edf3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h @@ -48,6 +48,7 @@ public: private: HTMLTableElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index aa44d76d9ff..16be11e4b24 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -18,11 +18,16 @@ namespace Web::HTML { HTMLTableRowElement::HTMLTableRowElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableRowElement")); } HTMLTableRowElement::~HTMLTableRowElement() = default; +void HTMLTableRowElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTableRowElement")); +} + void HTMLTableRowElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h index ea80fe5bc2a..9d404aed0e8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h @@ -30,6 +30,7 @@ public: private: HTMLTableRowElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr mutable m_cells; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp index 9c2a669692c..146a0197b8d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp @@ -17,11 +17,16 @@ namespace Web::HTML { HTMLTableSectionElement::HTMLTableSectionElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableSectionElement")); } HTMLTableSectionElement::~HTMLTableSectionElement() = default; +void HTMLTableSectionElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTableSectionElement")); +} + void HTMLTableSectionElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h index 025ff5a8746..83cfc5830e9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h @@ -30,6 +30,7 @@ public: private: HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr mutable m_rows; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp index 109417fd127..9712909d703 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp @@ -13,7 +13,6 @@ namespace Web::HTML { HTMLTemplateElement::HTMLTemplateElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTemplateElement")); } HTMLTemplateElement::~HTMLTemplateElement() = default; @@ -21,6 +20,8 @@ HTMLTemplateElement::~HTMLTemplateElement() = default; void HTMLTemplateElement::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTemplateElement")); + m_content = heap().allocate(realm, m_document->appropriate_template_contents_owner_document()); m_content->set_host(this); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index c2347f66c4c..ac1443b1007 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTextAreaElement")); } HTMLTextAreaElement::~HTMLTextAreaElement() = default; +void HTMLTextAreaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTextAreaElement")); +} + // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex i32 HTMLTextAreaElement::default_tab_index_value() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index 7b5af5691f7..86805985ab8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -57,6 +57,8 @@ public: private: HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual i32 default_tab_index_value() const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp index 27a06c1a6c9..77692b083d3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp @@ -12,7 +12,12 @@ namespace Web::HTML { HTMLTimeElement::HTMLTimeElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTimeElement")); +} + +void HTMLTimeElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTimeElement")); } HTMLTimeElement::~HTMLTimeElement() = default; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h index f6962c6695a..02655140f46 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h @@ -22,6 +22,8 @@ public: private: HTMLTimeElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp index 27bcb0a15e7..998a4b5b24b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLTitleElement::HTMLTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTitleElement")); } HTMLTitleElement::~HTMLTitleElement() = default; +void HTMLTitleElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTitleElement")); +} + void HTMLTitleElement::children_changed() { HTMLElement::children_changed(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h index ac6dc7f163c..545b24b6f35 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h @@ -19,6 +19,7 @@ public: private: HTMLTitleElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void children_changed() override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp index e02d866cd6a..286d94b73ad 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLTrackElement::HTMLTrackElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTrackElement")); } HTMLTrackElement::~HTMLTrackElement() = default; +void HTMLTrackElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLTrackElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h index 2c8172702de..17be2189743 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h @@ -18,6 +18,8 @@ public: private: HTMLTrackElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp index adc74730ce2..04e1fd451ce 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLUListElement::HTMLUListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLUListElement")); } HTMLUListElement::~HTMLUListElement() = default; +void HTMLUListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLUListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h index 9c7b275f5c9..45e4af27541 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h @@ -22,6 +22,8 @@ public: private: HTMLUListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp index aca3da01abb..ae683a1b35a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLUnknownElement::HTMLUnknownElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLUnknownElement")); } HTMLUnknownElement::~HTMLUnknownElement() = default; +void HTMLUnknownElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLUnknownElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h index e0bf9c64a32..9e468927719 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h @@ -18,6 +18,8 @@ public: private: HTMLUnknownElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp index 04810b30b50..eea5bfd1d53 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLVideoElement::HTMLVideoElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLMediaElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLVideoElement")); } HTMLVideoElement::~HTMLVideoElement() = default; +void HTMLVideoElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "HTMLVideoElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h index a83b90289be..0d4470a5838 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h @@ -18,6 +18,8 @@ public: private: HTMLVideoElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/History.cpp b/Userland/Libraries/LibWeb/HTML/History.cpp index 63deb9f7987..7034c04ea5f 100644 --- a/Userland/Libraries/LibWeb/HTML/History.cpp +++ b/Userland/Libraries/LibWeb/HTML/History.cpp @@ -19,11 +19,16 @@ History::History(JS::Realm& realm, DOM::Document& document) : PlatformObject(realm) , m_associated_document(document) { - set_prototype(&Bindings::cached_web_prototype(realm, "History")); } History::~History() = default; +void History::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "History")); +} + void History::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/History.h b/Userland/Libraries/LibWeb/HTML/History.h index b873aabdffd..c20902b1fe1 100644 --- a/Userland/Libraries/LibWeb/HTML/History.h +++ b/Userland/Libraries/LibWeb/HTML/History.h @@ -30,6 +30,7 @@ public: private: History(JS::Realm&, DOM::Document&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; enum class IsPush { diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.cpp b/Userland/Libraries/LibWeb/HTML/ImageData.cpp index 8f16de3eac4..426385033f1 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.cpp +++ b/Userland/Libraries/LibWeb/HTML/ImageData.cpp @@ -36,11 +36,16 @@ ImageData::ImageData(JS::Realm& realm, NonnullRefPtr bitmap, JS::No , m_bitmap(move(bitmap)) , m_data(move(data)) { - set_prototype(&Bindings::cached_web_prototype(realm, "ImageData")); } ImageData::~ImageData() = default; +void ImageData::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "ImageData")); +} + void ImageData::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.h b/Userland/Libraries/LibWeb/HTML/ImageData.h index e56f026c1b3..86c25ce5780 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.h +++ b/Userland/Libraries/LibWeb/HTML/ImageData.h @@ -31,6 +31,7 @@ public: private: ImageData(JS::Realm&, NonnullRefPtr, JS::NonnullGCPtr); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; NonnullRefPtr m_bitmap; diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp index b0c706a57a1..069564c3e2d 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp @@ -19,8 +19,6 @@ JS::NonnullGCPtr MessageChannel::construct_impl(JS::Realm& realm MessageChannel::MessageChannel(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "MessageChannel")); - // 1. Set this's port 1 to a new MessagePort in this's relevant Realm. m_port1 = MessagePort::create(realm); @@ -40,6 +38,12 @@ void MessageChannel::visit_edges(Cell::Visitor& visitor) visitor.visit(m_port2.ptr()); } +void MessageChannel::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MessageChannel")); +} + MessagePort* MessageChannel::port1() { return m_port1; diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.h b/Userland/Libraries/LibWeb/HTML/MessageChannel.h index 4fc9c2c2e47..1dfe15520cc 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.h +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.h @@ -28,6 +28,7 @@ public: private: explicit MessageChannel(JS::Realm&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr m_port1; diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp index 907b8691141..910a94b5aeb 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp @@ -25,11 +25,16 @@ MessageEvent::MessageEvent(JS::Realm& realm, DeprecatedFlyString const& event_na , m_origin(event_init.origin) , m_last_event_id(event_init.last_event_id) { - set_prototype(&Bindings::cached_web_prototype(realm, "MessageEvent")); } MessageEvent::~MessageEvent() = default; +void MessageEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MessageEvent")); +} + void MessageEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.h b/Userland/Libraries/LibWeb/HTML/MessageEvent.h index 675c1eeffe4..73cd28d29cb 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.h +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.h @@ -32,6 +32,7 @@ public: DeprecatedString const& last_event_id() const { return m_last_event_id; } private: + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::Value m_data; diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp index 461ff967b6f..52159660e04 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp @@ -22,11 +22,16 @@ JS::NonnullGCPtr MessagePort::create(JS::Realm& realm) MessagePort::MessagePort(JS::Realm& realm) : DOM::EventTarget(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "MessagePort")); } MessagePort::~MessagePort() = default; +void MessagePort::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MessagePort")); +} + void MessagePort::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.h b/Userland/Libraries/LibWeb/HTML/MessagePort.h index 6dba0493eea..84de2b72885 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.h +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.h @@ -46,6 +46,7 @@ public: private: explicit MessagePort(JS::Realm&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool is_entangled() const { return m_remote_port; } diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.cpp b/Userland/Libraries/LibWeb/HTML/Navigator.cpp index ed25204e083..b53263418b0 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigator.cpp @@ -23,11 +23,16 @@ JS::NonnullGCPtr Navigator::create(JS::Realm& realm) Navigator::Navigator(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "Navigator")); } Navigator::~Navigator() = default; +void Navigator::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Navigator")); +} + // https://w3c.github.io/webdriver/#dfn-webdriver bool Navigator::webdriver() const { diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.h b/Userland/Libraries/LibWeb/HTML/Navigator.h index 699bc6557a5..a6447ed7498 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.h +++ b/Userland/Libraries/LibWeb/HTML/Navigator.h @@ -45,6 +45,8 @@ public: private: explicit Navigator(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp index 177277ffa4d..33393346dba 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp @@ -23,9 +23,14 @@ PageTransitionEvent::PageTransitionEvent(JS::Realm& realm, DeprecatedFlyString c : DOM::Event(realm, event_name, event_init) , m_persisted(event_init.persisted) { - set_prototype(&Bindings::cached_web_prototype(realm, "PageTransitionEvent")); } PageTransitionEvent::~PageTransitionEvent() = default; +void PageTransitionEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "PageTransitionEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h index e809bc9f598..6409d141c86 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h @@ -28,6 +28,8 @@ public: bool persisted() const { return m_persisted; } private: + virtual void initialize(JS::Realm&) override; + bool m_persisted { false }; }; diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.cpp b/Userland/Libraries/LibWeb/HTML/Path2D.cpp index 58d53831567..3803c7f019b 100644 --- a/Userland/Libraries/LibWeb/HTML/Path2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/Path2D.cpp @@ -22,8 +22,6 @@ Path2D::Path2D(JS::Realm& realm, Optional, Deprecated : PlatformObject(realm) , CanvasPath(static_cast(*this)) { - set_prototype(&Bindings::cached_web_prototype(realm, "Path2D")); - // 1. Let output be a new Path2D object. // 2. If path is not given, then return output. if (!path.has_value()) @@ -56,4 +54,10 @@ Path2D::Path2D(JS::Realm& realm, Optional, Deprecated Path2D::~Path2D() = default; +void Path2D::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Path2D")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.h b/Userland/Libraries/LibWeb/HTML/Path2D.h index 915717c8a60..db3d781d099 100644 --- a/Userland/Libraries/LibWeb/HTML/Path2D.h +++ b/Userland/Libraries/LibWeb/HTML/Path2D.h @@ -27,6 +27,8 @@ public: private: Path2D(JS::Realm&, Optional, DeprecatedString>> const&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp index f16a98a2c6d..b27adcc40df 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp @@ -24,7 +24,6 @@ PromiseRejectionEvent::PromiseRejectionEvent(JS::Realm& realm, DeprecatedFlyStri , m_promise(const_cast(event_init.promise.cell())) , m_reason(event_init.reason) { - set_prototype(&Bindings::cached_web_prototype(realm, "PromiseRejectionEvent")); } PromiseRejectionEvent::~PromiseRejectionEvent() = default; @@ -36,4 +35,10 @@ void PromiseRejectionEvent::visit_edges(Cell::Visitor& visitor) visitor.visit(m_reason); } +void PromiseRejectionEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "PromiseRejectionEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h index 0f79732f60e..6b4f4e01ee5 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h @@ -35,6 +35,7 @@ public: private: PromiseRejectionEvent(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::Promise* m_promise { nullptr }; diff --git a/Userland/Libraries/LibWeb/HTML/Storage.cpp b/Userland/Libraries/LibWeb/HTML/Storage.cpp index a21e2d89b86..e826eb44b7b 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.cpp +++ b/Userland/Libraries/LibWeb/HTML/Storage.cpp @@ -18,11 +18,16 @@ JS::NonnullGCPtr Storage::create(JS::Realm& realm) Storage::Storage(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "Storage")); } Storage::~Storage() = default; +void Storage::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Storage")); +} + // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-length size_t Storage::length() const { diff --git a/Userland/Libraries/LibWeb/HTML/Storage.h b/Userland/Libraries/LibWeb/HTML/Storage.h index 0090431d45c..6b3323bc817 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.h +++ b/Userland/Libraries/LibWeb/HTML/Storage.h @@ -35,6 +35,8 @@ public: private: explicit Storage(JS::Realm&); + virtual void initialize(JS::Realm&) override; + void reorder(); void broadcast(DeprecatedString const& key, DeprecatedString const& old_value, DeprecatedString const& new_value); diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp index 9d3cc07ff5f..ee1a535447e 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp @@ -23,11 +23,16 @@ SubmitEvent::SubmitEvent(JS::Realm& realm, DeprecatedFlyString const& event_name : DOM::Event(realm, event_name, event_init) , m_submitter(event_init.submitter) { - set_prototype(&Bindings::cached_web_prototype(realm, "SubmitEvent")); } SubmitEvent::~SubmitEvent() = default; +void SubmitEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SubmitEvent")); +} + void SubmitEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h index 56dc9b604b3..51398d9a466 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h @@ -29,6 +29,7 @@ public: private: SubmitEvent(JS::Realm&, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr m_submitter; diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp index 5041db40063..fda88cba770 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp @@ -17,9 +17,14 @@ JS::NonnullGCPtr TextMetrics::create(JS::Realm& realm) TextMetrics::TextMetrics(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "TextMetrics")); } TextMetrics::~TextMetrics() = default; +void TextMetrics::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "TextMetrics")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.h b/Userland/Libraries/LibWeb/HTML/TextMetrics.h index 54bdfd29b14..8c969a25455 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.h +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.h @@ -47,6 +47,8 @@ public: private: explicit TextMetrics(JS::Realm&); + virtual void initialize(JS::Realm&) override; + double m_width { 0 }; double m_actual_bounding_box_left { 0 }; double m_actual_bounding_box_right { 0 }; diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp index 3aac30ea98f..cf5179dc6aa 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.cpp +++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp @@ -28,7 +28,12 @@ Worker::Worker(DeprecatedFlyString const& script_url, WorkerOptions const option , m_interpreter_scope(*m_interpreter) , m_implicit_port(MessagePort::create(document.realm())) { - set_prototype(&Bindings::cached_web_prototype(document.realm(), "Worker")); +} + +void Worker::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Worker")); } void Worker::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h index 303ce771539..9650cd39ea6 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.h +++ b/Userland/Libraries/LibWeb/HTML/Worker.h @@ -68,6 +68,7 @@ private: return static_cast(target_vm.custom_data())->event_loop; } + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedFlyString m_script_url; diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp index e86d942b564..2585f260b46 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp @@ -19,9 +19,14 @@ JS::NonnullGCPtr WorkerNavigator::create(WorkerGlobalScope& glo WorkerNavigator::WorkerNavigator(WorkerGlobalScope& global_scope) : PlatformObject(global_scope.realm()) { - set_prototype(&Bindings::cached_web_prototype(global_scope.realm(), "WorkerNavigator")); } WorkerNavigator::~WorkerNavigator() = default; +void WorkerNavigator::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "WorkerNavigator")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h index a9557aa3d38..54fdb2b2634 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h @@ -28,6 +28,8 @@ public: private: explicit WorkerNavigator(WorkerGlobalScope&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp index 67ec50f83d9..633ab366d8f 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp +++ b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp @@ -17,12 +17,17 @@ Performance::Performance(HTML::Window& window) : DOM::EventTarget(window.realm()) , m_window(window) { - set_prototype(&Bindings::cached_web_prototype(realm(), "Performance")); m_timer.start(); } Performance::~Performance() = default; +void Performance::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "Performance")); +} + void Performance::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h index 2853b3c056e..817b8087c1d 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h +++ b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h @@ -25,6 +25,7 @@ public: private: explicit Performance(HTML::Window&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_window; diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp index ec4522deebf..e14bf176099 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp @@ -23,11 +23,16 @@ JS::NonnullGCPtr IntersectionObserver::construct_impl(JS:: IntersectionObserver::IntersectionObserver(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "IntersectionObserver")); } IntersectionObserver::~IntersectionObserver() = default; +void IntersectionObserver::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "IntersectionObserver")); +} + // https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observe void IntersectionObserver::observe(DOM::Element& target) { diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h index 82b73a443f2..326385ed1e7 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h @@ -32,6 +32,8 @@ public: private: explicit IntersectionObserver(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp index cc5f507d006..a2d53b5ac95 100644 --- a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp +++ b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp @@ -12,11 +12,16 @@ PerformanceTiming::PerformanceTiming(HTML::Window& window) : PlatformObject(window.realm()) , m_window(window) { - set_prototype(&Bindings::cached_web_prototype(realm(), "PerformanceTiming")); } PerformanceTiming::~PerformanceTiming() = default; +void PerformanceTiming::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "PerformanceTiming")); +} + void PerformanceTiming::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h index 9bdadcb6724..fa711fb6344 100644 --- a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h +++ b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h @@ -43,6 +43,7 @@ public: private: explicit PerformanceTiming(HTML::Window&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr m_window; diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp index 9fa2c626745..b0d6fb123d0 100644 --- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp +++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp @@ -21,7 +21,12 @@ IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout) : PlatformObject(realm) , m_did_timeout(did_timeout) { - set_prototype(&Bindings::cached_web_prototype(realm, "IdleDeadline")); +} + +void IdleDeadline::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "IdleDeadline")); } IdleDeadline::~IdleDeadline() = default; diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h index 23d546889b5..d703a9c6200 100644 --- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h +++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h @@ -24,6 +24,8 @@ public: private: IdleDeadline(JS::Realm&, bool did_timeout); + virtual void initialize(JS::Realm&) override; + bool m_did_timeout { false }; }; diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp index 638ed78934f..0112c34fd6e 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp @@ -21,11 +21,16 @@ JS::NonnullGCPtr ResizeObserver::construct_impl(JS::Realm& realm ResizeObserver::ResizeObserver(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "ResizeObserver")); } ResizeObserver::~ResizeObserver() = default; +void ResizeObserver::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "ResizeObserver")); +} + // https://drafts.csswg.org/resize-observer/#dom-resizeobserver-observe void ResizeObserver::observe(DOM::Element& target, ResizeObserverOptions options) { diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h index 591ed454cd0..a9cd4aa3cf9 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h @@ -29,6 +29,8 @@ public: private: explicit ResizeObserver(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp index cb0e635aad4..124e2ed9609 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp @@ -19,14 +19,18 @@ SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr(realm, "SVGAnimatedLength")); +} + void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h index 452d8b65e78..cb96977d034 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h @@ -25,6 +25,7 @@ public: private: SVGAnimatedLength(JS::Realm&, JS::NonnullGCPtr base_val, JS::NonnullGCPtr anim_val); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_base_val; diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp index 886f8f23207..cb7ca7177ba 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGCircleElement")); +} + +void SVGCircleElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGCircleElement")); } void SVGCircleElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h index d51459a2021..376002299ce 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h @@ -28,6 +28,8 @@ public: private: SVGCircleElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional m_path; Optional m_center_x; diff --git a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp index c7127dff916..4ded39d8c99 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp @@ -12,13 +12,18 @@ namespace Web::SVG { SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGClipPathElement")); } SVGClipPathElement::~SVGClipPathElement() { } +void SVGClipPathElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGClipPathElement")); +} + JS::GCPtr SVGClipPathElement::create_layout_node(NonnullRefPtr) { return nullptr; diff --git a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h index 36712c18b44..e5d562eba6f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h @@ -20,6 +20,8 @@ public: private: SVGClipPathElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp index 86e7d87ff0b..1403ed8380b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp @@ -12,13 +12,18 @@ namespace Web::SVG { SVGDefsElement::SVGDefsElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGDefsElement")); } SVGDefsElement::~SVGDefsElement() { } +void SVGDefsElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGDefsElement")); +} + JS::GCPtr SVGDefsElement::create_layout_node(NonnullRefPtr) { return nullptr; diff --git a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h index ddb2eeb437d..a875239ccab 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h @@ -20,6 +20,8 @@ public: private: SVGDefsElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGElement.cpp index 10c1a2e10ce..6fd8c1c605e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGElement.cpp @@ -14,7 +14,12 @@ SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_nam : Element(document, move(qualified_name)) , m_dataset(HTML::DOMStringMap::create(*this)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGElement")); +} + +void SVGElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGElement")); } void SVGElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGElement.h index 8752f719619..5cfca6517fb 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGElement.h @@ -22,6 +22,7 @@ public: protected: SVGElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_dataset; diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp index ae17c54d03f..d062616c6a6 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGEllipseElement")); +} + +void SVGEllipseElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGEllipseElement")); } void SVGEllipseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h index 4ed5d584f5a..72e179896e8 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h @@ -29,6 +29,8 @@ public: private: SVGEllipseElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional m_path; Optional m_center_x; diff --git a/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp index 75bd7a2c00d..d2297e9730b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp @@ -17,7 +17,6 @@ namespace Web::SVG { SVGForeignObjectElement::SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGForeignObjectElement")); } SVGForeignObjectElement::~SVGForeignObjectElement() = default; @@ -25,6 +24,7 @@ SVGForeignObjectElement::~SVGForeignObjectElement() = default; void SVGForeignObjectElement::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGForeignObjectElement")); // FIXME: These never actually get updated! m_x = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0)); diff --git a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp index 974f9667971..6e3979d7361 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp @@ -13,7 +13,12 @@ namespace Web::SVG { SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGGeometryElement")); +} + +void SVGGeometryElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGGeometryElement")); } JS::GCPtr SVGGeometryElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h index bf01c92a932..3a32b82e1cd 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h @@ -25,6 +25,8 @@ public: protected: SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp index 6479629eb2a..9714587c718 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp @@ -16,7 +16,12 @@ namespace Web::SVG { SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGGraphicsElement")); +} + +void SVGGraphicsElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGGraphicsElement")); } void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h index 2ce716ec3a9..b62703ca941 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h @@ -26,6 +26,8 @@ public: protected: SVGGraphicsElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp index 2a268304cec..ae53ce61e05 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp @@ -19,7 +19,12 @@ SVGLength::SVGLength(JS::Realm& realm, u8 unit_type, float value) , m_unit_type(unit_type) , m_value(value) { - set_prototype(&Bindings::cached_web_prototype(realm, "SVGLength")); +} + +void SVGLength::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGLength")); } SVGLength::~SVGLength() = default; diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.h b/Userland/Libraries/LibWeb/SVG/SVGLength.h index afd248ad118..02e129d748a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.h @@ -27,6 +27,8 @@ public: private: SVGLength(JS::Realm&, u8 unit_type, float value); + virtual void initialize(JS::Realm&) override; + u8 m_unit_type { 0 }; float m_value { 0 }; }; diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp index 50731211ef8..3e79cf16a97 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGLineElement")); +} + +void SVGLineElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGLineElement")); } void SVGLineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.h b/Userland/Libraries/LibWeb/SVG/SVGLineElement.h index bf28fcc8468..01ed6b136c5 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.h @@ -29,6 +29,8 @@ public: private: SVGLineElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional m_path; Optional m_x1; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index 06160679691..2e30643663a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -87,7 +87,12 @@ namespace Web::SVG { SVGPathElement::SVGPathElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGPathElement")); +} + +void SVGPathElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGPathElement")); } void SVGPathElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h index 7333bd5ad6f..93b06bb3408 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h @@ -26,6 +26,8 @@ public: private: SVGPathElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Vector m_instructions; Optional m_path; }; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp index e4de0399579..a17630bae60 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGPolygonElement")); +} + +void SVGPolygonElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGPolygonElement")); } void SVGPolygonElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h index 017b57b10a9..021392c743b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h @@ -23,6 +23,8 @@ public: private: SVGPolygonElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional m_path; Vector m_points; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp index e92d604b97f..5275fcd6068 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGPolylineElement")); +} + +void SVGPolylineElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGPolylineElement")); } void SVGPolylineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h index 77015550cb6..8ad2a9da82e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h @@ -23,6 +23,8 @@ public: private: SVGPolylineElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional m_path; Vector m_points; diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp index 1bd6ce469b2..c14c1be515d 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp @@ -16,7 +16,12 @@ namespace Web::SVG { SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGRectElement")); +} + +void SVGRectElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGRectElement")); } void SVGRectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h index 6b079a3f05b..eea648ae1de 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h @@ -31,6 +31,8 @@ public: private: SVGRectElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Gfx::FloatPoint calculate_used_corner_radius_values(); Optional m_path; diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index 256e3c0be86..cf1caff20a5 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -20,7 +20,12 @@ namespace Web::SVG { SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGSVGElement")); +} + +void SVGSVGElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGSVGElement")); } JS::GCPtr SVGSVGElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h index 05fae1059eb..7834df21547 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h @@ -28,6 +28,8 @@ public: private: SVGSVGElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + virtual bool is_svg_svg_element() const override { return true; } virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp index 11086090b75..1cb956395fa 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp @@ -15,7 +15,12 @@ namespace Web::SVG { SVGTextContentElement::SVGTextContentElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGTextContentElement")); +} + +void SVGTextContentElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "SVGTextContentElement")); } // https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h index 74ded565544..719ee102f3e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h @@ -20,6 +20,8 @@ public: protected: SVGTextContentElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/Selection/Selection.cpp b/Userland/Libraries/LibWeb/Selection/Selection.cpp index 34f225374e4..f3ba361965b 100644 --- a/Userland/Libraries/LibWeb/Selection/Selection.cpp +++ b/Userland/Libraries/LibWeb/Selection/Selection.cpp @@ -20,11 +20,16 @@ Selection::Selection(JS::NonnullGCPtr realm, JS::NonnullGCPtr(realm, "Selection")); +} + // https://w3c.github.io/selection-api/#dfn-empty bool Selection::is_empty() const { diff --git a/Userland/Libraries/LibWeb/Selection/Selection.h b/Userland/Libraries/LibWeb/Selection/Selection.h index db75a876c98..81fb7dd16f6 100644 --- a/Userland/Libraries/LibWeb/Selection/Selection.h +++ b/Userland/Libraries/LibWeb/Selection/Selection.h @@ -55,6 +55,7 @@ private: [[nodiscard]] bool is_empty() const; + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://w3c.github.io/selection-api/#dfn-empty diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp index 1b555abf71c..ae898e4c5b9 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp @@ -20,11 +20,16 @@ WebIDL::ExceptionOr> ReadableStream::construct_ ReadableStream::ReadableStream(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "ReadableStream")); } ReadableStream::~ReadableStream() = default; +void ReadableStream::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "ReadableStream")); +} + void ReadableStream::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStream.h b/Userland/Libraries/LibWeb/Streams/ReadableStream.h index 0d2bcde6858..f8db6d1c569 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStream.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStream.h @@ -41,6 +41,7 @@ public: private: explicit ReadableStream(JS::Realm&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://streams.spec.whatwg.org/#readablestream-controller diff --git a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp index 30c1deeb508..3799d472eb9 100644 --- a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp @@ -17,10 +17,15 @@ FocusEvent* FocusEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString con FocusEvent::FocusEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, FocusEventInit const& event_init) : UIEvent(realm, event_name) { - set_prototype(&Bindings::cached_web_prototype(realm, "FocusEvent")); set_related_target(const_cast(event_init.related_target.ptr())); } FocusEvent::~FocusEvent() = default; +void FocusEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "FocusEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h index 255fba7c807..f11b84918b5 100644 --- a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.h @@ -24,6 +24,8 @@ public: private: FocusEvent(JS::Realm&, DeprecatedFlyString const& event_name, FocusEventInit const&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp index 32df18d3975..7bc89ddbb64 100644 --- a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp @@ -128,9 +128,14 @@ KeyboardEvent::KeyboardEvent(JS::Realm& realm, DeprecatedFlyString const& event_ , m_key_code(event_init.key_code) , m_char_code(event_init.char_code) { - set_prototype(&Bindings::cached_web_prototype(realm, "KeyboardEvent")); } KeyboardEvent::~KeyboardEvent() = default; +void KeyboardEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "KeyboardEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h index c63cd7e192d..0ce603b9e51 100644 --- a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h @@ -56,6 +56,8 @@ public: private: KeyboardEvent(JS::Realm&, DeprecatedFlyString const& event_name, KeyboardEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + DeprecatedString m_key; DeprecatedString m_code; u32 m_location { 0 }; diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp index d528c8dd68e..2c4138f4fd8 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp @@ -24,12 +24,17 @@ MouseEvent::MouseEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, , m_button(event_init.button) , m_buttons(event_init.buttons) { - set_prototype(&Bindings::cached_web_prototype(realm, "MouseEvent")); set_event_characteristics(); } MouseEvent::~MouseEvent() = default; +void MouseEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "MouseEvent")); +} + // https://www.w3.org/TR/uievents/#dom-mouseevent-button static i16 determine_button(unsigned mouse_button) { diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h index 7cbce9c9539..03d0f1b8bdc 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h @@ -58,6 +58,8 @@ public: protected: MouseEvent(JS::Realm&, DeprecatedFlyString const& event_name, MouseEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + private: void set_event_characteristics(); diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp index f97f07fb165..e5781a84220 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp @@ -22,7 +22,6 @@ UIEvent* UIEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& ev UIEvent::UIEvent(JS::Realm& realm, DeprecatedFlyString const& event_name) : Event(realm, event_name) { - set_prototype(&Bindings::cached_web_prototype(realm, "UIEvent")); } UIEvent::UIEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, UIEventInit const& event_init) @@ -30,11 +29,16 @@ UIEvent::UIEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, UIEven , m_view(event_init.view) , m_detail(event_init.detail) { - set_prototype(&Bindings::cached_web_prototype(realm, "UIEvent")); } UIEvent::~UIEvent() = default; +void UIEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "UIEvent")); +} + void UIEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h index 874a9d9399e..97e7b1cd84e 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h @@ -41,6 +41,7 @@ protected: UIEvent(JS::Realm&, DeprecatedFlyString const& event_name); UIEvent(JS::Realm&, DeprecatedFlyString const& event_name, UIEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr m_view; diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp index d8d92f503b1..46152ce8dda 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp @@ -17,12 +17,17 @@ WheelEvent::WheelEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, , m_delta_y(event_init.delta_y) , m_delta_mode(event_init.delta_mode) { - set_prototype(&Bindings::cached_web_prototype(realm, "WheelEvent")); set_event_characteristics(); } WheelEvent::~WheelEvent() = default; +void WheelEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "WheelEvent")); +} + WheelEvent* WheelEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, WheelEventInit const& event_init) { return realm.heap().allocate(realm, realm, event_name, event_init); diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h index f3f65eae675..43a3c80f61f 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h @@ -42,6 +42,8 @@ public: private: WheelEvent(JS::Realm&, DeprecatedFlyString const& event_name, WheelEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + void set_event_characteristics(); double m_delta_x { 0 }; diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp index c52a3b4921c..49cfc3f906d 100644 --- a/Userland/Libraries/LibWeb/URL/URL.cpp +++ b/Userland/Libraries/LibWeb/URL/URL.cpp @@ -57,11 +57,16 @@ URL::URL(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) , m_url(move(url)) , m_query(move(query)) { - set_prototype(&Bindings::cached_web_prototype(realm, "URL")); } URL::~URL() = default; +void URL::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "URL")); +} + void URL::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/URL/URL.h b/Userland/Libraries/LibWeb/URL/URL.h index 718ebf09ea6..d691f0ec084 100644 --- a/Userland/Libraries/LibWeb/URL/URL.h +++ b/Userland/Libraries/LibWeb/URL/URL.h @@ -65,6 +65,7 @@ public: private: URL(JS::Realm&, AK::URL, JS::NonnullGCPtr query); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; AK::URL m_url; diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp index f5766c6337f..ddf08690a65 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp @@ -17,11 +17,16 @@ URLSearchParams::URLSearchParams(JS::Realm& realm, Vector list) : PlatformObject(realm) , m_list(move(list)) { - set_prototype(&Bindings::cached_web_prototype(realm, "URLSearchParams")); } URLSearchParams::~URLSearchParams() = default; +void URLSearchParams::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "URLSearchParams")); +} + void URLSearchParams::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.h b/Userland/Libraries/LibWeb/URL/URLSearchParams.h index 02f5fb708ee..9456c830303 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.h +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.h @@ -48,6 +48,7 @@ private: URLSearchParams(JS::Realm&, Vector list); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; void update(); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp index 6b289fe2c1b..66ebc57ee9f 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp @@ -33,11 +33,16 @@ URLSearchParamsIterator::URLSearchParamsIterator(URLSearchParams const& url_sear , m_url_search_params(url_search_params) , m_iteration_kind(iteration_kind) { - set_prototype(&Bindings::ensure_web_prototype(url_search_params.realm(), "URLSearchParamsIterator")); } URLSearchParamsIterator::~URLSearchParamsIterator() = default; +void URLSearchParamsIterator::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "URLSearchParamsIterator")); +} + void URLSearchParamsIterator::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h index 84fc9373c7d..7a2714d22a1 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h +++ b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.h @@ -24,6 +24,7 @@ public: private: URLSearchParamsIterator(URLSearchParams const&, JS::Object::PropertyKind iteration_kind); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; URLSearchParams const& m_url_search_params; diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp index 983899ad8b6..54d850fc617 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp @@ -23,9 +23,14 @@ WebGLContextEvent::WebGLContextEvent(JS::Realm& realm, DeprecatedFlyString const : DOM::Event(realm, type, event_init) , m_status_message(event_init.status_message) { - set_prototype(&Bindings::cached_web_prototype(realm, "WebGLContextEvent")); } WebGLContextEvent::~WebGLContextEvent() = default; +void WebGLContextEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "WebGLContextEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h index 23cd69d0fdc..a42fb8f224f 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h +++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h @@ -29,6 +29,8 @@ public: private: WebGLContextEvent(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + DeprecatedString m_status_message { DeprecatedString::empty() }; }; diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp index 54557345b81..44d7fb1bd3d 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp @@ -52,9 +52,14 @@ JS::ThrowCompletionOr> WebGLRenderingContext::c WebGLRenderingContext::WebGLRenderingContext(JS::Realm& realm, HTML::HTMLCanvasElement& canvas_element, NonnullOwnPtr context, WebGLContextAttributes context_creation_parameters, WebGLContextAttributes actual_context_parameters) : WebGLRenderingContextBase(realm, canvas_element, move(context), move(context_creation_parameters), move(actual_context_parameters)) { - set_prototype(&Bindings::cached_web_prototype(realm, "WebGLRenderingContext")); } WebGLRenderingContext::~WebGLRenderingContext() = default; +void WebGLRenderingContext::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "WebGLRenderingContext")); +} + } diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h index d864e5dc00c..b31a6742ee8 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h @@ -21,6 +21,8 @@ public: virtual ~WebGLRenderingContext() override; private: + virtual void initialize(JS::Realm&) override; + WebGLRenderingContext(JS::Realm&, HTML::HTMLCanvasElement&, NonnullOwnPtr context, WebGLContextAttributes context_creation_parameters, WebGLContextAttributes actual_context_parameters); }; diff --git a/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp b/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp index 49709af9a59..baaeac3a3f7 100644 --- a/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp @@ -24,9 +24,14 @@ DOMException::DOMException(JS::Realm& realm, DeprecatedFlyString const& name, De , m_name(name) , m_message(message) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMException")); } DOMException::~DOMException() = default; +void DOMException::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "DOMException")); +} + } diff --git a/Userland/Libraries/LibWeb/WebIDL/DOMException.h b/Userland/Libraries/LibWeb/WebIDL/DOMException.h index 38b86efc24e..2e92283d94f 100644 --- a/Userland/Libraries/LibWeb/WebIDL/DOMException.h +++ b/Userland/Libraries/LibWeb/WebIDL/DOMException.h @@ -109,6 +109,8 @@ public: protected: DOMException(JS::Realm&, DeprecatedFlyString const& name, DeprecatedFlyString const& message); + virtual void initialize(JS::Realm&) override; + private: DeprecatedFlyString m_name; DeprecatedFlyString m_message; diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index e8abf405d60..c9f12846668 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -64,8 +64,6 @@ WebSocket::WebSocket(HTML::Window& window, AK::URL& url) : EventTarget(window.realm()) , m_window(window) { - set_prototype(&Bindings::cached_web_prototype(window.realm(), "WebSocket")); - // FIXME: Integrate properly with FETCH as per https://fetch.spec.whatwg.org/#websocket-opening-handshake auto origin_string = m_window->associated_document().origin().serialize(); m_websocket = WebSocketClientManager::the().connect(url, origin_string); @@ -97,6 +95,12 @@ WebSocket::WebSocket(HTML::Window& window, AK::URL& url) WebSocket::~WebSocket() = default; +void WebSocket::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "WebSocket")); +} + void WebSocket::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h index d931c5a8100..59e87389456 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h @@ -68,6 +68,7 @@ private: WebSocket(HTML::Window&, AK::URL&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_window; diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp index d26f53cce2a..f8332a25561 100644 --- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp +++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp @@ -25,9 +25,14 @@ ProgressEvent::ProgressEvent(JS::Realm& realm, DeprecatedFlyString const& event_ , m_loaded(event_init.loaded) , m_total(event_init.total) { - set_prototype(&Bindings::cached_web_prototype(realm, "ProgressEvent")); } ProgressEvent::~ProgressEvent() = default; +void ProgressEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "ProgressEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.h b/Userland/Libraries/LibWeb/XHR/ProgressEvent.h index 3ef9daf643d..abc7305fa96 100644 --- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.h +++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.h @@ -35,6 +35,8 @@ public: private: ProgressEvent(JS::Realm&, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + bool m_length_computable { false }; u64 m_loaded { 0 }; u64 m_total { 0 }; diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 888a61ac5a2..eda2f78fbee 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -55,11 +55,16 @@ XMLHttpRequest::XMLHttpRequest(HTML::Window& window, Fetch::Infrastructure::Head , m_response_type(Bindings::XMLHttpRequestResponseType::Empty) { set_overrides_must_survive_garbage_collection(true); - set_prototype(&Bindings::cached_web_prototype(window.realm(), "XMLHttpRequest")); } XMLHttpRequest::~XMLHttpRequest() = default; +void XMLHttpRequest::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype(realm, "XMLHttpRequest")); +} + void XMLHttpRequest::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 8c5eb38fff1..ca29cede330 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -72,6 +72,7 @@ public: void abort(); private: + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual bool must_survive_garbage_collection() const override;