Skip to content

Commit

Permalink
Delete incorrect assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Nov 23, 2024
1 parent f855ae8 commit aa60ab3
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/bun.js/api/BunObject.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3234,29 +3234,6 @@ pub export fn Bun__escapeHTML16(globalObject: *JSC.JSGlobalObject, input_value:
},
.original => return input_value,
.allocated => |escaped_html| {
if (comptime Environment.allow_assert) {
// assert that re-encoding the string produces the same result
assert(
std.mem.eql(
u16,
(strings.toUTF16Alloc(bun.default_allocator, strings.toUTF8Alloc(bun.default_allocator, escaped_html) catch unreachable, false, false) catch unreachable).?,
escaped_html,
),
);

// assert we do not allocate a new string unnecessarily
assert(
!std.mem.eql(
u16,
input_slice,
escaped_html,
),
);

// the output should always be longer than the input
assert(escaped_html.len > input_slice.len);
}

return ZigString.from16(escaped_html.ptr, escaped_html.len).toExternalValue(globalObject);
},
}
Expand Down

0 comments on commit aa60ab3

Please sign in to comment.