diff options
author | 2023-08-17 23:25:09 +0200 | |
---|---|---|
committer | 2023-08-17 14:25:09 -0700 | |
commit | b0e76a965d6580e1c09a9effe6df7aabccb670ef (patch) | |
tree | b5ed03554f1b9d094eccb67c8672289371bb4460 /src | |
parent | cfce38858fa7c82e6753384edc0692b082efd9e9 (diff) | |
download | bun-b0e76a965d6580e1c09a9effe6df7aabccb670ef.tar.gz bun-b0e76a965d6580e1c09a9effe6df7aabccb670ef.tar.zst bun-b0e76a965d6580e1c09a9effe6df7aabccb670ef.zip |
refactor: move HTMLRewriter to c++ bindings (#4193)
Diffstat (limited to '')
-rw-r--r-- | src/bun.js/api/html_rewriter.classes.ts | 263 | ||||
-rw-r--r-- | src/bun.js/api/html_rewriter.zig | 783 | ||||
-rw-r--r-- | src/bun.js/base.zig | 41 | ||||
-rw-r--r-- | src/bun.js/bindings/JSSink.cpp | 8 | ||||
-rw-r--r-- | src/bun.js/bindings/JSSinkLookupTable.h | 170 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h | 67 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h | 67 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h | 388 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h | 491 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.cpp | 2586 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.h | 420 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 29 | ||||
-rw-r--r-- | src/bun.js/bindings/exports.zig | 7 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 729 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes_list.zig | 8 | ||||
-rw-r--r-- | src/bun.js/javascript.zig | 31 |
16 files changed, 4961 insertions, 1127 deletions
diff --git a/src/bun.js/api/html_rewriter.classes.ts b/src/bun.js/api/html_rewriter.classes.ts new file mode 100644 index 000000000..a447a0edc --- /dev/null +++ b/src/bun.js/api/html_rewriter.classes.ts @@ -0,0 +1,263 @@ +import { define } from "../scripts/class-definitions"; + +export default [ + define({ + name: "HTMLRewriter", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + klass: {}, + proto: { + on: { + fn: "on", + length: 2, + }, + onDocument: { + fn: "onDocument", + length: 1, + }, + transform: { + fn: "transform", + length: 1, + }, + }, + }), + define({ + name: "TextChunk", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + before: { + fn: "before", + length: 1, + }, + after: { + fn: "after", + length: 1, + }, + replace: { + fn: "replace", + length: 1, + }, + remove: { + fn: "remove", + length: 0, + }, + removed: { + getter: "removed", + }, + lastInTextNode: { + getter: "lastInTextNode", + cache: true, + }, + text: { + getter: "getText", + }, + }, + }), + define({ + name: "DocType", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + name: { + getter: "name", + cache: true, + }, + systemId: { + getter: "systemId", + cache: true, + }, + publicId: { + getter: "publicId", + cache: true, + }, + }, + }), + define({ + name: "DocEnd", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + append: { + fn: "append", + length: 1, + }, + }, + }), + define({ + name: "Comment", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + before: { + fn: "before", + length: 1, + }, + after: { + fn: "after", + length: 1, + }, + replace: { + fn: "replace", + length: 1, + }, + remove: { + fn: "remove", + length: 0, + }, + removed: { + getter: "removed", + }, + text: { + getter: "getText", + setter: "setText", + }, + }, + }), + define({ + name: "EndTag", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + before: { + fn: "before", + length: 1, + }, + after: { + fn: "after", + length: 1, + }, + remove: { + fn: "remove", + length: 0, + }, + name: { + getter: "getName", + setter: "setName", + }, + }, + }), + define({ + name: "AttributeIterator", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + next: { + fn: "next", + length: 0, + }, + "@@iterator": { + fn: "getThis", + length: 0, + }, + }, + }), + define({ + name: "Element", + construct: true, + finalize: true, + JSType: "0b11101110", + configurable: false, + noConstructor: true, + klass: {}, + proto: { + getAttribute: { + fn: "getAttribute", + length: 1, + }, + + hasAttribute: { + fn: "hasAttribute", + length: 1, + }, + + setAttribute: { + fn: "setAttribute", + length: 2, + }, + removeAttribute: { + fn: "removeAttribute", + length: 1, + }, + + before: { + fn: "before", + length: 1, + }, + after: { + fn: "after", + length: 1, + }, + replace: { + fn: "replace", + length: 1, + }, + prepend: { + fn: "prepend", + length: 1, + }, + append: { + fn: "append", + length: 1, + }, + setInnerContent: { + fn: "setInnerContent", + length: 1, + }, + + remove: { + fn: "remove", + length: 0, + }, + removeAndKeepContent: { + fn: "removeAndKeepContent", + length: 0, + }, + onEndTag: { + fn: "onEndTag", + length: 1, + }, + + tagName: { + getter: "getTagName", + setter: "setTagName", + }, + removed: { + getter: "getRemoved", + }, + namespaceURI: { + getter: "getNamespaceURI", + cache: true, + }, + attributes: { + getter: "getAttributes", + }, + }, + }), +]; diff --git a/src/bun.js/api/html_rewriter.zig b/src/bun.js/api/html_rewriter.zig index f754e3e23..0c1cbebab 100644 --- a/src/bun.js/api/html_rewriter.zig +++ b/src/bun.js/api/html_rewriter.zig @@ -1,32 +1,13 @@ const std = @import("std"); -const Api = @import("../../api/schema.zig").Api; -const http = @import("../../http.zig"); -const JavaScript = @import("../javascript.zig"); -const QueryStringMap = @import("../../url.zig").QueryStringMap; -const CombinedScanner = @import("../../url.zig").CombinedScanner; const bun = @import("root").bun; const string = bun.string; const JSC = @import("root").bun.JSC; -const js = JSC.C; const WebCore = @import("../webcore/response.zig"); -const Router = @This(); -const Bundler = bun.bundler; -const VirtualMachine = JavaScript.VirtualMachine; -const ScriptSrcStream = std.io.FixedBufferStream([]u8); const ZigString = JSC.ZigString; -const Fs = @import("../../fs.zig"); const Base = @import("../base.zig"); const getAllocator = Base.getAllocator; -const JSObject = JSC.JSObject; -const JSError = Base.JSError; const JSValue = JSC.JSValue; const JSGlobalObject = JSC.JSGlobalObject; -const strings = @import("root").bun.strings; -const NewClass = Base.NewClass; -const To = Base.To; -const Request = WebCore.Request; - -const FetchEvent = WebCore.FetchEvent; const Response = WebCore.Response; const LOLHTML = @import("root").bun.LOLHTML; @@ -60,57 +41,29 @@ pub const HTMLRewriter = struct { builder: *LOLHTML.HTMLRewriter.Builder, context: LOLHTMLContext, - pub const Constructor = JSC.NewConstructor(HTMLRewriter, .{ .constructor = constructor }, .{}); + pub usingnamespace JSC.Codegen.JSHTMLRewriter; - pub const Class = NewClass( - HTMLRewriter, - .{ .name = "HTMLRewriter" }, - .{ - .finalize = finalize, - .on = .{ - .rfn = wrap(HTMLRewriter, "on"), - }, - .onDocument = .{ - .rfn = wrap(HTMLRewriter, "onDocument"), - }, - .transform = .{ - .rfn = wrap(HTMLRewriter, "transform"), - }, - }, - .{}, - ); - - pub fn constructor( - ctx: js.JSContextRef, - _: js.JSObjectRef, - _: []const js.JSValueRef, - _: js.ExceptionRef, - ) js.JSObjectRef { + pub fn constructor(_: *JSGlobalObject, _: *JSC.CallFrame) callconv(.C) ?*HTMLRewriter { var rewriter = bun.default_allocator.create(HTMLRewriter) catch unreachable; rewriter.* = HTMLRewriter{ .builder = LOLHTML.HTMLRewriter.Builder.init(), .context = .{}, }; - return HTMLRewriter.Class.make(ctx, rewriter); + return rewriter; } - pub fn on( + pub fn on_( this: *HTMLRewriter, global: *JSGlobalObject, selector_name: ZigString, - thisObject: JSC.C.JSObjectRef, + callFrame: *JSC.CallFrame, listener: JSValue, - exception: JSC.C.ExceptionRef, ) JSValue { var selector_slice = std.fmt.allocPrint(bun.default_allocator, "{}", .{selector_name}) catch unreachable; var selector = LOLHTML.HTMLSelector.parse(selector_slice) catch return throwLOLHTMLError(global); - var handler_ = ElementHandler.init(global, listener, exception) catch return .zero; - if (exception.* != null) { - selector.deinit(); - return JSValue.fromRef(exception.*); - } + var handler_ = ElementHandler.init(global, listener) catch return .zero; var handler = getAllocator(global).create(ElementHandler) catch unreachable; handler.* = handler_; @@ -144,20 +97,16 @@ pub const HTMLRewriter = struct { this.context.selectors.append(bun.default_allocator, selector) catch unreachable; this.context.element_handlers.append(bun.default_allocator, handler) catch unreachable; - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn onDocument( + pub fn onDocument_( this: *HTMLRewriter, global: *JSGlobalObject, listener: JSValue, - thisObject: JSC.C.JSObjectRef, - exception: JSC.C.ExceptionRef, + callFrame: *JSC.CallFrame, ) JSValue { - var handler_ = DocumentHandler.init(global, listener, exception) catch return .zero; - if (exception.* != null) { - return JSValue.fromRef(exception.*); - } + var handler_ = DocumentHandler.init(global, listener) catch return .zero; var handler = getAllocator(global).create(DocumentHandler) catch unreachable; handler.* = handler_; @@ -194,10 +143,10 @@ pub const HTMLRewriter = struct { ); this.context.document_handlers.append(bun.default_allocator, handler) catch unreachable; - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn finalize(this: *HTMLRewriter) void { + pub fn finalize(this: *HTMLRewriter) callconv(.C) void { this.finalizeWithoutDestroy(); bun.default_allocator.destroy(this); } @@ -220,7 +169,7 @@ pub const HTMLRewriter = struct { return result.toJS(global); } - pub fn transform(this: *HTMLRewriter, global: *JSGlobalObject, response: *Response) JSValue { + pub fn transform_(this: *HTMLRewriter, global: *JSGlobalObject, response: *Response) JSValue { if (response.body.len() == 0 and !(response.body.value == .Blob and response.body.value.Blob.needsToReadFile())) { return this.returnEmptyResponse(global, response); } @@ -228,6 +177,10 @@ pub const HTMLRewriter = struct { return this.beginTransform(global, response); } + pub const on = JSC.wrapInstanceMethod(HTMLRewriter, "on_", false); + pub const onDocument = JSC.wrapInstanceMethod(HTMLRewriter, "onDocument_", false); + pub const transform = JSC.wrapInstanceMethod(HTMLRewriter, "transform_", false); + pub const HTMLRewriterLoader = struct { rewriter: *LOLHTML.HTMLRewriter, finalized: bool = false, @@ -727,18 +680,16 @@ const DocumentHandler = struct { "onEndCallback", ); - pub fn init(global: *JSGlobalObject, thisObject: JSValue, exception: JSC.C.ExceptionRef) !DocumentHandler { + pub fn init(global: *JSGlobalObject, thisObject: JSValue) !DocumentHandler { var handler = DocumentHandler{ .thisObject = thisObject, .global = global, }; if (!thisObject.isObject()) { - JSC.throwInvalidArguments( + global.throwInvalidArguments( "Expected object", .{}, - global, - exception, ); return error.InvalidArguments; } @@ -763,66 +714,66 @@ const DocumentHandler = struct { if (thisObject.get(global, "doctype")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("doctype must be a function", .{}, global, exception); + global.throwInvalidArguments("doctype must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onDocTypeCallback = val; } if (thisObject.get(global, "comments")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("comments must be a function", .{}, global, exception); + global.throwInvalidArguments("comments must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onCommentCallback = val; } if (thisObject.get(global, "text")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("text must be a function", .{}, global, exception); + global.throwInvalidArguments("text must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onTextCallback = val; } if (thisObject.get(global, "end")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("end must be a function", .{}, global, exception); + global.throwInvalidArguments("end must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onEndCallback = val; } - JSC.C.JSValueProtect(global, thisObject.asObjectRef()); + thisObject.protect(); return handler; } pub fn deinit(this: *DocumentHandler) void { if (this.onDocTypeCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onDocTypeCallback = null; } if (this.onCommentCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onCommentCallback = null; } if (this.onTextCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onTextCallback = null; } if (this.onEndCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onEndCallback = null; } - JSC.C.JSValueUnprotect(this.global, this.thisObject.asObjectRef()); + this.thisObject.unprotect(); } }; @@ -840,19 +791,13 @@ fn HandlerCallback( @field(zig_element, field_name) = value; defer @field(zig_element, field_name) = null; - // At the end of this scope, the value is no longer valid - var args = [1]JSC.C.JSObjectRef{ - ZigType.Class.make(this.global, zig_element), - }; - var result = JSC.C.JSObjectCallAsFunctionReturnValue( + var result = @field(this, callback_name).?.callWithThis( this.global, - @field(this, callback_name).?, if (comptime @hasField(HandlerType, "thisObject")) @field(this, "thisObject") else JSValue.zero, - 1, - &args, + &.{zig_element.toJS(this.global)}, ); if (!result.isUndefinedOrNull()) { @@ -882,7 +827,7 @@ const ElementHandler = struct { global: *JSGlobalObject, ctx: ?*HTMLRewriter.BufferOutputSink = null, - pub fn init(global: *JSGlobalObject, thisObject: JSValue, exception: JSC.C.ExceptionRef) !ElementHandler { + pub fn init(global: *JSGlobalObject, thisObject: JSValue) !ElementHandler { var handler = ElementHandler{ .thisObject = thisObject, .global = global, @@ -902,63 +847,61 @@ const ElementHandler = struct { } if (!thisObject.isObject()) { - JSC.throwInvalidArguments( + global.throwInvalidArguments( "Expected object", .{}, - global, - exception, ); return error.InvalidArguments; } if (thisObject.get(global, "element")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("element must be a function", .{}, global, exception); + global.throwInvalidArguments("element must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onElementCallback = val; } if (thisObject.get(global, "comments")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("comments must be a function", .{}, global, exception); + global.throwInvalidArguments("comments must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onCommentCallback = val; } if (thisObject.get(global, "text")) |val| { if (val.isUndefinedOrNull() or !val.isCell() or !val.isCallable(global.vm())) { - JSC.throwInvalidArguments("text must be a function", .{}, global, exception); + global.throwInvalidArguments("text must be a function", .{}); return error.InvalidArguments; } - JSC.C.JSValueProtect(global, val.asObjectRef()); + val.protect(); handler.onTextCallback = val; } - JSC.C.JSValueProtect(global, thisObject.asObjectRef()); + thisObject.protect(); return handler; } pub fn deinit(this: *ElementHandler) void { if (this.onElementCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onElementCallback = null; } if (this.onCommentCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onCommentCallback = null; } if (this.onTextCallback) |cb| { - JSC.C.JSValueUnprotect(this.global, cb.asObjectRef()); + cb.unprotect(); this.onTextCallback = null; } - JSC.C.JSValueUnprotect(this.global, this.thisObject.asObjectRef()); + this.thisObject.unprotect(); } pub fn onElement(this: *ElementHandler, value: *LOLHTML.Element) bool { @@ -992,10 +935,6 @@ pub const ContentOptions = struct { html: bool = false, }; -const getterWrap = JSC.getterWrap; -const setterWrap = JSC.setterWrap; -const wrap = JSC.wrapSync; - fn throwLOLHTMLError(global: *JSGlobalObject) JSValue { const err = LOLHTML.HTMLString.lastError(); defer err.deinit(); @@ -1009,40 +948,9 @@ fn htmlStringValue(input: LOLHTML.HTMLString, globalObject: *JSGlobalObject) JSV pub const TextChunk = struct { text_chunk: ?*LOLHTML.TextChunk = null, - pub const Class = NewClass( - TextChunk, - .{ .name = "TextChunk" }, - .{ - .before = .{ - .rfn = wrap(TextChunk, "before"), - }, - .after = .{ - .rfn = wrap(TextChunk, "after"), - }, - - .replace = .{ - .rfn = wrap(TextChunk, "replace"), - }, + pub usingnamespace JSC.Codegen.JSTextChunk; - .remove = .{ - .rfn = wrap(TextChunk, "remove"), - }, - .finalize = finalize, - }, - .{ - .removed = .{ - .get = getterWrap(TextChunk, "removed"), - }, - .lastInTextNode = .{ - .get = getterWrap(TextChunk, "lastInTextNode"), - }, - .text = .{ - .get = getterWrap(TextChunk, "getText"), - }, - }, - ); - - fn contentHandler(this: *TextChunk, comptime Callback: (fn (*LOLHTML.TextChunk, []const u8, bool) LOLHTML.Error!void), thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *TextChunk, comptime Callback: (fn (*LOLHTML.TextChunk, []const u8, bool) LOLHTML.Error!void), callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { if (this.text_chunk == null) return JSC.JSValue.jsUndefined(); var content_slice = content.toSlice(bun.default_allocator); @@ -1054,61 +962,72 @@ pub const TextChunk = struct { contentOptions != null and contentOptions.?.html, ) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn before( + pub fn before_( this: *TextChunk, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.TextChunk.before, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.TextChunk.before, callFrame, globalObject, content, contentOptions); } - pub fn after( + pub fn after_( this: *TextChunk, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.TextChunk.after, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.TextChunk.after, callFrame, globalObject, content, contentOptions); } - pub fn replace( + pub fn replace_( this: *TextChunk, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.TextChunk.replace, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.TextChunk.replace, callFrame, globalObject, content, contentOptions); } - pub fn remove(this: *TextChunk, thisObject: js.JSObjectRef) JSValue { + pub const before = JSC.wrapInstanceMethod(TextChunk, "before_", false); + pub const after = JSC.wrapInstanceMethod(TextChunk, "after_", false); + pub const replace = JSC.wrapInstanceMethod(TextChunk, "replace_", false); + + pub fn remove( + this: *TextChunk, + _: *JSGlobalObject, + callFrame: *JSC.CallFrame, + ) callconv(.C) JSValue { if (this.text_chunk == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); this.text_chunk.?.remove(); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn getText(this: *TextChunk, global: *JSGlobalObject) JSValue { + pub fn getText( + this: *TextChunk, + global: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.text_chunk == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); return ZigString.init(this.text_chunk.?.getContent().slice()).withEncoding().toValueGC(global); } - pub fn removed(this: *TextChunk, _: *JSGlobalObject) JSValue { - return JSC.JSValue.jsBoolean(this.text_chunk.?.isRemoved()); + pub fn removed(this: *TextChunk, _: *JSGlobalObject) callconv(.C) JSValue { + return JSValue.jsBoolean(this.text_chunk.?.isRemoved()); } - pub fn lastInTextNode(this: *TextChunk, _: *JSGlobalObject) JSValue { - return JSC.JSValue.jsBoolean(this.text_chunk.?.isLastInTextNode()); + pub fn lastInTextNode(this: *TextChunk, _: *JSGlobalObject) callconv(.C) JSValue { + return JSValue.jsBoolean(this.text_chunk.?.isLastInTextNode()); } - pub fn finalize(this: *TextChunk) void { + pub fn finalize(this: *TextChunk) callconv(.C) void { this.text_chunk = null; bun.default_allocator.destroy(this); } @@ -1117,85 +1036,64 @@ pub const TextChunk = struct { pub const DocType = struct { doctype: ?*LOLHTML.DocType = null, - pub fn finalize(this: *DocType) void { + pub fn finalize(this: *DocType) callconv(.C) void { this.doctype = null; bun.default_allocator.destroy(this); } - pub const Class = NewClass( - DocType, - .{ - .name = "DocType", - }, - .{ - .finalize = finalize, - }, - .{ - .name = .{ - .get = getterWrap(DocType, "name"), - }, - .systemId = .{ - .get = getterWrap(DocType, "systemId"), - }, - - .publicId = .{ - .get = getterWrap(DocType, "publicId"), - }, - }, - ); + pub usingnamespace JSC.Codegen.JSDocType; /// The doctype name. - pub fn name(this: *DocType, global: *JSGlobalObject) JSValue { + pub fn name( + this: *DocType, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.doctype == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); const str = this.doctype.?.getName().slice(); if (str.len == 0) return JSValue.jsNull(); - return ZigString.init(str).toValueGC(global); + return ZigString.init(str).toValueGC(globalObject); } - pub fn systemId(this: *DocType, global: *JSGlobalObject) JSValue { + pub fn systemId( + this: *DocType, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.doctype == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); const str = this.doctype.?.getSystemId().slice(); if (str.len == 0) return JSValue.jsNull(); - return ZigString.init(str).toValueGC(global); + return ZigString.init(str).toValueGC(globalObject); } - pub fn publicId(this: *DocType, global: *JSGlobalObject) JSValue { + pub fn publicId( + this: *DocType, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.doctype == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); const str = this.doctype.?.getPublicId().slice(); if (str.len == 0) return JSValue.jsNull(); - return ZigString.init(str).toValueGC(global); + return ZigString.init(str).toValueGC(globalObject); } }; pub const DocEnd = struct { doc_end: ?*LOLHTML.DocEnd, - pub fn finalize(this: *DocEnd) void { + pub fn finalize(this: *DocEnd) callconv(.C) void { this.doc_end = null; bun.default_allocator.destroy(this); } - pub const Class = NewClass( - DocEnd, - .{ .name = "DocEnd" }, - .{ - .finalize = finalize, - .append = .{ - .rfn = wrap(DocEnd, "append"), - }, - }, - .{}, - ); + pub usingnamespace JSC.Codegen.JSDocEnd; - fn contentHandler(this: *DocEnd, comptime Callback: (fn (*LOLHTML.DocEnd, []const u8, bool) LOLHTML.Error!void), thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *DocEnd, comptime Callback: (fn (*LOLHTML.DocEnd, []const u8, bool) LOLHTML.Error!void), callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { if (this.doc_end == null) return JSValue.jsNull(); @@ -1208,60 +1106,33 @@ pub const DocEnd = struct { contentOptions != null and contentOptions.?.html, ) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn append( + pub fn append_( this: *DocEnd, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.DocEnd.append, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.DocEnd.append, callFrame, globalObject, content, contentOptions); } + + pub const append = JSC.wrapInstanceMethod(DocEnd, "append_", false); }; pub const Comment = struct { comment: ?*LOLHTML.Comment = null, - pub fn finalize(this: *Comment) void { + pub fn finalize(this: *Comment) callconv(.C) void { this.comment = null; bun.default_allocator.destroy(this); } - pub const Class = NewClass( - Comment, - .{ .name = "Comment" }, - .{ - .before = .{ - .rfn = wrap(Comment, "before"), - }, - .after = .{ - .rfn = wrap(Comment, "after"), - }, + pub usingnamespace JSC.Codegen.JSComment; - .replace = .{ - .rfn = wrap(Comment, "replace"), - }, - - .remove = .{ - .rfn = wrap(Comment, "remove"), - }, - .finalize = finalize, - }, - .{ - .removed = .{ - .get = getterWrap(Comment, "removed"), - }, - .text = .{ - .get = getterWrap(Comment, "getText"), - .set = setterWrap(Comment, "setText"), - }, - }, - ); - - fn contentHandler(this: *Comment, comptime Callback: (fn (*LOLHTML.Comment, []const u8, bool) LOLHTML.Error!void), thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *Comment, comptime Callback: (fn (*LOLHTML.Comment, []const u8, bool) LOLHTML.Error!void), callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { if (this.comment == null) return JSValue.jsNull(); var content_slice = content.toSlice(bun.default_allocator); @@ -1273,84 +1144,100 @@ pub const Comment = struct { contentOptions != null and contentOptions.?.html, ) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn before( + pub fn before_( this: *Comment, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.Comment.before, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.Comment.before, callFrame, globalObject, content, contentOptions); } - pub fn after( + pub fn after_( this: *Comment, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.Comment.after, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.Comment.after, callFrame, globalObject, content, contentOptions); } - pub fn replace( + pub fn replace_( this: *Comment, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.Comment.replace, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.Comment.replace, callFrame, globalObject, content, contentOptions); } - pub fn remove(this: *Comment, thisObject: js.JSObjectRef) JSValue { + pub const before = JSC.wrapInstanceMethod(Comment, "before_", false); + pub const after = JSC.wrapInstanceMethod(Comment, "after_", false); + pub const replace = JSC.wrapInstanceMethod(Comment, "replace_", false); + + pub fn remove( + this: *Comment, + _: *JSGlobalObject, + callFrame: *JSC.CallFrame, + ) callconv(.C) JSValue { if (this.comment == null) return JSValue.jsNull(); this.comment.?.remove(); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn getText(this: *Comment, global: *JSGlobalObject) JSValue { + pub fn getText( + this: *Comment, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.comment == null) return JSValue.jsNull(); - return this.comment.?.getText().toJS(global); + return this.comment.?.getText().toJS(globalObject); } pub fn setText( this: *Comment, - value: JSValue, - exception: JSC.C.ExceptionRef, global: *JSGlobalObject, - ) void { + value: JSValue, + ) callconv(.C) bool { if (this.comment == null) - return; + return false; var text = value.toSlice(global, bun.default_allocator); defer text.deinit(); this.comment.?.setText(text.slice()) catch { - exception.* = throwLOLHTMLError(global).asObjectRef(); + global.throwValue(throwLOLHTMLError(global)); + return false; }; + + return true; } - pub fn removed(this: *Comment, _: *JSGlobalObject) JSValue { + pub fn removed( + this: *Comment, + _: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.comment == null) - return JSC.JSValue.jsUndefined(); - return JSC.JSValue.jsBoolean(this.comment.?.isRemoved()); + return JSValue.jsUndefined(); + return JSValue.jsBoolean(this.comment.?.isRemoved()); } }; pub const EndTag = struct { end_tag: ?*LOLHTML.EndTag, - pub fn finalize(this: *EndTag) void { + pub fn finalize(this: *EndTag) callconv(.C) void { this.end_tag = null; bun.default_allocator.destroy(this); } pub const Handler = struct { - callback: ?JSC.JSValue, + callback: ?JSValue, global: *JSGlobalObject, pub const onEndTag = HandlerCallback( @@ -1364,31 +1251,9 @@ pub const EndTag = struct { pub const onEndTagHandler = LOLHTML.DirectiveHandler(LOLHTML.EndTag, Handler, onEndTag); }; - pub const Class = NewClass( - EndTag, - .{ .name = "EndTag" }, - .{ - .before = .{ - .rfn = wrap(EndTag, "before"), - }, - .after = .{ - .rfn = wrap(EndTag, "after"), - }, + pub usingnamespace JSC.Codegen.JSEndTag; - .remove = .{ - .rfn = wrap(EndTag, "remove"), - }, - .finalize = finalize, - }, - .{ - .name = .{ - .get = getterWrap(EndTag, "getName"), - .set = setterWrap(EndTag, "setName"), - }, - }, - ); - - fn contentHandler(this: *EndTag, comptime Callback: (fn (*LOLHTML.EndTag, []const u8, bool) LOLHTML.Error!void), thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + fn contentHandler(this: *EndTag, comptime Callback: (fn (*LOLHTML.EndTag, []const u8, bool) LOLHTML.Error!void), callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { if (this.end_tag == null) return JSValue.jsNull(); @@ -1401,128 +1266,87 @@ pub const EndTag = struct { contentOptions != null and contentOptions.?.html, ) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn before( + pub fn before_( this: *EndTag, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.EndTag.before, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.EndTag.before, callFrame, globalObject, content, contentOptions); } - pub fn after( + pub fn after_( this: *EndTag, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.EndTag.after, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.EndTag.after, callFrame, globalObject, content, contentOptions); } - pub fn replace( + pub fn replace_( this: *EndTag, - thisObject: js.JSObjectRef, + callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions, ) JSValue { - return this.contentHandler(LOLHTML.EndTag.replace, thisObject, globalObject, content, contentOptions); + return this.contentHandler(LOLHTML.EndTag.replace, callFrame, globalObject, content, contentOptions); } - pub fn remove(this: *EndTag, thisObject: js.JSObjectRef) JSValue { + pub const before = JSC.wrapInstanceMethod(EndTag, "before_", false); + pub const after = JSC.wrapInstanceMethod(EndTag, "after_", false); + pub const replace = JSC.wrapInstanceMethod(EndTag, "replace_", false); + + pub fn remove( + this: *EndTag, + _: *JSGlobalObject, + callFrame: *JSC.CallFrame, + ) callconv(.C) JSValue { if (this.end_tag == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); this.end_tag.?.remove(); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - pub fn getName(this: *EndTag, global: *JSGlobalObject) JSValue { + pub fn getName( + this: *EndTag, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.end_tag == null) - return JSC.JSValue.jsUndefined(); + return JSValue.jsUndefined(); - return this.end_tag.?.getName().toJS(global); + return this.end_tag.?.getName().toJS(globalObject); } pub fn setName( this: *EndTag, - value: JSValue, - exception: JSC.C.ExceptionRef, global: *JSGlobalObject, - ) void { + value: JSValue, + ) callconv(.C) bool { if (this.end_tag == null) - return; + return false; var text = value.toSlice(global, bun.default_allocator); defer text.deinit(); this.end_tag.?.setName(text.slice()) catch { - exception.* = throwLOLHTMLError(global).asObjectRef(); + global.throwValue(throwLOLHTMLError(global)); + return false; }; + + return true; } }; pub const AttributeIterator = struct { iterator: ?*LOLHTML.Attribute.Iterator = null, - const attribute_iterator_path: string = "file:///bun-vfs/lolhtml/AttributeIterator.js"; - const attribute_iterator_code: string = - \\"use strict"; - \\ - \\class AttributeIterator { - \\ constructor(internal) { - \\ this.#iterator = internal; - \\ } - \\ - \\ #iterator; - \\ - \\ [Symbol.iterator]() { - \\ return this; - \\ } - \\ - \\ next() { - \\ if (this.#iterator === null) - \\ return {done: true}; - \\ var value = this.#iterator.next(); - \\ if (!value) { - \\ this.#iterator = null; - \\ return {done: true}; - \\ } - \\ return {done: false, value: value}; - \\ } - \\} - \\ - \\return new AttributeIterator(internal1); - ; - threadlocal var attribute_iterator_class: JSC.C.JSObjectRef = undefined; - threadlocal var attribute_iterator_loaded: bool = false; - - pub fn getAttributeIteratorJSClass(global: *JSGlobalObject) JSValue { - if (attribute_iterator_loaded) - return JSC.JSValue.fromRef(attribute_iterator_class); - attribute_iterator_loaded = true; - var exception_ptr: ?[*]JSC.JSValueRef = null; - var name = JSC.C.JSStringCreateStatic("AttributeIteratorGetter", "AttributeIteratorGetter".len); - var param_name = JSC.C.JSStringCreateStatic("internal1", "internal1".len); - var attribute_iterator_class_ = JSC.C.JSObjectMakeFunction( - global, - name, - 1, - &[_]JSC.C.JSStringRef{param_name}, - JSC.C.JSStringCreateStatic(attribute_iterator_code.ptr, attribute_iterator_code.len), - JSC.C.JSStringCreateStatic(attribute_iterator_path.ptr, attribute_iterator_path.len), - 0, - exception_ptr, - ); - JSC.C.JSValueProtect(global, attribute_iterator_class_); - attribute_iterator_class = attribute_iterator_class_; - return JSC.JSValue.fromRef(attribute_iterator_class); - } - - pub fn finalize(this: *AttributeIterator) void { + pub fn finalize(this: *AttributeIterator) callconv(.C) void { if (this.iterator) |iter| { iter.deinit(); this.iterator = null; @@ -1530,121 +1354,53 @@ pub const AttributeIterator = struct { bun.default_allocator.destroy(this); } - pub const Class = NewClass( - AttributeIterator, - .{ .name = "AttributeIterator" }, - .{ - .next = .{ - .rfn = wrap(AttributeIterator, "next"), - }, - .finalize = finalize, - }, - .{}, - ); + pub usingnamespace JSC.Codegen.JSAttributeIterator; + + pub fn next(this: *AttributeIterator, globalObject: *JSGlobalObject, _: *JSC.CallFrame) callconv(.C) JSValue { + const done_label = JSC.ZigString.static("done"); + const value_label = JSC.ZigString.static("value"); - const value_ = ZigString.init("value"); - const done_ = ZigString.init("done"); - pub fn next( - this: *AttributeIterator, - globalObject: *JSGlobalObject, - ) JSValue { if (this.iterator == null) { - return JSC.JSValue.jsNull(); + return JSValue.createObject2(globalObject, done_label, value_label, JSValue.jsBoolean(true), JSValue.jsUndefined()); } var attribute = this.iterator.?.next() orelse { this.iterator.?.deinit(); this.iterator = null; - return JSC.JSValue.jsNull(); + return JSValue.createObject2(globalObject, done_label, value_label, JSValue.jsBoolean(true), JSValue.jsUndefined()); }; const value = attribute.value(); const name = attribute.name(); - return bun.String.toJSArray( + return JSValue.createObject2(globalObject, done_label, value_label, JSValue.jsBoolean(false), bun.String.toJSArray( globalObject, &[_]bun.String{ name.toString(), value.toString(), }, - ); + )); + } + + pub fn getThis(_: *AttributeIterator, _: *JSGlobalObject, callFrame: *JSC.CallFrame) callconv(.C) JSValue { + return callFrame.this(); } }; pub const Element = struct { element: ?*LOLHTML.Element = null, - pub const Class = NewClass( - Element, - .{ .name = "Element" }, - .{ - .getAttribute = .{ - .rfn = wrap(Element, "getAttribute"), - }, - .hasAttribute = .{ - .rfn = wrap(Element, "hasAttribute"), - }, - .setAttribute = .{ - .rfn = wrap(Element, "setAttribute"), - }, - .removeAttribute = .{ - .rfn = wrap(Element, "removeAttribute"), - }, - .before = .{ - .rfn = wrap(Element, "before"), - }, - .after = .{ - .rfn = wrap(Element, "after"), - }, - .prepend = .{ - .rfn = wrap(Element, "prepend"), - }, - .append = .{ - .rfn = wrap(Element, "append"), - }, - .replace = .{ - .rfn = wrap(Element, "replace"), - }, - .setInnerContent = .{ - .rfn = wrap(Element, "setInnerContent"), - }, - .remove = .{ - .rfn = wrap(Element, "remove"), - }, - .removeAndKeepContent = .{ - .rfn = wrap(Element, "removeAndKeepContent"), - }, - .onEndTag = .{ - .rfn = wrap(Element, "onEndTag"), - }, - .finalize = finalize, - }, - .{ - .tagName = .{ - .get = getterWrap(Element, "getTagName"), - .set = setterWrap(Element, "setTagName"), - }, - .removed = .{ - .get = getterWrap(Element, "getRemoved"), - }, - .namespaceURI = .{ - .get = getterWrap(Element, "getNamespaceURI"), - }, - .attributes = .{ - .get = getterWrap(Element, "getAttributes"), - }, - }, - ); + pub usingnamespace JSC.Codegen.JSElement; - pub fn finalize(this: *Element) void { + pub fn finalize(this: *Element) callconv(.C) void { this.element = null; bun.default_allocator.destroy(this); } - pub fn onEndTag( + pub fn onEndTag_( this: *Element, globalObject: *JSGlobalObject, function: JSValue, - thisObject: JSC.C.JSObjectRef, + callFrame: *JSC.CallFrame, ) JSValue { if (this.element == null) return JSValue.jsNull(); @@ -1660,14 +1416,14 @@ pub const Element = struct { return throwLOLHTMLError(globalObject); }; - JSC.C.JSValueProtect(globalObject.ref(), function.asObjectRef()); - return JSValue.fromRef(thisObject); + function.protect(); + return callFrame.this(); } // // fn wrap(comptime name: string) /// Returns the value for a given attribute name: ZigString on the element, or null if it is not found. - pub fn getAttribute(this: *Element, globalObject: *JSGlobalObject, name: ZigString) JSValue { + pub fn getAttribute_(this: *Element, globalObject: *JSGlobalObject, name: ZigString) JSValue { if (this.element == null) return JSValue.jsNull(); @@ -1676,13 +1432,13 @@ pub const Element = struct { var attr = this.element.?.getAttribute(slice.slice()); if (attr.len == 0) - return JSC.JSValue.jsNull(); + return JSValue.jsNull(); return attr.toJS(globalObject); } /// Returns a boolean indicating whether an attribute exists on the element. - pub fn hasAttribute(this: *Element, global: *JSGlobalObject, name: ZigString) JSValue { + pub fn hasAttribute_(this: *Element, global: *JSGlobalObject, name: ZigString) JSValue { if (this.element == null) return JSValue.jsBoolean(false); @@ -1692,7 +1448,7 @@ pub const Element = struct { } /// Sets an attribute to a provided value, creating the attribute if it does not exist. - pub fn setAttribute(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, name_: ZigString, value_: ZigString) JSValue { + pub fn setAttribute_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, name_: ZigString, value_: ZigString) JSValue { if (this.element == null) return JSValue.jsUndefined(); @@ -1702,11 +1458,11 @@ pub const Element = struct { var value_slice = value_.toSlice(bun.default_allocator); defer value_slice.deinit(); this.element.?.setAttribute(name_slice.slice(), value_slice.slice()) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } /// Removes the attribute. - pub fn removeAttribute(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, name: ZigString) JSValue { + pub fn removeAttribute_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, name: ZigString) JSValue { if (this.element == null) return JSValue.jsUndefined(); @@ -1716,10 +1472,16 @@ pub const Element = struct { this.element.?.removeAttribute( name_slice.slice(), ) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - fn contentHandler(this: *Element, comptime Callback: (fn (*LOLHTML.Element, []const u8, bool) LOLHTML.Error!void), thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub const onEndTag = JSC.wrapInstanceMethod(Element, "onEndTag_", false); + pub const getAttribute = JSC.wrapInstanceMethod(Element, "getAttribute_", false); + pub const hasAttribute = JSC.wrapInstanceMethod(Element, "hasAttribute_", false); + pub const setAttribute = JSC.wrapInstanceMethod(Element, "setAttribute_", false); + pub const removeAttribute = JSC.wrapInstanceMethod(Element, "removeAttribute_", false); + + fn contentHandler(this: *Element, comptime Callback: (fn (*LOLHTML.Element, []const u8, bool) LOLHTML.Error!void), callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { if (this.element == null) return JSValue.jsUndefined(); @@ -1732,15 +1494,15 @@ pub const Element = struct { contentOptions != null and contentOptions.?.html, ) catch return throwLOLHTMLError(globalObject); - return JSValue.fromRef(thisObject); + return callFrame.this(); } /// Inserts content before the element. - pub fn before(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn before_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.before, - thisObject, + callFrame, globalObject, content, contentOptions, @@ -1748,11 +1510,11 @@ pub const Element = struct { } /// Inserts content right after the element. - pub fn after(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn after_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.after, - thisObject, + callFrame, globalObject, content, contentOptions, @@ -1760,11 +1522,11 @@ pub const Element = struct { } /// Inserts content right after the start tag of the element. - pub fn prepend(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn prepend_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.prepend, - thisObject, + callFrame, globalObject, content, contentOptions, @@ -1772,11 +1534,11 @@ pub const Element = struct { } /// Inserts content right before the end tag of the element. - pub fn append(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn append_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.append, - thisObject, + callFrame, globalObject, content, contentOptions, @@ -1784,11 +1546,11 @@ pub const Element = struct { } /// Removes the element and inserts content in place of it. - pub fn replace(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn replace_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.replace, - thisObject, + callFrame, globalObject, content, contentOptions, @@ -1796,61 +1558,88 @@ pub const Element = struct { } /// Replaces content of the element. - pub fn setInnerContent(this: *Element, thisObject: js.JSObjectRef, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { + pub fn setInnerContent_(this: *Element, callFrame: *JSC.CallFrame, globalObject: *JSGlobalObject, content: ZigString, contentOptions: ?ContentOptions) JSValue { return contentHandler( this, LOLHTML.Element.setInnerContent, - thisObject, + callFrame, globalObject, content, contentOptions, ); } + pub const before = JSC.wrapInstanceMethod(Element, "before_", false); + pub const after = JSC.wrapInstanceMethod(Element, "after_", false); + pub const prepend = JSC.wrapInstanceMethod(Element, "prepend_", false); + pub const append = JSC.wrapInstanceMethod(Element, "append_", false); + pub const replace = JSC.wrapInstanceMethod(Element, "replace_", false); + pub const setInnerContent = JSC.wrapInstanceMethod(Element, "setInnerContent_", false); + /// Removes the element with all its content. - pub fn remove(this: *Element, thisObject: js.JSObjectRef) JSValue { + pub fn remove( + this: *Element, + _: *JSGlobalObject, + callFrame: *JSC.CallFrame, + ) callconv(.C) JSValue { if (this.element == null) return JSValue.jsUndefined(); this.element.?.remove(); - return JSValue.fromRef(thisObject); + return callFrame.this(); } /// Removes the start tag and end tag of the element but keeps its inner content intact. - pub fn removeAndKeepContent(this: *Element, thisObject: js.JSObjectRef) JSValue { + pub fn removeAndKeepContent( + this: *Element, + _: *JSGlobalObject, + callFrame: *JSC.CallFrame, + ) callconv(.C) JSValue { if (this.element == null) return JSValue.jsUndefined(); this.element.?.removeAndKeepContent(); - return JSValue.fromRef(thisObject); + return callFrame.this(); } - - pub fn getTagName(this: *Element, globalObject: *JSGlobalObject) JSValue { + pub fn getTagName(this: *Element, globalObject: *JSGlobalObject) callconv(.C) JSValue { if (this.element == null) return JSValue.jsUndefined(); return htmlStringValue(this.element.?.tagName(), globalObject); } - pub fn setTagName(this: *Element, value: JSValue, exception: JSC.C.ExceptionRef, global: *JSGlobalObject) void { + pub fn setTagName( + this: *Element, + global: *JSGlobalObject, + value: JSValue, + ) callconv(.C) bool { if (this.element == null) - return; + return false; var text = value.toSlice(global, bun.default_allocator); defer text.deinit(); this.element.?.setTagName(text.slice()) catch { - exception.* = throwLOLHTMLError(global).asObjectRef(); + global.throwValue(throwLOLHTMLError(global)); + return false; }; + + return true; } - pub fn getRemoved(this: *Element, _: *JSGlobalObject) JSValue { + pub fn getRemoved( + this: *Element, + _: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.element == null) return JSValue.jsUndefined(); - return JSC.JSValue.jsBoolean(this.element.?.isRemoved()); + return JSValue.jsBoolean(this.element.?.isRemoved()); } - pub fn getNamespaceURI(this: *Element, globalObject: *JSGlobalObject) JSValue { + pub fn getNamespaceURI( + this: *Element, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.element == null) return JSValue.jsUndefined(); var str = bun.String.create(std.mem.span(this.element.?.namespaceURI())); @@ -1858,25 +1647,19 @@ pub const Element = struct { return str.toJS(globalObject); } - pub fn getAttributes(this: *Element, globalObject: *JSGlobalObject) JSValue { + pub fn getAttributes( + this: *Element, + globalObject: *JSGlobalObject, + ) callconv(.C) JSValue { if (this.element == null) return JSValue.jsUndefined(); var iter = this.element.?.attributes() orelse return throwLOLHTMLError(globalObject); var attr_iter = bun.default_allocator.create(AttributeIterator) catch unreachable; attr_iter.* = .{ .iterator = iter }; - var attr = AttributeIterator.Class.make(globalObject.ref(), attr_iter); - JSC.C.JSValueProtect(globalObject.ref(), attr); - defer JSC.C.JSValueUnprotect(globalObject.ref(), attr); - return JSC.JSValue.fromRef( - JSC.C.JSObjectCallAsFunction( - globalObject.ref(), - AttributeIterator.getAttributeIteratorJSClass(globalObject).asObjectRef(), - null, - 1, - @as([*]JSC.C.JSObjectRef, @ptrCast(&attr)), - null, - ), - ); + var js_attr_iter = attr_iter.toJS(globalObject); + js_attr_iter.protect(); + defer js_attr_iter.unprotect(); + return js_attr_iter; } }; diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig index d8a758dc2..2bac8bf45 100644 --- a/src/bun.js/base.zig +++ b/src/bun.js/base.zig @@ -2175,16 +2175,9 @@ const SHA512_256 = JSC.API.Bun.Crypto.SHA512_256; const MD5_SHA1 = JSC.API.Bun.Crypto.MD5_SHA1; const FFI = JSC.FFI; pub const JSPrivateDataPtr = TaggedPointerUnion(.{ - AttributeIterator, - Comment, DebugServer, DebugSSLServer, - DocEnd, - DocType, - Element, - EndTag, FetchEvent, - HTMLRewriter, JSNode, LazyPropertiesObject, @@ -2193,7 +2186,6 @@ pub const JSPrivateDataPtr = TaggedPointerUnion(.{ Server, SSLServer, - TextChunk, FFI, }); @@ -2244,25 +2236,6 @@ pub fn getterWrap(comptime Container: type, comptime name: string) GetterType(Co }.callback; } -pub fn setterWrap(comptime Container: type, comptime name: string) SetterType(Container) { - return struct { - const FunctionType = @TypeOf(@field(Container, name)); - const FunctionTypeInfo: std.builtin.Type.Fn = @typeInfo(FunctionType).Fn; - - pub fn callback( - this: *Container, - ctx: js.JSContextRef, - _: js.JSObjectRef, - _: js.JSStringRef, - value: js.JSValueRef, - exception: js.ExceptionRef, - ) bool { - @call(.auto, @field(Container, name), .{ this, JSC.JSValue.fromRef(value), exception, ctx.ptr() }); - return exception.* == null; - } - }.callback; -} - fn GetterType(comptime Container: type) type { return fn ( this: *Container, @@ -2273,17 +2246,6 @@ fn GetterType(comptime Container: type) type { ) js.JSObjectRef; } -fn SetterType(comptime Container: type) type { - return fn ( - this: *Container, - ctx: js.JSContextRef, - obj: js.JSObjectRef, - prop: js.JSStringRef, - value: js.JSValueRef, - exception: js.ExceptionRef, - ) bool; -} - fn MethodType(comptime Container: type, comptime has_container: bool) type { return fn ( this: if (has_container) *Container else void, @@ -2918,6 +2880,9 @@ pub fn wrapInstanceMethod( *JSC.JSGlobalObject => { args[i] = globalThis.ptr(); }, + *JSC.CallFrame => { + args[i] = callframe; + }, JSC.Node.StringOrBuffer => { const arg = iter.nextEat() orelse { globalThis.throwInvalidArguments("expected string or buffer", .{}); diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp index 782c6e326..d986ae590 100644 --- a/src/bun.js/bindings/JSSink.cpp +++ b/src/bun.js/bindings/JSSink.cpp @@ -806,7 +806,7 @@ void JSReadableArrayBufferSinkController::detach() JSC::MarkedArgumentBuffer arguments; arguments.append(readableStream); arguments.append(jsUndefined()); - JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); } m_weakReadableStream.clear(); @@ -1060,7 +1060,7 @@ void JSReadableFileSinkController::detach() JSC::MarkedArgumentBuffer arguments; arguments.append(readableStream); arguments.append(jsUndefined()); - JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); } m_weakReadableStream.clear(); @@ -1314,7 +1314,7 @@ void JSReadableHTTPResponseSinkController::detach() JSC::MarkedArgumentBuffer arguments; arguments.append(readableStream); arguments.append(jsUndefined()); - JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); } m_weakReadableStream.clear(); @@ -1568,7 +1568,7 @@ void JSReadableHTTPSResponseSinkController::detach() JSC::MarkedArgumentBuffer arguments; arguments.append(readableStream); arguments.append(jsUndefined()); - JSC::call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); } m_weakReadableStream.clear(); diff --git a/src/bun.js/bindings/JSSinkLookupTable.h b/src/bun.js/bindings/JSSinkLookupTable.h index b678db453..78183692a 100644 --- a/src/bun.js/bindings/JSSinkLookupTable.h +++ b/src/bun.js/bindings/JSSinkLookupTable.h @@ -1,4 +1,8 @@ -// Automatically generated from src/bun.js/bindings/JSSink.cpp using /Users/dave/code/bun/src/bun.js/WebKit/Source/JavaScriptCore/create_hash_table. DO NOT EDIT! +// Automatically generated from src/bun.js/bindings/JSSink.cpp using ./src/bun.js/scripts/create_hash_table. DO NOT EDIT! + + + + static const struct CompactHashIndex JSArrayBufferSinkPrototypeTableIndex[19] = { { -1, -1 }, @@ -23,16 +27,23 @@ static const struct CompactHashIndex JSArrayBufferSinkPrototypeTableIndex[19] = }; static const struct HashTableValue JSArrayBufferSinkPrototypeTableValues[7] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__doClose, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__write, 1 } }, - { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__ref, 0 } }, - { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__unref, 0 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__doClose, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__write, 1 } }, + { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__ref, 0 } }, + { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__unref, 0 } }, }; -static const struct HashTable JSArrayBufferSinkPrototypeTable = { 7, 15, false, nullptr, JSArrayBufferSinkPrototypeTableValues, JSArrayBufferSinkPrototypeTableIndex }; +static const struct HashTable JSArrayBufferSinkPrototypeTable = + { 7, 15, false, nullptr, JSArrayBufferSinkPrototypeTableValues, JSArrayBufferSinkPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSReadableArrayBufferSinkControllerPrototypeTableIndex[19] = { { -1, -1 }, @@ -57,14 +68,21 @@ static const struct CompactHashIndex JSReadableArrayBufferSinkControllerPrototyp }; static const struct HashTableValue JSReadableArrayBufferSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableArrayBufferSinkController__close, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableArrayBufferSinkController__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__write, 1 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableArrayBufferSinkController__close, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableArrayBufferSinkController__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ArrayBufferSink__write, 1 } }, }; -static const struct HashTable JSReadableArrayBufferSinkControllerPrototypeTable = { 5, 15, false, nullptr, JSReadableArrayBufferSinkControllerPrototypeTableValues, JSReadableArrayBufferSinkControllerPrototypeTableIndex }; +static const struct HashTable JSReadableArrayBufferSinkControllerPrototypeTable = + { 5, 15, false, nullptr, JSReadableArrayBufferSinkControllerPrototypeTableValues, JSReadableArrayBufferSinkControllerPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSFileSinkPrototypeTableIndex[19] = { { -1, -1 }, @@ -89,16 +107,23 @@ static const struct CompactHashIndex JSFileSinkPrototypeTableIndex[19] = { }; static const struct HashTableValue JSFileSinkPrototypeTableValues[7] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__doClose, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__write, 1 } }, - { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__ref, 0 } }, - { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__unref, 0 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__doClose, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__write, 1 } }, + { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__ref, 0 } }, + { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__unref, 0 } }, }; -static const struct HashTable JSFileSinkPrototypeTable = { 7, 15, false, nullptr, JSFileSinkPrototypeTableValues, JSFileSinkPrototypeTableIndex }; +static const struct HashTable JSFileSinkPrototypeTable = + { 7, 15, false, nullptr, JSFileSinkPrototypeTableValues, JSFileSinkPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSReadableFileSinkControllerPrototypeTableIndex[19] = { { -1, -1 }, @@ -123,14 +148,21 @@ static const struct CompactHashIndex JSReadableFileSinkControllerPrototypeTableI }; static const struct HashTableValue JSReadableFileSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableFileSinkController__close, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableFileSinkController__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__write, 1 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableFileSinkController__close, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableFileSinkController__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSink__write, 1 } }, }; -static const struct HashTable JSReadableFileSinkControllerPrototypeTable = { 5, 15, false, nullptr, JSReadableFileSinkControllerPrototypeTableValues, JSReadableFileSinkControllerPrototypeTableIndex }; +static const struct HashTable JSReadableFileSinkControllerPrototypeTable = + { 5, 15, false, nullptr, JSReadableFileSinkControllerPrototypeTableValues, JSReadableFileSinkControllerPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSHTTPResponseSinkPrototypeTableIndex[19] = { { -1, -1 }, @@ -155,16 +187,23 @@ static const struct CompactHashIndex JSHTTPResponseSinkPrototypeTableIndex[19] = }; static const struct HashTableValue JSHTTPResponseSinkPrototypeTableValues[7] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__doClose, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__write, 1 } }, - { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__ref, 0 } }, - { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__unref, 0 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__doClose, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__write, 1 } }, + { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__ref, 0 } }, + { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__unref, 0 } }, }; -static const struct HashTable JSHTTPResponseSinkPrototypeTable = { 7, 15, false, nullptr, JSHTTPResponseSinkPrototypeTableValues, JSHTTPResponseSinkPrototypeTableIndex }; +static const struct HashTable JSHTTPResponseSinkPrototypeTable = + { 7, 15, false, nullptr, JSHTTPResponseSinkPrototypeTableValues, JSHTTPResponseSinkPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSReadableHTTPResponseSinkControllerPrototypeTableIndex[19] = { { -1, -1 }, @@ -189,14 +228,21 @@ static const struct CompactHashIndex JSReadableHTTPResponseSinkControllerPrototy }; static const struct HashTableValue JSReadableHTTPResponseSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPResponseSinkController__close, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPResponseSinkController__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__write, 1 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPResponseSinkController__close, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPResponseSinkController__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPResponseSink__write, 1 } }, }; -static const struct HashTable JSReadableHTTPResponseSinkControllerPrototypeTable = { 5, 15, false, nullptr, JSReadableHTTPResponseSinkControllerPrototypeTableValues, JSReadableHTTPResponseSinkControllerPrototypeTableIndex }; +static const struct HashTable JSReadableHTTPResponseSinkControllerPrototypeTable = + { 5, 15, false, nullptr, JSReadableHTTPResponseSinkControllerPrototypeTableValues, JSReadableHTTPResponseSinkControllerPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSHTTPSResponseSinkPrototypeTableIndex[19] = { { -1, -1 }, @@ -221,16 +267,23 @@ static const struct CompactHashIndex JSHTTPSResponseSinkPrototypeTableIndex[19] }; static const struct HashTableValue JSHTTPSResponseSinkPrototypeTableValues[7] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__doClose, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__write, 1 } }, - { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__ref, 0 } }, - { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__unref, 0 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__doClose, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__write, 1 } }, + { "ref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__ref, 0 } }, + { "unref"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__unref, 0 } }, }; -static const struct HashTable JSHTTPSResponseSinkPrototypeTable = { 7, 15, false, nullptr, JSHTTPSResponseSinkPrototypeTableValues, JSHTTPSResponseSinkPrototypeTableIndex }; +static const struct HashTable JSHTTPSResponseSinkPrototypeTable = + { 7, 15, false, nullptr, JSHTTPSResponseSinkPrototypeTableValues, JSHTTPSResponseSinkPrototypeTableIndex }; + + + + + + static const struct CompactHashIndex JSReadableHTTPSResponseSinkControllerPrototypeTableIndex[19] = { { -1, -1 }, @@ -255,11 +308,14 @@ static const struct CompactHashIndex JSReadableHTTPSResponseSinkControllerProtot }; static const struct HashTableValue JSReadableHTTPSResponseSinkControllerPrototypeTableValues[5] = { - { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPSResponseSinkController__close, 0 } }, - { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__flush, 1 } }, - { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPSResponseSinkController__end, 0 } }, - { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__start, 1 } }, - { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete | PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__write, 1 } }, + { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPSResponseSinkController__close, 0 } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__flush, 1 } }, + { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, JSReadableHTTPSResponseSinkController__end, 0 } }, + { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__start, 1 } }, + { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSResponseSink__write, 1 } }, }; -static const struct HashTable JSReadableHTTPSResponseSinkControllerPrototypeTable = { 5, 15, false, nullptr, JSReadableHTTPSResponseSinkControllerPrototypeTableValues, JSReadableHTTPSResponseSinkControllerPrototypeTableIndex }; +static const struct HashTable JSReadableHTTPSResponseSinkControllerPrototypeTable = + { 5, 15, false, nullptr, JSReadableHTTPSResponseSinkControllerPrototypeTableValues, JSReadableHTTPSResponseSinkControllerPrototypeTableIndex }; + + diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h index 0e0675c8f..f62d43bff 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h @@ -1,56 +1,43 @@ +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAttributeIterator; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlob; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlobConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildArtifact; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlobConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildArtifact; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildMessage; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildMessageConstructor; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildMessageConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForComment; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasher; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasherConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirent; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirentConstructor; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasherConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirent; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirentConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDocEnd; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDocType; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForElement; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEndTag; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpect; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectAny; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectAny; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectAnything; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectStringContaining; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectStringMatching; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFSWatcher; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouter; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouterConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForListener; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouterConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLRewriter; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLRewriterConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForListener; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMatchedRoute; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMatchedRoute; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFS; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFSConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequest; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequestConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResolveMessage; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResolveMessageConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponse; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponseConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256Constructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocket; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocketConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStats; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStatsConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubprocess; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFSConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequest; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequestConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResolveMessage; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResolveMessageConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponse; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponseConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocket; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocketConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStats; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStatsConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubprocess; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTCPSocket; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTLSSocket; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextChunk; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoder; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoderConstructor; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTimeout; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoderConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTimeout; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTranspiler; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTranspilerConstructor;
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h index f93cfac1e..a24e7126b 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h @@ -1,56 +1,43 @@ +std::unique_ptr<IsoSubspace> m_subspaceForAttributeIterator; std::unique_ptr<IsoSubspace> m_subspaceForBlob; -std::unique_ptr<IsoSubspace> m_subspaceForBlobConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForBuildArtifact; +std::unique_ptr<IsoSubspace> m_subspaceForBlobConstructor;std::unique_ptr<IsoSubspace> m_subspaceForBuildArtifact; std::unique_ptr<IsoSubspace> m_subspaceForBuildMessage; -std::unique_ptr<IsoSubspace> m_subspaceForBuildMessageConstructor; +std::unique_ptr<IsoSubspace> m_subspaceForBuildMessageConstructor;std::unique_ptr<IsoSubspace> m_subspaceForComment; std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasher; -std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasherConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForDirent; -std::unique_ptr<IsoSubspace> m_subspaceForDirentConstructor; +std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasherConstructor;std::unique_ptr<IsoSubspace> m_subspaceForDirent; +std::unique_ptr<IsoSubspace> m_subspaceForDirentConstructor;std::unique_ptr<IsoSubspace> m_subspaceForDocEnd; +std::unique_ptr<IsoSubspace> m_subspaceForDocType; +std::unique_ptr<IsoSubspace> m_subspaceForElement; +std::unique_ptr<IsoSubspace> m_subspaceForEndTag; std::unique_ptr<IsoSubspace> m_subspaceForExpect; -std::unique_ptr<IsoSubspace> m_subspaceForExpectConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForExpectAny; +std::unique_ptr<IsoSubspace> m_subspaceForExpectConstructor;std::unique_ptr<IsoSubspace> m_subspaceForExpectAny; std::unique_ptr<IsoSubspace> m_subspaceForExpectAnything; std::unique_ptr<IsoSubspace> m_subspaceForExpectStringContaining; std::unique_ptr<IsoSubspace> m_subspaceForExpectStringMatching; std::unique_ptr<IsoSubspace> m_subspaceForFSWatcher; std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouter; -std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouterConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForListener; +std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouterConstructor;std::unique_ptr<IsoSubspace> m_subspaceForHTMLRewriter; +std::unique_ptr<IsoSubspace> m_subspaceForHTMLRewriterConstructor;std::unique_ptr<IsoSubspace> m_subspaceForListener; std::unique_ptr<IsoSubspace> m_subspaceForMD4; -std::unique_ptr<IsoSubspace> m_subspaceForMD4Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForMD5; -std::unique_ptr<IsoSubspace> m_subspaceForMD5Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForMatchedRoute; +std::unique_ptr<IsoSubspace> m_subspaceForMD4Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMD5; +std::unique_ptr<IsoSubspace> m_subspaceForMD5Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMatchedRoute; std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFS; -std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFSConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForRequest; -std::unique_ptr<IsoSubspace> m_subspaceForRequestConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForResolveMessage; -std::unique_ptr<IsoSubspace> m_subspaceForResolveMessageConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForResponse; -std::unique_ptr<IsoSubspace> m_subspaceForResponseConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForSHA1; -std::unique_ptr<IsoSubspace> m_subspaceForSHA1Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForSHA224; -std::unique_ptr<IsoSubspace> m_subspaceForSHA224Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForSHA256; -std::unique_ptr<IsoSubspace> m_subspaceForSHA256Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForSHA384; -std::unique_ptr<IsoSubspace> m_subspaceForSHA384Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256Constructor; -std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocket; -std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocketConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForStats; -std::unique_ptr<IsoSubspace> m_subspaceForStatsConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForSubprocess; +std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFSConstructor;std::unique_ptr<IsoSubspace> m_subspaceForRequest; +std::unique_ptr<IsoSubspace> m_subspaceForRequestConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResolveMessage; +std::unique_ptr<IsoSubspace> m_subspaceForResolveMessageConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResponse; +std::unique_ptr<IsoSubspace> m_subspaceForResponseConstructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA1; +std::unique_ptr<IsoSubspace> m_subspaceForSHA1Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA224; +std::unique_ptr<IsoSubspace> m_subspaceForSHA224Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA256; +std::unique_ptr<IsoSubspace> m_subspaceForSHA256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA384; +std::unique_ptr<IsoSubspace> m_subspaceForSHA384Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512; +std::unique_ptr<IsoSubspace> m_subspaceForSHA512Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256; +std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocket; +std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocketConstructor;std::unique_ptr<IsoSubspace> m_subspaceForStats; +std::unique_ptr<IsoSubspace> m_subspaceForStatsConstructor;std::unique_ptr<IsoSubspace> m_subspaceForSubprocess; std::unique_ptr<IsoSubspace> m_subspaceForTCPSocket; std::unique_ptr<IsoSubspace> m_subspaceForTLSSocket; +std::unique_ptr<IsoSubspace> m_subspaceForTextChunk; std::unique_ptr<IsoSubspace> m_subspaceForTextDecoder; -std::unique_ptr<IsoSubspace> m_subspaceForTextDecoderConstructor; -std::unique_ptr<IsoSubspace> m_subspaceForTimeout; +std::unique_ptr<IsoSubspace> m_subspaceForTextDecoderConstructor;std::unique_ptr<IsoSubspace> m_subspaceForTimeout; std::unique_ptr<IsoSubspace> m_subspaceForTranspiler; std::unique_ptr<IsoSubspace> m_subspaceForTranspilerConstructor;
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h index b3e738abc..0fcf93e1d 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h @@ -1,204 +1,252 @@ +JSC::Structure* JSAttributeIteratorStructure() { return m_JSAttributeIterator.getInitializedOnMainThread(this); } + JSC::JSObject* JSAttributeIteratorConstructor() { return m_JSAttributeIterator.constructorInitializedOnMainThread(this); } + JSC::JSValue JSAttributeIteratorPrototype() { return m_JSAttributeIterator.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSAttributeIterator; + bool hasJSAttributeIteratorSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSAttributeIteratorSetterValue; JSC::Structure* JSBlobStructure() { return m_JSBlob.getInitializedOnMainThread(this); } -JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); } -JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSBlob; -bool hasJSBlobSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSBlobSetterValue; + JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); } + JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSBlob; + bool hasJSBlobSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSBlobSetterValue; JSC::Structure* JSBuildArtifactStructure() { return m_JSBuildArtifact.getInitializedOnMainThread(this); } -JSC::JSObject* JSBuildArtifactConstructor() { return m_JSBuildArtifact.constructorInitializedOnMainThread(this); } -JSC::JSValue JSBuildArtifactPrototype() { return m_JSBuildArtifact.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSBuildArtifact; -bool hasJSBuildArtifactSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildArtifactSetterValue; + JSC::JSObject* JSBuildArtifactConstructor() { return m_JSBuildArtifact.constructorInitializedOnMainThread(this); } + JSC::JSValue JSBuildArtifactPrototype() { return m_JSBuildArtifact.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSBuildArtifact; + bool hasJSBuildArtifactSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildArtifactSetterValue; JSC::Structure* JSBuildMessageStructure() { return m_JSBuildMessage.getInitializedOnMainThread(this); } -JSC::JSObject* JSBuildMessageConstructor() { return m_JSBuildMessage.constructorInitializedOnMainThread(this); } -JSC::JSValue JSBuildMessagePrototype() { return m_JSBuildMessage.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSBuildMessage; -bool hasJSBuildMessageSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildMessageSetterValue; + JSC::JSObject* JSBuildMessageConstructor() { return m_JSBuildMessage.constructorInitializedOnMainThread(this); } + JSC::JSValue JSBuildMessagePrototype() { return m_JSBuildMessage.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSBuildMessage; + bool hasJSBuildMessageSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildMessageSetterValue; +JSC::Structure* JSCommentStructure() { return m_JSComment.getInitializedOnMainThread(this); } + JSC::JSObject* JSCommentConstructor() { return m_JSComment.constructorInitializedOnMainThread(this); } + JSC::JSValue JSCommentPrototype() { return m_JSComment.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSComment; + bool hasJSCommentSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSCommentSetterValue; JSC::Structure* JSCryptoHasherStructure() { return m_JSCryptoHasher.getInitializedOnMainThread(this); } -JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); } -JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSCryptoHasher; -bool hasJSCryptoHasherSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSCryptoHasherSetterValue; + JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); } + JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSCryptoHasher; + bool hasJSCryptoHasherSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSCryptoHasherSetterValue; JSC::Structure* JSDirentStructure() { return m_JSDirent.getInitializedOnMainThread(this); } -JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); } -JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSDirent; -bool hasJSDirentSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSDirentSetterValue; + JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); } + JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSDirent; + bool hasJSDirentSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSDirentSetterValue; +JSC::Structure* JSDocEndStructure() { return m_JSDocEnd.getInitializedOnMainThread(this); } + JSC::JSObject* JSDocEndConstructor() { return m_JSDocEnd.constructorInitializedOnMainThread(this); } + JSC::JSValue JSDocEndPrototype() { return m_JSDocEnd.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSDocEnd; + bool hasJSDocEndSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSDocEndSetterValue; +JSC::Structure* JSDocTypeStructure() { return m_JSDocType.getInitializedOnMainThread(this); } + JSC::JSObject* JSDocTypeConstructor() { return m_JSDocType.constructorInitializedOnMainThread(this); } + JSC::JSValue JSDocTypePrototype() { return m_JSDocType.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSDocType; + bool hasJSDocTypeSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSDocTypeSetterValue; +JSC::Structure* JSElementStructure() { return m_JSElement.getInitializedOnMainThread(this); } + JSC::JSObject* JSElementConstructor() { return m_JSElement.constructorInitializedOnMainThread(this); } + JSC::JSValue JSElementPrototype() { return m_JSElement.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSElement; + bool hasJSElementSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSElementSetterValue; +JSC::Structure* JSEndTagStructure() { return m_JSEndTag.getInitializedOnMainThread(this); } + JSC::JSObject* JSEndTagConstructor() { return m_JSEndTag.constructorInitializedOnMainThread(this); } + JSC::JSValue JSEndTagPrototype() { return m_JSEndTag.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSEndTag; + bool hasJSEndTagSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSEndTagSetterValue; JSC::Structure* JSExpectStructure() { return m_JSExpect.getInitializedOnMainThread(this); } -JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); } -JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSExpect; -bool hasJSExpectSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectSetterValue; + JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); } + JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSExpect; + bool hasJSExpectSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectSetterValue; JSC::Structure* JSExpectAnyStructure() { return m_JSExpectAny.getInitializedOnMainThread(this); } -JSC::JSObject* JSExpectAnyConstructor() { return m_JSExpectAny.constructorInitializedOnMainThread(this); } -JSC::JSValue JSExpectAnyPrototype() { return m_JSExpectAny.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSExpectAny; -bool hasJSExpectAnySetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectAnySetterValue; + JSC::JSObject* JSExpectAnyConstructor() { return m_JSExpectAny.constructorInitializedOnMainThread(this); } + JSC::JSValue JSExpectAnyPrototype() { return m_JSExpectAny.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSExpectAny; + bool hasJSExpectAnySetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectAnySetterValue; JSC::Structure* JSExpectAnythingStructure() { return m_JSExpectAnything.getInitializedOnMainThread(this); } -JSC::JSObject* JSExpectAnythingConstructor() { return m_JSExpectAnything.constructorInitializedOnMainThread(this); } -JSC::JSValue JSExpectAnythingPrototype() { return m_JSExpectAnything.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSExpectAnything; -bool hasJSExpectAnythingSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectAnythingSetterValue; + JSC::JSObject* JSExpectAnythingConstructor() { return m_JSExpectAnything.constructorInitializedOnMainThread(this); } + JSC::JSValue JSExpectAnythingPrototype() { return m_JSExpectAnything.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSExpectAnything; + bool hasJSExpectAnythingSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectAnythingSetterValue; JSC::Structure* JSExpectStringContainingStructure() { return m_JSExpectStringContaining.getInitializedOnMainThread(this); } -JSC::JSObject* JSExpectStringContainingConstructor() { return m_JSExpectStringContaining.constructorInitializedOnMainThread(this); } -JSC::JSValue JSExpectStringContainingPrototype() { return m_JSExpectStringContaining.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSExpectStringContaining; -bool hasJSExpectStringContainingSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectStringContainingSetterValue; + JSC::JSObject* JSExpectStringContainingConstructor() { return m_JSExpectStringContaining.constructorInitializedOnMainThread(this); } + JSC::JSValue JSExpectStringContainingPrototype() { return m_JSExpectStringContaining.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSExpectStringContaining; + bool hasJSExpectStringContainingSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectStringContainingSetterValue; JSC::Structure* JSExpectStringMatchingStructure() { return m_JSExpectStringMatching.getInitializedOnMainThread(this); } -JSC::JSObject* JSExpectStringMatchingConstructor() { return m_JSExpectStringMatching.constructorInitializedOnMainThread(this); } -JSC::JSValue JSExpectStringMatchingPrototype() { return m_JSExpectStringMatching.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSExpectStringMatching; -bool hasJSExpectStringMatchingSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectStringMatchingSetterValue; + JSC::JSObject* JSExpectStringMatchingConstructor() { return m_JSExpectStringMatching.constructorInitializedOnMainThread(this); } + JSC::JSValue JSExpectStringMatchingPrototype() { return m_JSExpectStringMatching.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSExpectStringMatching; + bool hasJSExpectStringMatchingSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectStringMatchingSetterValue; JSC::Structure* JSFSWatcherStructure() { return m_JSFSWatcher.getInitializedOnMainThread(this); } -JSC::JSObject* JSFSWatcherConstructor() { return m_JSFSWatcher.constructorInitializedOnMainThread(this); } -JSC::JSValue JSFSWatcherPrototype() { return m_JSFSWatcher.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSFSWatcher; -bool hasJSFSWatcherSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSFSWatcherSetterValue; + JSC::JSObject* JSFSWatcherConstructor() { return m_JSFSWatcher.constructorInitializedOnMainThread(this); } + JSC::JSValue JSFSWatcherPrototype() { return m_JSFSWatcher.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSFSWatcher; + bool hasJSFSWatcherSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSFSWatcherSetterValue; JSC::Structure* JSFileSystemRouterStructure() { return m_JSFileSystemRouter.getInitializedOnMainThread(this); } -JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); } -JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSFileSystemRouter; -bool hasJSFileSystemRouterSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSFileSystemRouterSetterValue; + JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); } + JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSFileSystemRouter; + bool hasJSFileSystemRouterSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSFileSystemRouterSetterValue; +JSC::Structure* JSHTMLRewriterStructure() { return m_JSHTMLRewriter.getInitializedOnMainThread(this); } + JSC::JSObject* JSHTMLRewriterConstructor() { return m_JSHTMLRewriter.constructorInitializedOnMainThread(this); } + JSC::JSValue JSHTMLRewriterPrototype() { return m_JSHTMLRewriter.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSHTMLRewriter; + bool hasJSHTMLRewriterSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSHTMLRewriterSetterValue; JSC::Structure* JSListenerStructure() { return m_JSListener.getInitializedOnMainThread(this); } -JSC::JSObject* JSListenerConstructor() { return m_JSListener.constructorInitializedOnMainThread(this); } -JSC::JSValue JSListenerPrototype() { return m_JSListener.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSListener; -bool hasJSListenerSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSListenerSetterValue; + JSC::JSObject* JSListenerConstructor() { return m_JSListener.constructorInitializedOnMainThread(this); } + JSC::JSValue JSListenerPrototype() { return m_JSListener.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSListener; + bool hasJSListenerSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSListenerSetterValue; JSC::Structure* JSMD4Structure() { return m_JSMD4.getInitializedOnMainThread(this); } -JSC::JSObject* JSMD4Constructor() { return m_JSMD4.constructorInitializedOnMainThread(this); } -JSC::JSValue JSMD4Prototype() { return m_JSMD4.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSMD4; -bool hasJSMD4SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD4SetterValue; + JSC::JSObject* JSMD4Constructor() { return m_JSMD4.constructorInitializedOnMainThread(this); } + JSC::JSValue JSMD4Prototype() { return m_JSMD4.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSMD4; + bool hasJSMD4SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD4SetterValue; JSC::Structure* JSMD5Structure() { return m_JSMD5.getInitializedOnMainThread(this); } -JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); } -JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSMD5; -bool hasJSMD5SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD5SetterValue; + JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); } + JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSMD5; + bool hasJSMD5SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD5SetterValue; JSC::Structure* JSMatchedRouteStructure() { return m_JSMatchedRoute.getInitializedOnMainThread(this); } -JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); } -JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSMatchedRoute; -bool hasJSMatchedRouteSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSMatchedRouteSetterValue; + JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); } + JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSMatchedRoute; + bool hasJSMatchedRouteSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSMatchedRouteSetterValue; JSC::Structure* JSNodeJSFSStructure() { return m_JSNodeJSFS.getInitializedOnMainThread(this); } -JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); } -JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSNodeJSFS; -bool hasJSNodeJSFSSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSNodeJSFSSetterValue; + JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); } + JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSNodeJSFS; + bool hasJSNodeJSFSSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSNodeJSFSSetterValue; JSC::Structure* JSRequestStructure() { return m_JSRequest.getInitializedOnMainThread(this); } -JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); } -JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSRequest; -bool hasJSRequestSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSRequestSetterValue; + JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); } + JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSRequest; + bool hasJSRequestSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSRequestSetterValue; JSC::Structure* JSResolveMessageStructure() { return m_JSResolveMessage.getInitializedOnMainThread(this); } -JSC::JSObject* JSResolveMessageConstructor() { return m_JSResolveMessage.constructorInitializedOnMainThread(this); } -JSC::JSValue JSResolveMessagePrototype() { return m_JSResolveMessage.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSResolveMessage; -bool hasJSResolveMessageSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSResolveMessageSetterValue; + JSC::JSObject* JSResolveMessageConstructor() { return m_JSResolveMessage.constructorInitializedOnMainThread(this); } + JSC::JSValue JSResolveMessagePrototype() { return m_JSResolveMessage.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSResolveMessage; + bool hasJSResolveMessageSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSResolveMessageSetterValue; JSC::Structure* JSResponseStructure() { return m_JSResponse.getInitializedOnMainThread(this); } -JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); } -JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSResponse; -bool hasJSResponseSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSResponseSetterValue; + JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); } + JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSResponse; + bool hasJSResponseSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSResponseSetterValue; JSC::Structure* JSSHA1Structure() { return m_JSSHA1.getInitializedOnMainThread(this); } -JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSHA1; -bool hasJSSHA1SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA1SetterValue; + JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA1; + bool hasJSSHA1SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA1SetterValue; JSC::Structure* JSSHA224Structure() { return m_JSSHA224.getInitializedOnMainThread(this); } -JSC::JSObject* JSSHA224Constructor() { return m_JSSHA224.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSHA224Prototype() { return m_JSSHA224.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSHA224; -bool hasJSSHA224SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA224SetterValue; + JSC::JSObject* JSSHA224Constructor() { return m_JSSHA224.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA224Prototype() { return m_JSSHA224.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA224; + bool hasJSSHA224SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA224SetterValue; JSC::Structure* JSSHA256Structure() { return m_JSSHA256.getInitializedOnMainThread(this); } -JSC::JSObject* JSSHA256Constructor() { return m_JSSHA256.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSHA256Prototype() { return m_JSSHA256.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSHA256; -bool hasJSSHA256SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA256SetterValue; + JSC::JSObject* JSSHA256Constructor() { return m_JSSHA256.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA256Prototype() { return m_JSSHA256.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA256; + bool hasJSSHA256SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA256SetterValue; JSC::Structure* JSSHA384Structure() { return m_JSSHA384.getInitializedOnMainThread(this); } -JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSHA384; -bool hasJSSHA384SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA384SetterValue; + JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA384; + bool hasJSSHA384SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA384SetterValue; JSC::Structure* JSSHA512Structure() { return m_JSSHA512.getInitializedOnMainThread(this); } -JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSHA512; -bool hasJSSHA512SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512SetterValue; + JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA512; + bool hasJSSHA512SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512SetterValue; JSC::Structure* JSSHA512_256Structure() { return m_JSSHA512_256.getInitializedOnMainThread(this); } -JSC::JSObject* JSSHA512_256Constructor() { return m_JSSHA512_256.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSHA512_256Prototype() { return m_JSSHA512_256.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSHA512_256; -bool hasJSSHA512_256SetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512_256SetterValue; + JSC::JSObject* JSSHA512_256Constructor() { return m_JSSHA512_256.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA512_256Prototype() { return m_JSSHA512_256.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA512_256; + bool hasJSSHA512_256SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512_256SetterValue; JSC::Structure* JSServerWebSocketStructure() { return m_JSServerWebSocket.getInitializedOnMainThread(this); } -JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); } -JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSServerWebSocket; -bool hasJSServerWebSocketSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSServerWebSocketSetterValue; + JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); } + JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSServerWebSocket; + bool hasJSServerWebSocketSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSServerWebSocketSetterValue; JSC::Structure* JSStatsStructure() { return m_JSStats.getInitializedOnMainThread(this); } -JSC::JSObject* JSStatsConstructor() { return m_JSStats.constructorInitializedOnMainThread(this); } -JSC::JSValue JSStatsPrototype() { return m_JSStats.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSStats; -bool hasJSStatsSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSStatsSetterValue; + JSC::JSObject* JSStatsConstructor() { return m_JSStats.constructorInitializedOnMainThread(this); } + JSC::JSValue JSStatsPrototype() { return m_JSStats.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSStats; + bool hasJSStatsSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSStatsSetterValue; JSC::Structure* JSSubprocessStructure() { return m_JSSubprocess.getInitializedOnMainThread(this); } -JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); } -JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSSubprocess; -bool hasJSSubprocessSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSSubprocessSetterValue; + JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSubprocess; + bool hasJSSubprocessSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSubprocessSetterValue; JSC::Structure* JSTCPSocketStructure() { return m_JSTCPSocket.getInitializedOnMainThread(this); } -JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); } -JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSTCPSocket; -bool hasJSTCPSocketSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSTCPSocketSetterValue; + JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTCPSocket; + bool hasJSTCPSocketSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTCPSocketSetterValue; JSC::Structure* JSTLSSocketStructure() { return m_JSTLSSocket.getInitializedOnMainThread(this); } -JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); } -JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSTLSSocket; -bool hasJSTLSSocketSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSTLSSocketSetterValue; + JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTLSSocket; + bool hasJSTLSSocketSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTLSSocketSetterValue; +JSC::Structure* JSTextChunkStructure() { return m_JSTextChunk.getInitializedOnMainThread(this); } + JSC::JSObject* JSTextChunkConstructor() { return m_JSTextChunk.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTextChunkPrototype() { return m_JSTextChunk.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTextChunk; + bool hasJSTextChunkSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTextChunkSetterValue; JSC::Structure* JSTextDecoderStructure() { return m_JSTextDecoder.getInitializedOnMainThread(this); } -JSC::JSObject* JSTextDecoderConstructor() { return m_JSTextDecoder.constructorInitializedOnMainThread(this); } -JSC::JSValue JSTextDecoderPrototype() { return m_JSTextDecoder.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSTextDecoder; -bool hasJSTextDecoderSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSTextDecoderSetterValue; + JSC::JSObject* JSTextDecoderConstructor() { return m_JSTextDecoder.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTextDecoderPrototype() { return m_JSTextDecoder.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTextDecoder; + bool hasJSTextDecoderSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTextDecoderSetterValue; JSC::Structure* JSTimeoutStructure() { return m_JSTimeout.getInitializedOnMainThread(this); } -JSC::JSObject* JSTimeoutConstructor() { return m_JSTimeout.constructorInitializedOnMainThread(this); } -JSC::JSValue JSTimeoutPrototype() { return m_JSTimeout.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSTimeout; -bool hasJSTimeoutSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSTimeoutSetterValue; + JSC::JSObject* JSTimeoutConstructor() { return m_JSTimeout.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTimeoutPrototype() { return m_JSTimeout.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTimeout; + bool hasJSTimeoutSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTimeoutSetterValue; JSC::Structure* JSTranspilerStructure() { return m_JSTranspiler.getInitializedOnMainThread(this); } -JSC::JSObject* JSTranspilerConstructor() { return m_JSTranspiler.constructorInitializedOnMainThread(this); } -JSC::JSValue JSTranspilerPrototype() { return m_JSTranspiler.prototypeInitializedOnMainThread(this); } -JSC::LazyClassStructure m_JSTranspiler; -bool hasJSTranspilerSetterValue { false }; -mutable JSC::WriteBarrier<JSC::Unknown> m_JSTranspilerSetterValue;
\ No newline at end of file + JSC::JSObject* JSTranspilerConstructor() { return m_JSTranspiler.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTranspilerPrototype() { return m_JSTranspiler.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTranspiler; + bool hasJSTranspilerSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTranspilerSetterValue;
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h index 5ff00ee8a..eaae3aa32 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h @@ -1,267 +1,300 @@ -void GlobalObject::initGeneratedLazyClasses() -{ +void GlobalObject::initGeneratedLazyClasses() { + m_JSAttributeIterator.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSAttributeIterator::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSAttributeIterator::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSBlob.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBlob::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSBlob::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSBlob::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSBlob::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSBlob::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSBlob::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSBuildArtifact.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBuildArtifact::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSBuildArtifact::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSBuildArtifact::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSBuildArtifact::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSBuildMessage.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBuildMessage::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSBuildMessage::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSBuildMessage::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSBuildMessage::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSBuildMessage::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSBuildMessage::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSComment.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSComment::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSComment::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSCryptoHasher.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSCryptoHasher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSCryptoHasher::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSCryptoHasher::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSCryptoHasher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSCryptoHasher::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSCryptoHasher::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSDirent.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDirent::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSDirent::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSDirent::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSDirent::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSDirent::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSDirent::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSDocEnd.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSDocEnd::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSDocEnd::createStructure(init.vm, init.global, init.prototype)); + + }); + m_JSDocType.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSDocType::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSDocType::createStructure(init.vm, init.global, init.prototype)); + + }); + m_JSElement.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSElement::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSElement::createStructure(init.vm, init.global, init.prototype)); + + }); + m_JSEndTag.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSEndTag::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSEndTag::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSExpect.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpect::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSExpect::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSExpect::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSExpect::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSExpect::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSExpect::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSExpectAny.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectAny::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSExpectAny::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSExpectAny::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSExpectAny::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSExpectAnything.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectAnything::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSExpectAnything::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSExpectAnything::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSExpectAnything::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSExpectStringContaining.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectStringContaining::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSExpectStringContaining::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSExpectStringContaining::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSExpectStringContaining::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSExpectStringMatching.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpectStringMatching::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSExpectStringMatching::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSExpectStringMatching::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSExpectStringMatching::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSFSWatcher.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSFSWatcher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSFSWatcher::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSFSWatcher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSFSWatcher::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSFileSystemRouter.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSFileSystemRouter::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSFileSystemRouter::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSFileSystemRouter::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSFileSystemRouter::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSFileSystemRouter::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSFileSystemRouter::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSHTMLRewriter.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSHTMLRewriter::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSHTMLRewriter::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSHTMLRewriter::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSListener.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSListener::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSListener::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSListener::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSListener::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSMD4.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMD4::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSMD4::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSMD4::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSMD4::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSMD4::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSMD4::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSMD5.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMD5::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSMD5::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSMD5::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSMD5::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSMD5::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSMD5::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSMatchedRoute.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMatchedRoute::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSMatchedRoute::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSMatchedRoute::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSMatchedRoute::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSNodeJSFS.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSNodeJSFS::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSNodeJSFS::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSNodeJSFS::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSNodeJSFS::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSNodeJSFS::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSNodeJSFS::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSRequest.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSRequest::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSRequest::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSRequest::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSRequest::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSRequest::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSRequest::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSResolveMessage.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSResolveMessage::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSResolveMessage::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSResolveMessage::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSResolveMessage::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSResolveMessage::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSResolveMessage::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSResponse.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSResponse::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSResponse::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSResponse::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSResponse::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSResponse::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSResponse::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSHA1.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA1::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA1::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA1::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA1::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA1::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA1::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSHA224.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA224::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA224::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA224::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA224::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA224::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA224::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSHA256.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA256::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA256::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA256::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA256::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA256::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA256::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSHA384.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA384::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA384::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA384::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA384::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA384::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA384::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSHA512.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA512::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA512::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA512::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA512::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA512::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA512::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSHA512_256.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA512_256::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA512_256::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA512_256::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA512_256::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA512_256::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA512_256::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSServerWebSocket.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSServerWebSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSServerWebSocket::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSServerWebSocket::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSServerWebSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSServerWebSocket::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSServerWebSocket::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSStats.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSStats::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSStats::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSStats::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSStats::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSStats::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSStats::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSSubprocess.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSubprocess::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSubprocess::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSubprocess::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSubprocess::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSTCPSocket.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTCPSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTCPSocket::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSTCPSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTCPSocket::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSTLSSocket.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTLSSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTLSSocket::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSTLSSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTLSSocket::createStructure(init.vm, init.global, init.prototype)); + + }); + m_JSTextChunk.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSTextChunk::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTextChunk::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSTextDecoder.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTextDecoder::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTextDecoder::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSTextDecoder::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSTextDecoder::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTextDecoder::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSTextDecoder::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSTimeout.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTimeout::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTimeout::createStructure(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSTimeout::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTimeout::createStructure(init.vm, init.global, init.prototype)); + + }); m_JSTranspiler.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTranspiler::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTranspiler::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSTranspiler::createConstructor(init.vm, init.global, init.prototype)); - }); + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSTranspiler::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTranspiler::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSTranspiler::createConstructor(init.vm, init.global, init.prototype)); + }); } template<typename Visitor> -void GlobalObject::visitGeneratedLazyClasses(GlobalObject* thisObject, Visitor& visitor) +void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& visitor) { - thisObject->m_JSBlob.visit(visitor); - visitor.append(thisObject->m_JSBlobSetterValue); - thisObject->m_JSBuildArtifact.visit(visitor); - visitor.append(thisObject->m_JSBuildArtifactSetterValue); - thisObject->m_JSBuildMessage.visit(visitor); - visitor.append(thisObject->m_JSBuildMessageSetterValue); - thisObject->m_JSCryptoHasher.visit(visitor); - visitor.append(thisObject->m_JSCryptoHasherSetterValue); - thisObject->m_JSDirent.visit(visitor); - visitor.append(thisObject->m_JSDirentSetterValue); - thisObject->m_JSExpect.visit(visitor); - visitor.append(thisObject->m_JSExpectSetterValue); - thisObject->m_JSExpectAny.visit(visitor); - visitor.append(thisObject->m_JSExpectAnySetterValue); - thisObject->m_JSExpectAnything.visit(visitor); - visitor.append(thisObject->m_JSExpectAnythingSetterValue); - thisObject->m_JSExpectStringContaining.visit(visitor); - visitor.append(thisObject->m_JSExpectStringContainingSetterValue); - thisObject->m_JSExpectStringMatching.visit(visitor); - visitor.append(thisObject->m_JSExpectStringMatchingSetterValue); - thisObject->m_JSFSWatcher.visit(visitor); - visitor.append(thisObject->m_JSFSWatcherSetterValue); - thisObject->m_JSFileSystemRouter.visit(visitor); - visitor.append(thisObject->m_JSFileSystemRouterSetterValue); - thisObject->m_JSListener.visit(visitor); - visitor.append(thisObject->m_JSListenerSetterValue); - thisObject->m_JSMD4.visit(visitor); - visitor.append(thisObject->m_JSMD4SetterValue); - thisObject->m_JSMD5.visit(visitor); - visitor.append(thisObject->m_JSMD5SetterValue); - thisObject->m_JSMatchedRoute.visit(visitor); - visitor.append(thisObject->m_JSMatchedRouteSetterValue); - thisObject->m_JSNodeJSFS.visit(visitor); - visitor.append(thisObject->m_JSNodeJSFSSetterValue); - thisObject->m_JSRequest.visit(visitor); - visitor.append(thisObject->m_JSRequestSetterValue); - thisObject->m_JSResolveMessage.visit(visitor); - visitor.append(thisObject->m_JSResolveMessageSetterValue); - thisObject->m_JSResponse.visit(visitor); - visitor.append(thisObject->m_JSResponseSetterValue); - thisObject->m_JSSHA1.visit(visitor); - visitor.append(thisObject->m_JSSHA1SetterValue); - thisObject->m_JSSHA224.visit(visitor); - visitor.append(thisObject->m_JSSHA224SetterValue); - thisObject->m_JSSHA256.visit(visitor); - visitor.append(thisObject->m_JSSHA256SetterValue); - thisObject->m_JSSHA384.visit(visitor); - visitor.append(thisObject->m_JSSHA384SetterValue); - thisObject->m_JSSHA512.visit(visitor); - visitor.append(thisObject->m_JSSHA512SetterValue); - thisObject->m_JSSHA512_256.visit(visitor); - visitor.append(thisObject->m_JSSHA512_256SetterValue); - thisObject->m_JSServerWebSocket.visit(visitor); - visitor.append(thisObject->m_JSServerWebSocketSetterValue); - thisObject->m_JSStats.visit(visitor); - visitor.append(thisObject->m_JSStatsSetterValue); - thisObject->m_JSSubprocess.visit(visitor); - visitor.append(thisObject->m_JSSubprocessSetterValue); - thisObject->m_JSTCPSocket.visit(visitor); - visitor.append(thisObject->m_JSTCPSocketSetterValue); - thisObject->m_JSTLSSocket.visit(visitor); - visitor.append(thisObject->m_JSTLSSocketSetterValue); - thisObject->m_JSTextDecoder.visit(visitor); - visitor.append(thisObject->m_JSTextDecoderSetterValue); - thisObject->m_JSTimeout.visit(visitor); - visitor.append(thisObject->m_JSTimeoutSetterValue); - thisObject->m_JSTranspiler.visit(visitor); - visitor.append(thisObject->m_JSTranspilerSetterValue); + thisObject->m_JSAttributeIterator.visit(visitor); visitor.append(thisObject->m_JSAttributeIteratorSetterValue); + thisObject->m_JSBlob.visit(visitor); visitor.append(thisObject->m_JSBlobSetterValue); + thisObject->m_JSBuildArtifact.visit(visitor); visitor.append(thisObject->m_JSBuildArtifactSetterValue); + thisObject->m_JSBuildMessage.visit(visitor); visitor.append(thisObject->m_JSBuildMessageSetterValue); + thisObject->m_JSComment.visit(visitor); visitor.append(thisObject->m_JSCommentSetterValue); + thisObject->m_JSCryptoHasher.visit(visitor); visitor.append(thisObject->m_JSCryptoHasherSetterValue); + thisObject->m_JSDirent.visit(visitor); visitor.append(thisObject->m_JSDirentSetterValue); + thisObject->m_JSDocEnd.visit(visitor); visitor.append(thisObject->m_JSDocEndSetterValue); + thisObject->m_JSDocType.visit(visitor); visitor.append(thisObject->m_JSDocTypeSetterValue); + thisObject->m_JSElement.visit(visitor); visitor.append(thisObject->m_JSElementSetterValue); + thisObject->m_JSEndTag.visit(visitor); visitor.append(thisObject->m_JSEndTagSetterValue); + thisObject->m_JSExpect.visit(visitor); visitor.append(thisObject->m_JSExpectSetterValue); + thisObject->m_JSExpectAny.visit(visitor); visitor.append(thisObject->m_JSExpectAnySetterValue); + thisObject->m_JSExpectAnything.visit(visitor); visitor.append(thisObject->m_JSExpectAnythingSetterValue); + thisObject->m_JSExpectStringContaining.visit(visitor); visitor.append(thisObject->m_JSExpectStringContainingSetterValue); + thisObject->m_JSExpectStringMatching.visit(visitor); visitor.append(thisObject->m_JSExpectStringMatchingSetterValue); + thisObject->m_JSFSWatcher.visit(visitor); visitor.append(thisObject->m_JSFSWatcherSetterValue); + thisObject->m_JSFileSystemRouter.visit(visitor); visitor.append(thisObject->m_JSFileSystemRouterSetterValue); + thisObject->m_JSHTMLRewriter.visit(visitor); visitor.append(thisObject->m_JSHTMLRewriterSetterValue); + thisObject->m_JSListener.visit(visitor); visitor.append(thisObject->m_JSListenerSetterValue); + thisObject->m_JSMD4.visit(visitor); visitor.append(thisObject->m_JSMD4SetterValue); + thisObject->m_JSMD5.visit(visitor); visitor.append(thisObject->m_JSMD5SetterValue); + thisObject->m_JSMatchedRoute.visit(visitor); visitor.append(thisObject->m_JSMatchedRouteSetterValue); + thisObject->m_JSNodeJSFS.visit(visitor); visitor.append(thisObject->m_JSNodeJSFSSetterValue); + thisObject->m_JSRequest.visit(visitor); visitor.append(thisObject->m_JSRequestSetterValue); + thisObject->m_JSResolveMessage.visit(visitor); visitor.append(thisObject->m_JSResolveMessageSetterValue); + thisObject->m_JSResponse.visit(visitor); visitor.append(thisObject->m_JSResponseSetterValue); + thisObject->m_JSSHA1.visit(visitor); visitor.append(thisObject->m_JSSHA1SetterValue); + thisObject->m_JSSHA224.visit(visitor); visitor.append(thisObject->m_JSSHA224SetterValue); + thisObject->m_JSSHA256.visit(visitor); visitor.append(thisObject->m_JSSHA256SetterValue); + thisObject->m_JSSHA384.visit(visitor); visitor.append(thisObject->m_JSSHA384SetterValue); + thisObject->m_JSSHA512.visit(visitor); visitor.append(thisObject->m_JSSHA512SetterValue); + thisObject->m_JSSHA512_256.visit(visitor); visitor.append(thisObject->m_JSSHA512_256SetterValue); + thisObject->m_JSServerWebSocket.visit(visitor); visitor.append(thisObject->m_JSServerWebSocketSetterValue); + thisObject->m_JSStats.visit(visitor); visitor.append(thisObject->m_JSStatsSetterValue); + thisObject->m_JSSubprocess.visit(visitor); visitor.append(thisObject->m_JSSubprocessSetterValue); + thisObject->m_JSTCPSocket.visit(visitor); visitor.append(thisObject->m_JSTCPSocketSetterValue); + thisObject->m_JSTLSSocket.visit(visitor); visitor.append(thisObject->m_JSTLSSocketSetterValue); + thisObject->m_JSTextChunk.visit(visitor); visitor.append(thisObject->m_JSTextChunkSetterValue); + thisObject->m_JSTextDecoder.visit(visitor); visitor.append(thisObject->m_JSTextDecoderSetterValue); + thisObject->m_JSTimeout.visit(visitor); visitor.append(thisObject->m_JSTimeoutSetterValue); + thisObject->m_JSTranspiler.visit(visitor); visitor.append(thisObject->m_JSTranspilerSetterValue); }
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index c2780bd7f..a54501afd 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -28,6 +28,206 @@ namespace WebCore { using namespace JSC; using namespace Zig; +class JSAttributeIteratorPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSAttributeIteratorPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSAttributeIteratorPrototype* ptr = new (NotNull, JSC::allocateCell<JSAttributeIteratorPrototype>(vm)) JSAttributeIteratorPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSAttributeIteratorPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* AttributeIteratorClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsAttributeIteratorConstructor); + +extern "C" void AttributeIteratorClass__finalize(void*); + +extern "C" EncodedJSValue AttributeIteratorPrototype__getThis(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(AttributeIteratorPrototype__iteratorCallback); + +extern "C" EncodedJSValue AttributeIteratorPrototype__next(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(AttributeIteratorPrototype__nextCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSAttributeIteratorPrototype, JSAttributeIteratorPrototype::Base); + +static const HashTableValue JSAttributeIteratorPrototypeTableValues[] = { + { "next"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, AttributeIteratorPrototype__nextCallback, 0 } } +}; + +const ClassInfo JSAttributeIteratorPrototype::s_info = { "AttributeIterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAttributeIteratorPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsAttributeIteratorConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSAttributeIteratorPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSAttributeIteratorConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(AttributeIteratorPrototype__iteratorCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSAttributeIterator* thisObject = jsDynamicCast<JSAttributeIterator*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return AttributeIteratorPrototype__getThis(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(AttributeIteratorPrototype__nextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSAttributeIterator* thisObject = jsDynamicCast<JSAttributeIterator*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return AttributeIteratorPrototype__next(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSAttributeIteratorPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSAttributeIterator::info(), JSAttributeIteratorPrototypeTableValues, *this); + this->putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject, 1, String("iterator"_s), AttributeIteratorPrototype__iteratorCallback, ImplementationVisibility::Public), PropertyAttribute::Function | PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSAttributeIterator::~JSAttributeIterator() +{ + if (m_ctx) { + AttributeIteratorClass__finalize(m_ctx); + } +} +void JSAttributeIterator::destroy(JSCell* cell) +{ + static_cast<JSAttributeIterator*>(cell)->JSAttributeIterator::~JSAttributeIterator(); +} + +const ClassInfo JSAttributeIterator::s_info = { "AttributeIterator"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAttributeIterator) }; + +void JSAttributeIterator::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSAttributeIterator* JSAttributeIterator::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSAttributeIterator* ptr = new (NotNull, JSC::allocateCell<JSAttributeIterator>(vm)) JSAttributeIterator(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* AttributeIterator__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSAttributeIterator* object = JSC::jsDynamicCast<JSAttributeIterator*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool AttributeIterator__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSAttributeIterator* object = JSC::jsDynamicCast<JSAttributeIterator*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t AttributeIterator__ptrOffset = JSAttributeIterator::offsetOfWrapped(); + +void JSAttributeIterator::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSAttributeIterator*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSAttributeIterator::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSAttributeIteratorPrototype::create(vm, globalObject, JSAttributeIteratorPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue AttributeIterator__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSAttributeIteratorStructure(); + JSAttributeIterator* instance = JSAttributeIterator::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} class JSBlobPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -1663,6 +1863,314 @@ void JSBuildMessage::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBuildMessage); +class JSCommentPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSCommentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSCommentPrototype* ptr = new (NotNull, JSC::allocateCell<JSCommentPrototype>(vm)) JSCommentPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSCommentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* CommentClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsCommentConstructor); + +extern "C" void CommentClass__finalize(void*); + +extern "C" EncodedJSValue CommentPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(CommentPrototype__afterCallback); + +extern "C" EncodedJSValue CommentPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(CommentPrototype__beforeCallback); + +extern "C" EncodedJSValue CommentPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(CommentPrototype__removeCallback); + +extern "C" JSC::EncodedJSValue CommentPrototype__removed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(CommentPrototype__removedGetterWrap); + +extern "C" EncodedJSValue CommentPrototype__replace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(CommentPrototype__replaceCallback); + +extern "C" JSC::EncodedJSValue CommentPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(CommentPrototype__textGetterWrap); + +extern "C" bool CommentPrototype__setText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(CommentPrototype__textSetterWrap); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCommentPrototype, JSCommentPrototype::Base); + +static const HashTableValue JSCommentPrototypeTableValues[] = { + { "after"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__afterCallback, 1 } }, + { "before"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__beforeCallback, 1 } }, + { "remove"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__removeCallback, 0 } }, + { "removed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CommentPrototype__removedGetterWrap, 0 } }, + { "replace"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CommentPrototype__replaceCallback, 1 } }, + { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CommentPrototype__textGetterWrap, CommentPrototype__textSetterWrap } } +}; + +const ClassInfo JSCommentPrototype::s_info = { "Comment"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCommentPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsCommentConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSCommentPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSCommentConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(CommentPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSComment* thisObject = jsDynamicCast<JSComment*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return CommentPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(CommentPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSComment* thisObject = jsDynamicCast<JSComment*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return CommentPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(CommentPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSComment* thisObject = jsDynamicCast<JSComment*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return CommentPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(CommentPrototype__removedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSComment* thisObject = jsCast<JSComment*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = CommentPrototype__removed(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(CommentPrototype__replaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSComment* thisObject = jsDynamicCast<JSComment*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return CommentPrototype__replace(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(CommentPrototype__textGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSComment* thisObject = jsCast<JSComment*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = CommentPrototype__getText(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_CUSTOM_SETTER(CommentPrototype__textSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSComment* thisObject = jsCast<JSComment*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = CommentPrototype__setText(thisObject->wrapped(), lexicalGlobalObject, encodedValue); + + RELEASE_AND_RETURN(throwScope, result); +} + +void JSCommentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSComment::info(), JSCommentPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSComment::~JSComment() +{ + if (m_ctx) { + CommentClass__finalize(m_ctx); + } +} +void JSComment::destroy(JSCell* cell) +{ + static_cast<JSComment*>(cell)->JSComment::~JSComment(); +} + +const ClassInfo JSComment::s_info = { "Comment"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSComment) }; + +void JSComment::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSComment* JSComment::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSComment* ptr = new (NotNull, JSC::allocateCell<JSComment>(vm)) JSComment(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* Comment__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSComment* object = JSC::jsDynamicCast<JSComment*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool Comment__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSComment* object = JSC::jsDynamicCast<JSComment*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t Comment__ptrOffset = JSComment::offsetOfWrapped(); + +void JSComment::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSComment*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSComment::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSCommentPrototype::create(vm, globalObject, JSCommentPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue Comment__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSCommentStructure(); + JSComment* instance = JSComment::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -2619,6 +3127,1387 @@ void JSDirent::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDirent); +class JSDocEndPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSDocEndPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSDocEndPrototype* ptr = new (NotNull, JSC::allocateCell<JSDocEndPrototype>(vm)) JSDocEndPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSDocEndPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* DocEndClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsDocEndConstructor); + +extern "C" void DocEndClass__finalize(void*); + +extern "C" EncodedJSValue DocEndPrototype__append(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DocEndPrototype__appendCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDocEndPrototype, JSDocEndPrototype::Base); + +static const HashTableValue JSDocEndPrototypeTableValues[] = { + { "append"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DocEndPrototype__appendCallback, 1 } } +}; + +const ClassInfo JSDocEndPrototype::s_info = { "DocEnd"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocEndPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsDocEndConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSDocEndPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSDocEndConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(DocEndPrototype__appendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSDocEnd* thisObject = jsDynamicCast<JSDocEnd*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return DocEndPrototype__append(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSDocEndPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSDocEnd::info(), JSDocEndPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSDocEnd::~JSDocEnd() +{ + if (m_ctx) { + DocEndClass__finalize(m_ctx); + } +} +void JSDocEnd::destroy(JSCell* cell) +{ + static_cast<JSDocEnd*>(cell)->JSDocEnd::~JSDocEnd(); +} + +const ClassInfo JSDocEnd::s_info = { "DocEnd"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocEnd) }; + +void JSDocEnd::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSDocEnd* JSDocEnd::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSDocEnd* ptr = new (NotNull, JSC::allocateCell<JSDocEnd>(vm)) JSDocEnd(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* DocEnd__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSDocEnd* object = JSC::jsDynamicCast<JSDocEnd*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool DocEnd__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSDocEnd* object = JSC::jsDynamicCast<JSDocEnd*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t DocEnd__ptrOffset = JSDocEnd::offsetOfWrapped(); + +void JSDocEnd::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSDocEnd*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSDocEnd::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSDocEndPrototype::create(vm, globalObject, JSDocEndPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue DocEnd__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSDocEndStructure(); + JSDocEnd* instance = JSDocEnd::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} +class JSDocTypePrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSDocTypePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSDocTypePrototype* ptr = new (NotNull, JSC::allocateCell<JSDocTypePrototype>(vm)) JSDocTypePrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSDocTypePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* DocTypeClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsDocTypeConstructor); + +extern "C" void DocTypeClass__finalize(void*); + +extern "C" JSC::EncodedJSValue DocTypePrototype__name(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(DocTypePrototype__nameGetterWrap); + +extern "C" JSC::EncodedJSValue DocTypePrototype__publicId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(DocTypePrototype__publicIdGetterWrap); + +extern "C" JSC::EncodedJSValue DocTypePrototype__systemId(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(DocTypePrototype__systemIdGetterWrap); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDocTypePrototype, JSDocTypePrototype::Base); + +static const HashTableValue JSDocTypePrototypeTableValues[] = { + { "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DocTypePrototype__nameGetterWrap, 0 } }, + { "publicId"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DocTypePrototype__publicIdGetterWrap, 0 } }, + { "systemId"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DocTypePrototype__systemIdGetterWrap, 0 } } +}; + +const ClassInfo JSDocTypePrototype::s_info = { "DocType"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocTypePrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsDocTypeConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSDocTypePrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSDocTypeConstructor()); +} + +JSC_DEFINE_CUSTOM_GETTER(DocTypePrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSDocType* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_name.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + DocTypePrototype__name(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_name.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void DocTypePrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue DocTypePrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_name.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(DocTypePrototype__publicIdGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSDocType* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_publicId.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + DocTypePrototype__publicId(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_publicId.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void DocTypePrototype__publicIdSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + thisObject->m_publicId.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue DocTypePrototype__publicIdGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_publicId.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(DocTypePrototype__systemIdGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSDocType* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_systemId.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + DocTypePrototype__systemId(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_systemId.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void DocTypePrototype__systemIdSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + thisObject->m_systemId.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue DocTypePrototype__systemIdGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSDocType*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_systemId.get()); +} + +void JSDocTypePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSDocType::info(), JSDocTypePrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSDocType::~JSDocType() +{ + if (m_ctx) { + DocTypeClass__finalize(m_ctx); + } +} +void JSDocType::destroy(JSCell* cell) +{ + static_cast<JSDocType*>(cell)->JSDocType::~JSDocType(); +} + +const ClassInfo JSDocType::s_info = { "DocType"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDocType) }; + +void JSDocType::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSDocType* JSDocType::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSDocType* ptr = new (NotNull, JSC::allocateCell<JSDocType>(vm)) JSDocType(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* DocType__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSDocType* object = JSC::jsDynamicCast<JSDocType*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool DocType__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSDocType* object = JSC::jsDynamicCast<JSDocType*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t DocType__ptrOffset = JSDocType::offsetOfWrapped(); + +void JSDocType::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSDocType*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSDocType::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSDocTypePrototype::create(vm, globalObject, JSDocTypePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue DocType__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSDocTypeStructure(); + JSDocType* instance = JSDocType::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +template<typename Visitor> +void JSDocType::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSDocType* thisObject = jsCast<JSDocType*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + + visitor.append(thisObject->m_name); + visitor.append(thisObject->m_publicId); + visitor.append(thisObject->m_systemId); +} + +DEFINE_VISIT_CHILDREN(JSDocType); + +template<typename Visitor> +void JSDocType::visitAdditionalChildren(Visitor& visitor) +{ + JSDocType* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_name); + visitor.append(thisObject->m_publicId); + visitor.append(thisObject->m_systemId); +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDocType); + +template<typename Visitor> +void JSDocType::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSDocType* thisObject = jsCast<JSDocType*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDocType); +class JSElementPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSElementPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSElementPrototype>(vm)) JSElementPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSElementPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* ElementClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsElementConstructor); + +extern "C" void ElementClass__finalize(void*); + +extern "C" EncodedJSValue ElementPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__afterCallback); + +extern "C" EncodedJSValue ElementPrototype__append(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__appendCallback); + +extern "C" JSC::EncodedJSValue ElementPrototype__getAttributes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__attributesGetterWrap); + +extern "C" EncodedJSValue ElementPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__beforeCallback); + +extern "C" EncodedJSValue ElementPrototype__getAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__getAttributeCallback); + +extern "C" EncodedJSValue ElementPrototype__hasAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__hasAttributeCallback); + +extern "C" JSC::EncodedJSValue ElementPrototype__getNamespaceURI(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__namespaceURIGetterWrap); + +extern "C" EncodedJSValue ElementPrototype__onEndTag(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__onEndTagCallback); + +extern "C" EncodedJSValue ElementPrototype__prepend(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__prependCallback); + +extern "C" EncodedJSValue ElementPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__removeCallback); + +extern "C" EncodedJSValue ElementPrototype__removeAndKeepContent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__removeAndKeepContentCallback); + +extern "C" EncodedJSValue ElementPrototype__removeAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__removeAttributeCallback); + +extern "C" JSC::EncodedJSValue ElementPrototype__getRemoved(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__removedGetterWrap); + +extern "C" EncodedJSValue ElementPrototype__replace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__replaceCallback); + +extern "C" EncodedJSValue ElementPrototype__setAttribute(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__setAttributeCallback); + +extern "C" EncodedJSValue ElementPrototype__setInnerContent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ElementPrototype__setInnerContentCallback); + +extern "C" JSC::EncodedJSValue ElementPrototype__getTagName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ElementPrototype__tagNameGetterWrap); + +extern "C" bool ElementPrototype__setTagName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(ElementPrototype__tagNameSetterWrap); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSElementPrototype, JSElementPrototype::Base); + +static const HashTableValue JSElementPrototypeTableValues[] = { + { "after"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__afterCallback, 1 } }, + { "append"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__appendCallback, 1 } }, + { "attributes"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__attributesGetterWrap, 0 } }, + { "before"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__beforeCallback, 1 } }, + { "getAttribute"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__getAttributeCallback, 1 } }, + { "hasAttribute"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__hasAttributeCallback, 1 } }, + { "namespaceURI"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__namespaceURIGetterWrap, 0 } }, + { "onEndTag"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__onEndTagCallback, 1 } }, + { "prepend"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__prependCallback, 1 } }, + { "remove"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__removeCallback, 0 } }, + { "removeAndKeepContent"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__removeAndKeepContentCallback, 0 } }, + { "removeAttribute"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__removeAttributeCallback, 1 } }, + { "removed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__removedGetterWrap, 0 } }, + { "replace"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__replaceCallback, 1 } }, + { "setAttribute"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__setAttributeCallback, 2 } }, + { "setInnerContent"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ElementPrototype__setInnerContentCallback, 1 } }, + { "tagName"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ElementPrototype__tagNameGetterWrap, ElementPrototype__tagNameSetterWrap } } +}; + +const ClassInfo JSElementPrototype::s_info = { "Element"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSElementPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsElementConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSElementPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSElementConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__appendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__append(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__attributesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSElement* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = ElementPrototype__getAttributes(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__getAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__getAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__hasAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__hasAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__namespaceURIGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSElement* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_namespaceURI.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ElementPrototype__getNamespaceURI(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_namespaceURI.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ElementPrototype__namespaceURISetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + thisObject->m_namespaceURI.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ElementPrototype__namespaceURIGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_namespaceURI.get()); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__onEndTagCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__onEndTag(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__prependCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__prepend(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__removeAndKeepContentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__removeAndKeepContent(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__removeAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__removeAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__removedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSElement* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = ElementPrototype__getRemoved(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__replaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__replace(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__setAttributeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__setAttribute(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ElementPrototype__setInnerContentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSElement* thisObject = jsDynamicCast<JSElement*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return ElementPrototype__setInnerContent(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(ElementPrototype__tagNameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSElement* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = ElementPrototype__getTagName(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_CUSTOM_SETTER(ElementPrototype__tagNameSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSElement* thisObject = jsCast<JSElement*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = ElementPrototype__setTagName(thisObject->wrapped(), lexicalGlobalObject, encodedValue); + + RELEASE_AND_RETURN(throwScope, result); +} + +void JSElementPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSElement::info(), JSElementPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSElement::~JSElement() +{ + if (m_ctx) { + ElementClass__finalize(m_ctx); + } +} +void JSElement::destroy(JSCell* cell) +{ + static_cast<JSElement*>(cell)->JSElement::~JSElement(); +} + +const ClassInfo JSElement::s_info = { "Element"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSElement) }; + +void JSElement::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSElement* JSElement::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSElement* ptr = new (NotNull, JSC::allocateCell<JSElement>(vm)) JSElement(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* Element__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSElement* object = JSC::jsDynamicCast<JSElement*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool Element__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSElement* object = JSC::jsDynamicCast<JSElement*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t Element__ptrOffset = JSElement::offsetOfWrapped(); + +void JSElement::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSElement*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSElement::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSElementPrototype::create(vm, globalObject, JSElementPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue Element__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSElementStructure(); + JSElement* instance = JSElement::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +template<typename Visitor> +void JSElement::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSElement* thisObject = jsCast<JSElement*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + + visitor.append(thisObject->m_namespaceURI); +} + +DEFINE_VISIT_CHILDREN(JSElement); + +template<typename Visitor> +void JSElement::visitAdditionalChildren(Visitor& visitor) +{ + JSElement* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_namespaceURI); +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSElement); + +template<typename Visitor> +void JSElement::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSElement* thisObject = jsCast<JSElement*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSElement); +class JSEndTagPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSEndTagPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSEndTagPrototype* ptr = new (NotNull, JSC::allocateCell<JSEndTagPrototype>(vm)) JSEndTagPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSEndTagPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* EndTagClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsEndTagConstructor); + +extern "C" void EndTagClass__finalize(void*); + +extern "C" EncodedJSValue EndTagPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(EndTagPrototype__afterCallback); + +extern "C" EncodedJSValue EndTagPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(EndTagPrototype__beforeCallback); + +extern "C" JSC::EncodedJSValue EndTagPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(EndTagPrototype__nameGetterWrap); + +extern "C" bool EndTagPrototype__setName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(EndTagPrototype__nameSetterWrap); + +extern "C" EncodedJSValue EndTagPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(EndTagPrototype__removeCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSEndTagPrototype, JSEndTagPrototype::Base); + +static const HashTableValue JSEndTagPrototypeTableValues[] = { + { "after"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, EndTagPrototype__afterCallback, 1 } }, + { "before"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, EndTagPrototype__beforeCallback, 1 } }, + { "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, EndTagPrototype__nameGetterWrap, EndTagPrototype__nameSetterWrap } }, + { "remove"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, EndTagPrototype__removeCallback, 0 } } +}; + +const ClassInfo JSEndTagPrototype::s_info = { "EndTag"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSEndTagPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsEndTagConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSEndTagPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSEndTagConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(EndTagPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSEndTag* thisObject = jsDynamicCast<JSEndTag*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return EndTagPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(EndTagPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSEndTag* thisObject = jsDynamicCast<JSEndTag*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return EndTagPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(EndTagPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSEndTag* thisObject = jsCast<JSEndTag*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = EndTagPrototype__getName(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_CUSTOM_SETTER(EndTagPrototype__nameSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSEndTag* thisObject = jsCast<JSEndTag*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = EndTagPrototype__setName(thisObject->wrapped(), lexicalGlobalObject, encodedValue); + + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(EndTagPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSEndTag* thisObject = jsDynamicCast<JSEndTag*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return EndTagPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSEndTagPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSEndTag::info(), JSEndTagPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSEndTag::~JSEndTag() +{ + if (m_ctx) { + EndTagClass__finalize(m_ctx); + } +} +void JSEndTag::destroy(JSCell* cell) +{ + static_cast<JSEndTag*>(cell)->JSEndTag::~JSEndTag(); +} + +const ClassInfo JSEndTag::s_info = { "EndTag"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSEndTag) }; + +void JSEndTag::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSEndTag* JSEndTag::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSEndTag* ptr = new (NotNull, JSC::allocateCell<JSEndTag>(vm)) JSEndTag(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* EndTag__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSEndTag* object = JSC::jsDynamicCast<JSEndTag*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool EndTag__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSEndTag* object = JSC::jsDynamicCast<JSEndTag*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t EndTag__ptrOffset = JSEndTag::offsetOfWrapped(); + +void JSEndTag::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSEndTag*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSEndTag::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSEndTagPrototype::create(vm, globalObject, JSEndTagPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue EndTag__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSEndTagStructure(); + JSEndTag* instance = JSEndTag::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} class JSExpectPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -6292,6 +8181,341 @@ void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell* cell, Visitor& visit } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFileSystemRouter); +class JSHTMLRewriterPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSHTMLRewriterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSHTMLRewriterPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLRewriterPrototype>(vm)) JSHTMLRewriterPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSHTMLRewriterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +class JSHTMLRewriterConstructor final : public JSC::InternalFunction { +public: + using Base = JSC::InternalFunction; + static JSHTMLRewriterConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSHTMLRewriterPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSHTMLRewriterConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForHTMLRewriterConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForHTMLRewriterConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForHTMLRewriterConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForHTMLRewriterConstructor = std::forward<decltype(space)>(space); }); + } + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + +private: + JSHTMLRewriterConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype); +}; + +extern "C" void* HTMLRewriterClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsHTMLRewriterConstructor); + +extern "C" void HTMLRewriterClass__finalize(void*); + +extern "C" EncodedJSValue HTMLRewriterPrototype__on(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(HTMLRewriterPrototype__onCallback); + +extern "C" EncodedJSValue HTMLRewriterPrototype__onDocument(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(HTMLRewriterPrototype__onDocumentCallback); + +extern "C" EncodedJSValue HTMLRewriterPrototype__transform(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(HTMLRewriterPrototype__transformCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTMLRewriterPrototype, JSHTMLRewriterPrototype::Base); + +static const HashTableValue JSHTMLRewriterPrototypeTableValues[] = { + { "on"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTMLRewriterPrototype__onCallback, 2 } }, + { "onDocument"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTMLRewriterPrototype__onDocumentCallback, 1 } }, + { "transform"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTMLRewriterPrototype__transformCallback, 1 } } +}; + +const ClassInfo JSHTMLRewriterPrototype::s_info = { "HTMLRewriter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLRewriterPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsHTMLRewriterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSHTMLRewriterPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSHTMLRewriterConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(HTMLRewriterPrototype__onCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSHTMLRewriter* thisObject = jsDynamicCast<JSHTMLRewriter*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return HTMLRewriterPrototype__on(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(HTMLRewriterPrototype__onDocumentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSHTMLRewriter* thisObject = jsDynamicCast<JSHTMLRewriter*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return HTMLRewriterPrototype__onDocument(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(HTMLRewriterPrototype__transformCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSHTMLRewriter* thisObject = jsDynamicCast<JSHTMLRewriter*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return HTMLRewriterPrototype__transform(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSHTMLRewriterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSHTMLRewriter::info(), JSHTMLRewriterPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +void JSHTMLRewriterConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype) +{ + Base::finishCreation(vm, 0, "HTMLRewriter"_s, PropertyAdditionMode::WithoutStructureTransition); + + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} + +JSHTMLRewriterConstructor::JSHTMLRewriterConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} + +JSHTMLRewriterConstructor* JSHTMLRewriterConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSHTMLRewriterPrototype* prototype) +{ + JSHTMLRewriterConstructor* ptr = new (NotNull, JSC::allocateCell<JSHTMLRewriterConstructor>(vm)) JSHTMLRewriterConstructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; +} + +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTMLRewriterConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +{ + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM& vm = globalObject->vm(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSHTMLRewriterConstructor(); + Structure* structure = globalObject->JSHTMLRewriterStructure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); + + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget)); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSHTMLRewriterStructure()); + } + + void* ptr = HTMLRewriterClass__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSHTMLRewriter* instance = JSHTMLRewriter::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +void JSHTMLRewriterConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSHTMLRewriterPrototype* prototype) +{ +} + +const ClassInfo JSHTMLRewriterConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLRewriterConstructor) }; + +extern "C" EncodedJSValue HTMLRewriter__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSHTMLRewriterConstructor()); +} + +JSHTMLRewriter::~JSHTMLRewriter() +{ + if (m_ctx) { + HTMLRewriterClass__finalize(m_ctx); + } +} +void JSHTMLRewriter::destroy(JSCell* cell) +{ + static_cast<JSHTMLRewriter*>(cell)->JSHTMLRewriter::~JSHTMLRewriter(); +} + +const ClassInfo JSHTMLRewriter::s_info = { "HTMLRewriter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLRewriter) }; + +void JSHTMLRewriter::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSHTMLRewriter* JSHTMLRewriter::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSHTMLRewriter* ptr = new (NotNull, JSC::allocateCell<JSHTMLRewriter>(vm)) JSHTMLRewriter(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* HTMLRewriter__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSHTMLRewriter* object = JSC::jsDynamicCast<JSHTMLRewriter*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool HTMLRewriter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSHTMLRewriter* object = JSC::jsDynamicCast<JSHTMLRewriter*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t HTMLRewriter__ptrOffset = JSHTMLRewriter::offsetOfWrapped(); + +void JSHTMLRewriter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSHTMLRewriter*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSHTMLRewriter::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +{ + return WebCore::JSHTMLRewriterConstructor::create(vm, globalObject, WebCore::JSHTMLRewriterConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSHTMLRewriterPrototype*>(prototype)); +} + +JSObject* JSHTMLRewriter::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSHTMLRewriterPrototype::create(vm, globalObject, JSHTMLRewriterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue HTMLRewriter__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSHTMLRewriterStructure(); + JSHTMLRewriter* instance = JSHTMLRewriter::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} class JSListenerPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -19259,6 +21483,368 @@ void JSTLSSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTLSSocket); +class JSTextChunkPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSTextChunkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTextChunkPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextChunkPrototype>(vm)) JSTextChunkPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSTextChunkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +extern "C" void* TextChunkClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsTextChunkConstructor); + +extern "C" void TextChunkClass__finalize(void*); + +extern "C" EncodedJSValue TextChunkPrototype__after(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__afterCallback); + +extern "C" EncodedJSValue TextChunkPrototype__before(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__beforeCallback); + +extern "C" JSC::EncodedJSValue TextChunkPrototype__lastInTextNode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(TextChunkPrototype__lastInTextNodeGetterWrap); + +extern "C" EncodedJSValue TextChunkPrototype__remove(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__removeCallback); + +extern "C" JSC::EncodedJSValue TextChunkPrototype__removed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(TextChunkPrototype__removedGetterWrap); + +extern "C" EncodedJSValue TextChunkPrototype__replace(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(TextChunkPrototype__replaceCallback); + +extern "C" JSC::EncodedJSValue TextChunkPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(TextChunkPrototype__textGetterWrap); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextChunkPrototype, JSTextChunkPrototype::Base); + +static const HashTableValue JSTextChunkPrototypeTableValues[] = { + { "after"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__afterCallback, 1 } }, + { "before"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__beforeCallback, 1 } }, + { "lastInTextNode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextChunkPrototype__lastInTextNodeGetterWrap, 0 } }, + { "remove"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__removeCallback, 0 } }, + { "removed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextChunkPrototype__removedGetterWrap, 0 } }, + { "replace"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TextChunkPrototype__replaceCallback, 1 } }, + { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextChunkPrototype__textGetterWrap, 0 } } +}; + +const ClassInfo JSTextChunkPrototype::s_info = { "TextChunk"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextChunkPrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsTextChunkConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSTextChunkPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSTextChunkConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__afterCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSTextChunk* thisObject = jsDynamicCast<JSTextChunk*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return TextChunkPrototype__after(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__beforeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSTextChunk* thisObject = jsDynamicCast<JSTextChunk*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return TextChunkPrototype__before(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(TextChunkPrototype__lastInTextNodeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTextChunk* thisObject = jsCast<JSTextChunk*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_lastInTextNode.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + TextChunkPrototype__lastInTextNode(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_lastInTextNode.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void TextChunkPrototype__lastInTextNodeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSTextChunk*>(JSValue::decode(thisValue)); + thisObject->m_lastInTextNode.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue TextChunkPrototype__lastInTextNodeGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSTextChunk*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_lastInTextNode.get()); +} + +JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__removeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSTextChunk* thisObject = jsDynamicCast<JSTextChunk*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return TextChunkPrototype__remove(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(TextChunkPrototype__removedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTextChunk* thisObject = jsCast<JSTextChunk*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = TextChunkPrototype__removed(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(TextChunkPrototype__replaceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSTextChunk* thisObject = jsDynamicCast<JSTextChunk*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return TextChunkPrototype__replace(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(TextChunkPrototype__textGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTextChunk* thisObject = jsCast<JSTextChunk*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = TextChunkPrototype__getText(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +void JSTextChunkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSTextChunk::info(), JSTextChunkPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +JSTextChunk::~JSTextChunk() +{ + if (m_ctx) { + TextChunkClass__finalize(m_ctx); + } +} +void JSTextChunk::destroy(JSCell* cell) +{ + static_cast<JSTextChunk*>(cell)->JSTextChunk::~JSTextChunk(); +} + +const ClassInfo JSTextChunk::s_info = { "TextChunk"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextChunk) }; + +void JSTextChunk::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSTextChunk* JSTextChunk::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSTextChunk* ptr = new (NotNull, JSC::allocateCell<JSTextChunk>(vm)) JSTextChunk(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* TextChunk__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSTextChunk* object = JSC::jsDynamicCast<JSTextChunk*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool TextChunk__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSTextChunk* object = JSC::jsDynamicCast<JSTextChunk*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t TextChunk__ptrOffset = JSTextChunk::offsetOfWrapped(); + +void JSTextChunk::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSTextChunk*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSTextChunk::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSTextChunkPrototype::create(vm, globalObject, JSTextChunkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue TextChunk__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTextChunkStructure(); + JSTextChunk* instance = JSTextChunk::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +template<typename Visitor> +void JSTextChunk::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSTextChunk* thisObject = jsCast<JSTextChunk*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + + visitor.append(thisObject->m_lastInTextNode); +} + +DEFINE_VISIT_CHILDREN(JSTextChunk); + +template<typename Visitor> +void JSTextChunk::visitAdditionalChildren(Visitor& visitor) +{ + JSTextChunk* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_lastInTextNode); +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTextChunk); + +template<typename Visitor> +void JSTextChunk::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSTextChunk* thisObject = jsCast<JSTextChunk*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTextChunk); class JSTextDecoderPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index f66c65e40..cae28b60c 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -16,6 +16,56 @@ namespace WebCore { using namespace Zig; using namespace JSC; +class JSAttributeIterator final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSAttributeIterator* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSAttributeIterator, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForAttributeIterator.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForAttributeIterator = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForAttributeIterator.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForAttributeIterator = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSAttributeIterator(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSAttributeIterator, m_ctx); } + + void* m_ctx { nullptr }; + + JSAttributeIterator(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); +}; + class JSBlob final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; @@ -191,6 +241,56 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_position; }; +class JSComment final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSComment* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSComment, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForComment.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForComment = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForComment.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForComment = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSComment(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSComment, m_ctx); } + + void* m_ctx { nullptr }; + + JSComment(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); +}; + class JSCryptoHasher final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; @@ -304,6 +404,220 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_name; }; +class JSDocEnd final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSDocEnd* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSDocEnd, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForDocEnd.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDocEnd = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForDocEnd.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForDocEnd = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSDocEnd(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDocEnd, m_ctx); } + + void* m_ctx { nullptr }; + + JSDocEnd(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); +}; + +class JSDocType final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSDocType* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSDocType, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForDocType.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDocType = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForDocType.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForDocType = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSDocType(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDocType, m_ctx); } + + void* m_ctx { nullptr }; + + JSDocType(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); + + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + mutable JSC::WriteBarrier<JSC::Unknown> m_name; + mutable JSC::WriteBarrier<JSC::Unknown> m_publicId; + mutable JSC::WriteBarrier<JSC::Unknown> m_systemId; +}; + +class JSElement final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSElement* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSElement, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForElement.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForElement = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForElement.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForElement = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSElement(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSElement, m_ctx); } + + void* m_ctx { nullptr }; + + JSElement(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); + + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + mutable JSC::WriteBarrier<JSC::Unknown> m_namespaceURI; +}; + +class JSEndTag final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSEndTag* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSEndTag, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForEndTag.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForEndTag = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForEndTag.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForEndTag = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSEndTag(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSEndTag, m_ctx); } + + void* m_ctx { nullptr }; + + JSEndTag(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); +}; + class JSExpect final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; @@ -720,6 +1034,56 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_style; }; +class JSHTMLRewriter final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSHTMLRewriter* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSHTMLRewriter, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForHTMLRewriter.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForHTMLRewriter = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForHTMLRewriter.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForHTMLRewriter = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSHTMLRewriter(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSHTMLRewriter, m_ctx); } + + void* m_ctx { nullptr }; + + JSHTMLRewriter(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); +}; + class JSListener final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; @@ -1836,6 +2200,62 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; }; +class JSTextChunk final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSTextChunk* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTextChunk, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTextChunk.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextChunk = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTextChunk.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTextChunk = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSTextChunk(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextChunk, m_ctx); } + + void* m_ctx { nullptr }; + + JSTextChunk(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); + + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + mutable JSC::WriteBarrier<JSC::Unknown> m_lastInTextNode; +}; + class JSTextDecoder final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index baa1ddda7..e7967d256 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -664,7 +664,6 @@ const JSC::ClassInfo GlobalObject::s_info = { "GlobalObject"_s, &Base::s_info, n CREATE_METHOD_TABLE(GlobalObject) }; extern "C" JSClassRef* Zig__getAPIGlobals(size_t* count); -extern "C" const JSC__JSValue* Zig__getAPIConstructors(size_t* count, JSC__JSGlobalObject*); static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObject) { @@ -908,6 +907,9 @@ GENERATED_CONSTRUCTOR_SETTER(JSRequest); GENERATED_CONSTRUCTOR_GETTER(JSBlob); GENERATED_CONSTRUCTOR_SETTER(JSBlob); +GENERATED_CONSTRUCTOR_GETTER(JSHTMLRewriter); +GENERATED_CONSTRUCTOR_SETTER(JSHTMLRewriter); + WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSMessageEvent); WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSMessageEvent); @@ -941,6 +943,8 @@ WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSBroadcastChannel); WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSEvent); WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSEvent); +JSC_DECLARE_CUSTOM_GETTER(JSEvent_getter); + WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSDOMException); WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSDOMException); @@ -4133,6 +4137,18 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm) putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Blob"_s), JSC::CustomGetterSetter::create(vm, JSBlob_getter, JSBlob_setter), JSC::PropertyAttribute::DontDelete | 0); + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "HTMLRewriter"_s), JSC::CustomGetterSetter::create(vm, JSHTMLRewriter_getter, JSHTMLRewriter_setter), + JSC::PropertyAttribute::DontDelete | 0); + + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "DOMException"_s), JSC::CustomGetterSetter::create(vm, JSDOMException_getter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Event"_s), JSC::CustomGetterSetter::create(vm, JSEvent_getter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "EventTarget"_s), JSC::CustomGetterSetter::create(vm, JSEventTarget_getter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "AbortController"_s), JSC::CustomGetterSetter::create(vm, JSDOMAbortController_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); @@ -4253,19 +4269,10 @@ DEFINE_BUN_LAZY_GETTER(BUN_LAZY_GETTER_FN_NAME(password), passwordObject) void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm) { auto clientData = WebCore::clientData(vm); - size_t constructor_count = 0; auto& builtinNames = clientData->builtinNames(); - JSC__JSValue const* constructors = Zig__getAPIConstructors(&constructor_count, this); WTF::Vector<GlobalPropertyInfo> extraStaticGlobals; - extraStaticGlobals.reserveCapacity((size_t)count + constructor_count + 3 + 1 + 1); - int i = 0; - for (; i < constructor_count; i++) { - auto* object = JSC::jsDynamicCast<JSC::JSCallbackConstructor*>(JSC::JSValue::decode(constructors[i]).asCell()->getObject()); + extraStaticGlobals.reserveCapacity((size_t)count + 3 + 1 + 1); - extraStaticGlobals.uncheckedAppend( - GlobalPropertyInfo { JSC::Identifier::fromString(vm, object->get(this, vm.propertyNames->name).toWTFString(this)), - JSC::JSValue(object), JSC::PropertyAttribute::DontDelete | 0 }); - } int j = 0; { // first one is Bun object diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index 265ada40a..bdfabaeee 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -253,12 +253,6 @@ export fn Zig__getAPIGlobals(count: *usize) [*]JSC.C.JSClassRef { return globals.ptr; } -export fn Zig__getAPIConstructors(count: *usize, ctx: *JSGlobalObject) [*]const JSValue { - var globals = JSC.VirtualMachine.getAPIConstructors(ctx); - count.* = globals.len; - return globals.ptr; -} - pub const JSErrorCode = enum(u8) { Error = 0, EvalError = 1, @@ -3385,7 +3379,6 @@ comptime { _ = Process.getTitle; _ = Process.setTitle; _ = Zig__getAPIGlobals; - _ = Zig__getAPIConstructors; Bun.Timer.shim.ref(); NodePath.shim.ref(); JSReadableStreamBlob.shim.ref(); diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index 9cf63a2e1..a6d58ff2c 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -22,6 +22,68 @@ pub const StaticGetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) pub const StaticSetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; pub const StaticCallbackType = fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; +pub const JSAttributeIterator = struct { + const AttributeIterator = Classes.AttributeIterator; + const GetterType = fn (*AttributeIterator, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*AttributeIterator, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*AttributeIterator, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*AttributeIterator, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*AttributeIterator, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*AttributeIterator { + JSC.markBinding(@src()); + return AttributeIterator__fromJS(value); + } + + /// Create a new instance of AttributeIterator + pub fn toJS(this: *AttributeIterator, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = AttributeIterator__create(globalObject, this); + std.debug.assert(value__.as(AttributeIterator).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return AttributeIterator__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of AttributeIterator. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*AttributeIterator) bool { + JSC.markBinding(@src()); + return AttributeIterator__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *AttributeIterator, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(AttributeIterator__dangerouslySetPtr(value, null)); + } + + extern fn AttributeIterator__fromJS(JSC.JSValue) ?*AttributeIterator; + extern fn AttributeIterator__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn AttributeIterator__create(globalObject: *JSC.JSGlobalObject, ptr: ?*AttributeIterator) JSC.JSValue; + + extern fn AttributeIterator__dangerouslySetPtr(JSC.JSValue, ?*AttributeIterator) bool; + + comptime { + if (@TypeOf(AttributeIterator.finalize) != (fn (*AttributeIterator) callconv(.C) void)) { + @compileLog("AttributeIterator.finalize is not a finalizer"); + } + + if (@TypeOf(AttributeIterator.getThis) != CallbackType) + @compileLog("Expected AttributeIterator.getThis to be a callback but received " ++ @typeName(@TypeOf(AttributeIterator.getThis))); + if (@TypeOf(AttributeIterator.next) != CallbackType) + @compileLog("Expected AttributeIterator.next to be a callback but received " ++ @typeName(@TypeOf(AttributeIterator.next))); + if (!JSC.is_bindgen) { + @export(AttributeIterator.finalize, .{ .name = "AttributeIteratorClass__finalize" }); + @export(AttributeIterator.getThis, .{ .name = "AttributeIteratorPrototype__getThis" }); + @export(AttributeIterator.next, .{ .name = "AttributeIteratorPrototype__next" }); + } + } +}; pub const JSBlob = struct { const Blob = Classes.Blob; const GetterType = fn (*Blob, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -548,6 +610,85 @@ pub const JSBuildMessage = struct { } } }; +pub const JSComment = struct { + const Comment = Classes.Comment; + const GetterType = fn (*Comment, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*Comment, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*Comment, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*Comment, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*Comment, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*Comment { + JSC.markBinding(@src()); + return Comment__fromJS(value); + } + + /// Create a new instance of Comment + pub fn toJS(this: *Comment, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = Comment__create(globalObject, this); + std.debug.assert(value__.as(Comment).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return Comment__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of Comment. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Comment) bool { + JSC.markBinding(@src()); + return Comment__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *Comment, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(Comment__dangerouslySetPtr(value, null)); + } + + extern fn Comment__fromJS(JSC.JSValue) ?*Comment; + extern fn Comment__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn Comment__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Comment) JSC.JSValue; + + extern fn Comment__dangerouslySetPtr(JSC.JSValue, ?*Comment) bool; + + comptime { + if (@TypeOf(Comment.finalize) != (fn (*Comment) callconv(.C) void)) { + @compileLog("Comment.finalize is not a finalizer"); + } + + if (@TypeOf(Comment.after) != CallbackType) + @compileLog("Expected Comment.after to be a callback but received " ++ @typeName(@TypeOf(Comment.after))); + if (@TypeOf(Comment.before) != CallbackType) + @compileLog("Expected Comment.before to be a callback but received " ++ @typeName(@TypeOf(Comment.before))); + if (@TypeOf(Comment.remove) != CallbackType) + @compileLog("Expected Comment.remove to be a callback but received " ++ @typeName(@TypeOf(Comment.remove))); + if (@TypeOf(Comment.removed) != GetterType) + @compileLog("Expected Comment.removed to be a getter"); + + if (@TypeOf(Comment.replace) != CallbackType) + @compileLog("Expected Comment.replace to be a callback but received " ++ @typeName(@TypeOf(Comment.replace))); + if (@TypeOf(Comment.getText) != GetterType) + @compileLog("Expected Comment.getText to be a getter"); + + if (@TypeOf(Comment.setText) != SetterType) + @compileLog("Expected Comment.setText to be a setter"); + if (!JSC.is_bindgen) { + @export(Comment.after, .{ .name = "CommentPrototype__after" }); + @export(Comment.before, .{ .name = "CommentPrototype__before" }); + @export(Comment.finalize, .{ .name = "CommentClass__finalize" }); + @export(Comment.getText, .{ .name = "CommentPrototype__getText" }); + @export(Comment.remove, .{ .name = "CommentPrototype__remove" }); + @export(Comment.removed, .{ .name = "CommentPrototype__removed" }); + @export(Comment.replace, .{ .name = "CommentPrototype__replace" }); + @export(Comment.setText, .{ .name = "CommentPrototype__setText" }); + } + } +}; pub const JSCryptoHasher = struct { const CryptoHasher = Classes.CryptoHasher; const GetterType = fn (*CryptoHasher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -777,6 +918,407 @@ pub const JSDirent = struct { } } }; +pub const JSDocEnd = struct { + const DocEnd = Classes.DocEnd; + const GetterType = fn (*DocEnd, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*DocEnd, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*DocEnd, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*DocEnd, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*DocEnd, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*DocEnd { + JSC.markBinding(@src()); + return DocEnd__fromJS(value); + } + + /// Create a new instance of DocEnd + pub fn toJS(this: *DocEnd, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = DocEnd__create(globalObject, this); + std.debug.assert(value__.as(DocEnd).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return DocEnd__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of DocEnd. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*DocEnd) bool { + JSC.markBinding(@src()); + return DocEnd__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *DocEnd, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(DocEnd__dangerouslySetPtr(value, null)); + } + + extern fn DocEnd__fromJS(JSC.JSValue) ?*DocEnd; + extern fn DocEnd__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn DocEnd__create(globalObject: *JSC.JSGlobalObject, ptr: ?*DocEnd) JSC.JSValue; + + extern fn DocEnd__dangerouslySetPtr(JSC.JSValue, ?*DocEnd) bool; + + comptime { + if (@TypeOf(DocEnd.finalize) != (fn (*DocEnd) callconv(.C) void)) { + @compileLog("DocEnd.finalize is not a finalizer"); + } + + if (@TypeOf(DocEnd.append) != CallbackType) + @compileLog("Expected DocEnd.append to be a callback but received " ++ @typeName(@TypeOf(DocEnd.append))); + if (!JSC.is_bindgen) { + @export(DocEnd.append, .{ .name = "DocEndPrototype__append" }); + @export(DocEnd.finalize, .{ .name = "DocEndClass__finalize" }); + } + } +}; +pub const JSDocType = struct { + const DocType = Classes.DocType; + const GetterType = fn (*DocType, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*DocType, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*DocType, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*DocType, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*DocType, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*DocType { + JSC.markBinding(@src()); + return DocType__fromJS(value); + } + + extern fn DocTypePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn DocTypePrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `DocType.name` setter + /// This value will be visited by the garbage collector. + pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + DocTypePrototype__nameSetCachedValue(thisValue, globalObject, value); + } + + /// `DocType.name` getter + /// This value will be visited by the garbage collector. + pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = DocTypePrototype__nameGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn DocTypePrototype__publicIdSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn DocTypePrototype__publicIdGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `DocType.publicId` setter + /// This value will be visited by the garbage collector. + pub fn publicIdSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + DocTypePrototype__publicIdSetCachedValue(thisValue, globalObject, value); + } + + /// `DocType.publicId` getter + /// This value will be visited by the garbage collector. + pub fn publicIdGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = DocTypePrototype__publicIdGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn DocTypePrototype__systemIdSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn DocTypePrototype__systemIdGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `DocType.systemId` setter + /// This value will be visited by the garbage collector. + pub fn systemIdSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + DocTypePrototype__systemIdSetCachedValue(thisValue, globalObject, value); + } + + /// `DocType.systemId` getter + /// This value will be visited by the garbage collector. + pub fn systemIdGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = DocTypePrototype__systemIdGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + /// Create a new instance of DocType + pub fn toJS(this: *DocType, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = DocType__create(globalObject, this); + std.debug.assert(value__.as(DocType).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return DocType__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of DocType. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*DocType) bool { + JSC.markBinding(@src()); + return DocType__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *DocType, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(DocType__dangerouslySetPtr(value, null)); + } + + extern fn DocType__fromJS(JSC.JSValue) ?*DocType; + extern fn DocType__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn DocType__create(globalObject: *JSC.JSGlobalObject, ptr: ?*DocType) JSC.JSValue; + + extern fn DocType__dangerouslySetPtr(JSC.JSValue, ?*DocType) bool; + + comptime { + if (@TypeOf(DocType.finalize) != (fn (*DocType) callconv(.C) void)) { + @compileLog("DocType.finalize is not a finalizer"); + } + + if (@TypeOf(DocType.name) != GetterType) + @compileLog("Expected DocType.name to be a getter"); + + if (@TypeOf(DocType.publicId) != GetterType) + @compileLog("Expected DocType.publicId to be a getter"); + + if (@TypeOf(DocType.systemId) != GetterType) + @compileLog("Expected DocType.systemId to be a getter"); + + if (!JSC.is_bindgen) { + @export(DocType.finalize, .{ .name = "DocTypeClass__finalize" }); + @export(DocType.name, .{ .name = "DocTypePrototype__name" }); + @export(DocType.publicId, .{ .name = "DocTypePrototype__publicId" }); + @export(DocType.systemId, .{ .name = "DocTypePrototype__systemId" }); + } + } +}; +pub const JSElement = struct { + const Element = Classes.Element; + const GetterType = fn (*Element, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*Element, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*Element, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*Element, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*Element, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*Element { + JSC.markBinding(@src()); + return Element__fromJS(value); + } + + extern fn ElementPrototype__namespaceURISetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ElementPrototype__namespaceURIGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Element.namespaceURI` setter + /// This value will be visited by the garbage collector. + pub fn namespaceURISetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ElementPrototype__namespaceURISetCachedValue(thisValue, globalObject, value); + } + + /// `Element.namespaceURI` getter + /// This value will be visited by the garbage collector. + pub fn namespaceURIGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ElementPrototype__namespaceURIGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + /// Create a new instance of Element + pub fn toJS(this: *Element, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = Element__create(globalObject, this); + std.debug.assert(value__.as(Element).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return Element__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of Element. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Element) bool { + JSC.markBinding(@src()); + return Element__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *Element, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(Element__dangerouslySetPtr(value, null)); + } + + extern fn Element__fromJS(JSC.JSValue) ?*Element; + extern fn Element__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn Element__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Element) JSC.JSValue; + + extern fn Element__dangerouslySetPtr(JSC.JSValue, ?*Element) bool; + + comptime { + if (@TypeOf(Element.finalize) != (fn (*Element) callconv(.C) void)) { + @compileLog("Element.finalize is not a finalizer"); + } + + if (@TypeOf(Element.after) != CallbackType) + @compileLog("Expected Element.after to be a callback but received " ++ @typeName(@TypeOf(Element.after))); + if (@TypeOf(Element.append) != CallbackType) + @compileLog("Expected Element.append to be a callback but received " ++ @typeName(@TypeOf(Element.append))); + if (@TypeOf(Element.getAttributes) != GetterType) + @compileLog("Expected Element.getAttributes to be a getter"); + + if (@TypeOf(Element.before) != CallbackType) + @compileLog("Expected Element.before to be a callback but received " ++ @typeName(@TypeOf(Element.before))); + if (@TypeOf(Element.getAttribute) != CallbackType) + @compileLog("Expected Element.getAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.getAttribute))); + if (@TypeOf(Element.hasAttribute) != CallbackType) + @compileLog("Expected Element.hasAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.hasAttribute))); + if (@TypeOf(Element.getNamespaceURI) != GetterType) + @compileLog("Expected Element.getNamespaceURI to be a getter"); + + if (@TypeOf(Element.onEndTag) != CallbackType) + @compileLog("Expected Element.onEndTag to be a callback but received " ++ @typeName(@TypeOf(Element.onEndTag))); + if (@TypeOf(Element.prepend) != CallbackType) + @compileLog("Expected Element.prepend to be a callback but received " ++ @typeName(@TypeOf(Element.prepend))); + if (@TypeOf(Element.remove) != CallbackType) + @compileLog("Expected Element.remove to be a callback but received " ++ @typeName(@TypeOf(Element.remove))); + if (@TypeOf(Element.removeAndKeepContent) != CallbackType) + @compileLog("Expected Element.removeAndKeepContent to be a callback but received " ++ @typeName(@TypeOf(Element.removeAndKeepContent))); + if (@TypeOf(Element.removeAttribute) != CallbackType) + @compileLog("Expected Element.removeAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.removeAttribute))); + if (@TypeOf(Element.getRemoved) != GetterType) + @compileLog("Expected Element.getRemoved to be a getter"); + + if (@TypeOf(Element.replace) != CallbackType) + @compileLog("Expected Element.replace to be a callback but received " ++ @typeName(@TypeOf(Element.replace))); + if (@TypeOf(Element.setAttribute) != CallbackType) + @compileLog("Expected Element.setAttribute to be a callback but received " ++ @typeName(@TypeOf(Element.setAttribute))); + if (@TypeOf(Element.setInnerContent) != CallbackType) + @compileLog("Expected Element.setInnerContent to be a callback but received " ++ @typeName(@TypeOf(Element.setInnerContent))); + if (@TypeOf(Element.getTagName) != GetterType) + @compileLog("Expected Element.getTagName to be a getter"); + + if (@TypeOf(Element.setTagName) != SetterType) + @compileLog("Expected Element.setTagName to be a setter"); + if (!JSC.is_bindgen) { + @export(Element.after, .{ .name = "ElementPrototype__after" }); + @export(Element.append, .{ .name = "ElementPrototype__append" }); + @export(Element.before, .{ .name = "ElementPrototype__before" }); + @export(Element.finalize, .{ .name = "ElementClass__finalize" }); + @export(Element.getAttribute, .{ .name = "ElementPrototype__getAttribute" }); + @export(Element.getAttributes, .{ .name = "ElementPrototype__getAttributes" }); + @export(Element.getNamespaceURI, .{ .name = "ElementPrototype__getNamespaceURI" }); + @export(Element.getRemoved, .{ .name = "ElementPrototype__getRemoved" }); + @export(Element.getTagName, .{ .name = "ElementPrototype__getTagName" }); + @export(Element.hasAttribute, .{ .name = "ElementPrototype__hasAttribute" }); + @export(Element.onEndTag, .{ .name = "ElementPrototype__onEndTag" }); + @export(Element.prepend, .{ .name = "ElementPrototype__prepend" }); + @export(Element.remove, .{ .name = "ElementPrototype__remove" }); + @export(Element.removeAndKeepContent, .{ .name = "ElementPrototype__removeAndKeepContent" }); + @export(Element.removeAttribute, .{ .name = "ElementPrototype__removeAttribute" }); + @export(Element.replace, .{ .name = "ElementPrototype__replace" }); + @export(Element.setAttribute, .{ .name = "ElementPrototype__setAttribute" }); + @export(Element.setInnerContent, .{ .name = "ElementPrototype__setInnerContent" }); + @export(Element.setTagName, .{ .name = "ElementPrototype__setTagName" }); + } + } +}; +pub const JSEndTag = struct { + const EndTag = Classes.EndTag; + const GetterType = fn (*EndTag, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*EndTag, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*EndTag, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*EndTag, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*EndTag, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*EndTag { + JSC.markBinding(@src()); + return EndTag__fromJS(value); + } + + /// Create a new instance of EndTag + pub fn toJS(this: *EndTag, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = EndTag__create(globalObject, this); + std.debug.assert(value__.as(EndTag).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return EndTag__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of EndTag. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*EndTag) bool { + JSC.markBinding(@src()); + return EndTag__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *EndTag, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(EndTag__dangerouslySetPtr(value, null)); + } + + extern fn EndTag__fromJS(JSC.JSValue) ?*EndTag; + extern fn EndTag__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn EndTag__create(globalObject: *JSC.JSGlobalObject, ptr: ?*EndTag) JSC.JSValue; + + extern fn EndTag__dangerouslySetPtr(JSC.JSValue, ?*EndTag) bool; + + comptime { + if (@TypeOf(EndTag.finalize) != (fn (*EndTag) callconv(.C) void)) { + @compileLog("EndTag.finalize is not a finalizer"); + } + + if (@TypeOf(EndTag.after) != CallbackType) + @compileLog("Expected EndTag.after to be a callback but received " ++ @typeName(@TypeOf(EndTag.after))); + if (@TypeOf(EndTag.before) != CallbackType) + @compileLog("Expected EndTag.before to be a callback but received " ++ @typeName(@TypeOf(EndTag.before))); + if (@TypeOf(EndTag.getName) != GetterType) + @compileLog("Expected EndTag.getName to be a getter"); + + if (@TypeOf(EndTag.setName) != SetterType) + @compileLog("Expected EndTag.setName to be a setter"); + if (@TypeOf(EndTag.remove) != CallbackType) + @compileLog("Expected EndTag.remove to be a callback but received " ++ @typeName(@TypeOf(EndTag.remove))); + if (!JSC.is_bindgen) { + @export(EndTag.after, .{ .name = "EndTagPrototype__after" }); + @export(EndTag.before, .{ .name = "EndTagPrototype__before" }); + @export(EndTag.finalize, .{ .name = "EndTagClass__finalize" }); + @export(EndTag.getName, .{ .name = "EndTagPrototype__getName" }); + @export(EndTag.remove, .{ .name = "EndTagPrototype__remove" }); + @export(EndTag.setName, .{ .name = "EndTagPrototype__setName" }); + } + } +}; pub const JSExpect = struct { const Expect = Classes.Expect; const GetterType = fn (*Expect, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -1674,6 +2216,83 @@ pub const JSFileSystemRouter = struct { } } }; +pub const JSHTMLRewriter = struct { + const HTMLRewriter = Classes.HTMLRewriter; + const GetterType = fn (*HTMLRewriter, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*HTMLRewriter, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*HTMLRewriter, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*HTMLRewriter, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*HTMLRewriter, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*HTMLRewriter { + JSC.markBinding(@src()); + return HTMLRewriter__fromJS(value); + } + + /// Get the HTMLRewriter constructor value. + /// This loads lazily from the global object. + pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + return HTMLRewriter__getConstructor(globalObject); + } + + /// Create a new instance of HTMLRewriter + pub fn toJS(this: *HTMLRewriter, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = HTMLRewriter__create(globalObject, this); + std.debug.assert(value__.as(HTMLRewriter).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return HTMLRewriter__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of HTMLRewriter. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*HTMLRewriter) bool { + JSC.markBinding(@src()); + return HTMLRewriter__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *HTMLRewriter, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(HTMLRewriter__dangerouslySetPtr(value, null)); + } + + extern fn HTMLRewriter__fromJS(JSC.JSValue) ?*HTMLRewriter; + extern fn HTMLRewriter__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn HTMLRewriter__create(globalObject: *JSC.JSGlobalObject, ptr: ?*HTMLRewriter) JSC.JSValue; + + extern fn HTMLRewriter__dangerouslySetPtr(JSC.JSValue, ?*HTMLRewriter) bool; + + comptime { + if (@TypeOf(HTMLRewriter.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*HTMLRewriter)) { + @compileLog("HTMLRewriter.constructor is not a constructor"); + } + + if (@TypeOf(HTMLRewriter.finalize) != (fn (*HTMLRewriter) callconv(.C) void)) { + @compileLog("HTMLRewriter.finalize is not a finalizer"); + } + + if (@TypeOf(HTMLRewriter.on) != CallbackType) + @compileLog("Expected HTMLRewriter.on to be a callback but received " ++ @typeName(@TypeOf(HTMLRewriter.on))); + if (@TypeOf(HTMLRewriter.onDocument) != CallbackType) + @compileLog("Expected HTMLRewriter.onDocument to be a callback but received " ++ @typeName(@TypeOf(HTMLRewriter.onDocument))); + if (@TypeOf(HTMLRewriter.transform) != CallbackType) + @compileLog("Expected HTMLRewriter.transform to be a callback but received " ++ @typeName(@TypeOf(HTMLRewriter.transform))); + if (!JSC.is_bindgen) { + @export(HTMLRewriter.constructor, .{ .name = "HTMLRewriterClass__construct" }); + @export(HTMLRewriter.finalize, .{ .name = "HTMLRewriterClass__finalize" }); + @export(HTMLRewriter.on, .{ .name = "HTMLRewriterPrototype__on" }); + @export(HTMLRewriter.onDocument, .{ .name = "HTMLRewriterPrototype__onDocument" }); + @export(HTMLRewriter.transform, .{ .name = "HTMLRewriterPrototype__transform" }); + } + } +}; pub const JSListener = struct { const Listener = Classes.Listener; const GetterType = fn (*Listener, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -4770,6 +5389,108 @@ pub const JSTLSSocket = struct { } } }; +pub const JSTextChunk = struct { + const TextChunk = Classes.TextChunk; + const GetterType = fn (*TextChunk, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*TextChunk, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*TextChunk, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*TextChunk, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*TextChunk, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*TextChunk { + JSC.markBinding(@src()); + return TextChunk__fromJS(value); + } + + extern fn TextChunkPrototype__lastInTextNodeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn TextChunkPrototype__lastInTextNodeGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `TextChunk.lastInTextNode` setter + /// This value will be visited by the garbage collector. + pub fn lastInTextNodeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + TextChunkPrototype__lastInTextNodeSetCachedValue(thisValue, globalObject, value); + } + + /// `TextChunk.lastInTextNode` getter + /// This value will be visited by the garbage collector. + pub fn lastInTextNodeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = TextChunkPrototype__lastInTextNodeGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + /// Create a new instance of TextChunk + pub fn toJS(this: *TextChunk, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = TextChunk__create(globalObject, this); + std.debug.assert(value__.as(TextChunk).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return TextChunk__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of TextChunk. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TextChunk) bool { + JSC.markBinding(@src()); + return TextChunk__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *TextChunk, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(TextChunk__dangerouslySetPtr(value, null)); + } + + extern fn TextChunk__fromJS(JSC.JSValue) ?*TextChunk; + extern fn TextChunk__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn TextChunk__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TextChunk) JSC.JSValue; + + extern fn TextChunk__dangerouslySetPtr(JSC.JSValue, ?*TextChunk) bool; + + comptime { + if (@TypeOf(TextChunk.finalize) != (fn (*TextChunk) callconv(.C) void)) { + @compileLog("TextChunk.finalize is not a finalizer"); + } + + if (@TypeOf(TextChunk.after) != CallbackType) + @compileLog("Expected TextChunk.after to be a callback but received " ++ @typeName(@TypeOf(TextChunk.after))); + if (@TypeOf(TextChunk.before) != CallbackType) + @compileLog("Expected TextChunk.before to be a callback but received " ++ @typeName(@TypeOf(TextChunk.before))); + if (@TypeOf(TextChunk.lastInTextNode) != GetterType) + @compileLog("Expected TextChunk.lastInTextNode to be a getter"); + + if (@TypeOf(TextChunk.remove) != CallbackType) + @compileLog("Expected TextChunk.remove to be a callback but received " ++ @typeName(@TypeOf(TextChunk.remove))); + if (@TypeOf(TextChunk.removed) != GetterType) + @compileLog("Expected TextChunk.removed to be a getter"); + + if (@TypeOf(TextChunk.replace) != CallbackType) + @compileLog("Expected TextChunk.replace to be a callback but received " ++ @typeName(@TypeOf(TextChunk.replace))); + if (@TypeOf(TextChunk.getText) != GetterType) + @compileLog("Expected TextChunk.getText to be a getter"); + + if (!JSC.is_bindgen) { + @export(TextChunk.after, .{ .name = "TextChunkPrototype__after" }); + @export(TextChunk.before, .{ .name = "TextChunkPrototype__before" }); + @export(TextChunk.finalize, .{ .name = "TextChunkClass__finalize" }); + @export(TextChunk.getText, .{ .name = "TextChunkPrototype__getText" }); + @export(TextChunk.lastInTextNode, .{ .name = "TextChunkPrototype__lastInTextNode" }); + @export(TextChunk.remove, .{ .name = "TextChunkPrototype__remove" }); + @export(TextChunk.removed, .{ .name = "TextChunkPrototype__removed" }); + @export(TextChunk.replace, .{ .name = "TextChunkPrototype__replace" }); + } + } +}; pub const JSTextDecoder = struct { const TextDecoder = Classes.TextDecoder; const GetterType = fn (*TextDecoder, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -5071,11 +5792,17 @@ pub const JSTranspiler = struct { }; comptime { + _ = JSAttributeIterator; _ = JSBlob; _ = JSBuildArtifact; _ = JSBuildMessage; + _ = JSComment; _ = JSCryptoHasher; _ = JSDirent; + _ = JSDocEnd; + _ = JSDocType; + _ = JSElement; + _ = JSEndTag; _ = JSExpect; _ = JSExpectAny; _ = JSExpectAnything; @@ -5083,6 +5810,7 @@ comptime { _ = JSExpectStringMatching; _ = JSFSWatcher; _ = JSFileSystemRouter; + _ = JSHTMLRewriter; _ = JSListener; _ = JSMD4; _ = JSMD5; @@ -5102,6 +5830,7 @@ comptime { _ = JSSubprocess; _ = JSTCPSocket; _ = JSTLSSocket; + _ = JSTextChunk; _ = JSTextDecoder; _ = JSTimeout; _ = JSTranspiler; diff --git a/src/bun.js/bindings/generated_classes_list.zig b/src/bun.js/bindings/generated_classes_list.zig index 543d492b5..2c2dc86ac 100644 --- a/src/bun.js/bindings/generated_classes_list.zig +++ b/src/bun.js/bindings/generated_classes_list.zig @@ -2,6 +2,14 @@ const JSC = @import("root").bun.JSC; pub const Classes = struct { pub const Blob = JSC.WebCore.Blob; + pub const HTMLRewriter = JSC.Cloudflare.HTMLRewriter; + pub const Element = JSC.Cloudflare.Element; + pub const Comment = JSC.Cloudflare.Comment; + pub const TextChunk = JSC.Cloudflare.TextChunk; + pub const DocType = JSC.Cloudflare.DocType; + pub const DocEnd = JSC.Cloudflare.DocEnd; + pub const EndTag = JSC.Cloudflare.EndTag; + pub const AttributeIterator = JSC.Cloudflare.AttributeIterator; pub const CryptoHasher = JSC.API.Bun.Crypto.CryptoHasher; pub const Dirent = JSC.Node.Dirent; pub const Expect = JSC.Expect.Expect; diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index a1dd77674..a6fa35517 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -88,10 +88,6 @@ const PackageManager = @import("../install/install.zig").PackageManager; const ModuleLoader = JSC.ModuleLoader; const FetchFlags = JSC.FetchFlags; -pub const GlobalConstructors = [_]type{ - JSC.Cloudflare.HTMLRewriter.Constructor, -}; - pub const GlobalClasses = [_]type{ Bun.Class, WebCore.Crypto.Class, @@ -459,8 +455,6 @@ pub const VirtualMachine = struct { /// [] argv: []const []const u8 = &[_][]const u8{"bun"}, - global_api_constructors: [GlobalConstructors.len]JSC.JSValue = undefined, - origin_timer: std.time.Timer = undefined, origin_timestamp: u64 = 0, macro_event_loop: EventLoop = EventLoop{}, @@ -885,31 +879,6 @@ pub const VirtualMachine = struct { return classes; } - pub fn getAPIConstructors(globalObject: *JSGlobalObject) []const JSC.JSValue { - if (is_bindgen) - return &[_]JSC.JSValue{}; - const is_first = !VirtualMachine.get().has_loaded_constructors; - if (is_first) { - VirtualMachine.get().global = globalObject; - VirtualMachine.get().has_loaded_constructors = true; - } - - var slice = if (is_first) - @as([]JSC.JSValue, &JSC.VirtualMachine.get().global_api_constructors) - else - VirtualMachine.get().allocator.alloc(JSC.JSValue, GlobalConstructors.len) catch unreachable; - - inline for (GlobalConstructors, 0..) |Class, i| { - var ref = Class.constructor(globalObject.ref()).?; - JSC.C.JSValueProtect(globalObject.ref(), ref); - slice[i] = JSC.JSValue.fromRef( - ref, - ); - } - - return slice; - } - pub fn isWatcherEnabled(this: *VirtualMachine) bool { return this.bun_dev_watcher != null or this.bun_watcher != null; } |