mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-15 15:58:57 +00:00
Correct exception on custom element re-definition
This commit is contained in:
@@ -73,8 +73,8 @@ pub const JsApi = struct {
|
||||
pub const empty_with_no_proto = true;
|
||||
};
|
||||
|
||||
pub const getRandomValues = bridge.function(Crypto.getRandomValues, .{ });
|
||||
pub const randomUUID = bridge.function(Crypto.randomUUID, .{ });
|
||||
pub const getRandomValues = bridge.function(Crypto.getRandomValues, .{});
|
||||
pub const randomUUID = bridge.function(Crypto.randomUUID, .{});
|
||||
};
|
||||
|
||||
const testing = @import("../../testing.zig");
|
||||
|
||||
@@ -51,7 +51,8 @@ pub fn define(self: *CustomElementRegistry, name: []const u8, constructor: js.Fu
|
||||
|
||||
const gop = try self._definitions.getOrPut(page.arena, name);
|
||||
if (gop.found_existing) {
|
||||
return error.AlreadyDefined;
|
||||
// Yes, this is the correct error to return when trying to redefine a name
|
||||
return error.NotSupported;
|
||||
}
|
||||
|
||||
const owned_name = try page.dupeString(name);
|
||||
|
||||
@@ -47,7 +47,7 @@ pub fn getName(self: *const DOMException) []const u8 {
|
||||
.invalid_character_error => "InvalidCharacterError",
|
||||
.syntax_error => "SyntaxError",
|
||||
.not_found => "NotFoundError",
|
||||
.not_supported => "NotSupported",
|
||||
.not_supported => "NotSupportedError",
|
||||
.hierarchy_error => "HierarchyError",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ var zero_rect: DOMRect = .{
|
||||
pub const ObserverInit = struct {
|
||||
root: ?*Element = null,
|
||||
rootMargin: ?[]const u8 = null,
|
||||
threshold: Threshold = .{.scalar = 0.0},
|
||||
threshold: Threshold = .{ .scalar = 0.0 },
|
||||
|
||||
const Threshold = union(enum) {
|
||||
scalar: f64,
|
||||
@@ -74,12 +74,7 @@ pub fn init(callback: js.Function, options: ?ObserverInit, page: *Page) !*Inters
|
||||
.array => |arr| try page.arena.dupe(f64, arr),
|
||||
};
|
||||
|
||||
return page._factory.create(IntersectionObserver{
|
||||
._callback = callback,
|
||||
._root = opts.root,
|
||||
._root_margin = root_margin,
|
||||
._threshold = threshold
|
||||
});
|
||||
return page._factory.create(IntersectionObserver{ ._callback = callback, ._root = opts.root, ._root_margin = root_margin, ._threshold = threshold });
|
||||
}
|
||||
|
||||
pub fn observe(self: *IntersectionObserver, target: *Element, page: *Page) !void {
|
||||
|
||||
@@ -14,7 +14,6 @@ pub fn init(page: *Page) !*Headers {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
pub fn append(self: *Headers, name: []const u8, value: []const u8, page: *Page) !void {
|
||||
try self._list.append(page.arena, name, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user