Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/build/deps/webkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* for local mode. Override via `--webkit-version=<hash>` to test a branch.
* From https://github.com/oven-sh/WebKit releases.
*/
export const WEBKIT_VERSION = "c4ddc0cf5255ec9cc209e6369292739b78e3ca80";
export const WEBKIT_VERSION = "autobuild-preview-pr-517-f390a25a";

/**
* WebKit (JavaScriptCore) — the JS engine.
Expand Down
37 changes: 37 additions & 0 deletions test/js/bun/jsc/webkit-upgrade-f390a25a.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { describe, expect, test } from "bun:test";

// Coverage for the WebKit f390a25a sync (oven-sh/WebKit#517): under the u and
// v flags, an identity escape of a non-ASCII character must be a SyntaxError.
// Yarr only validated ASCII escapes, so /\Ç/u compiled and matched with the
// Annex B meaning. Fixes oven-sh/bun#40441.

describe.concurrent("WebKit f390a25a upgrade", () => {
test("non-ASCII identity escapes throw under the u and v flags", () => {
expect(() => new RegExp("\\Ç", "u")).toThrow(SyntaxError);
expect(() => new RegExp("\\Ç", "v")).toThrow(SyntaxError);
expect(() => new RegExp("\\é", "u")).toThrow(SyntaxError);
expect(() => new RegExp("\\字", "u")).toThrow(SyntaxError);
expect(() => new RegExp("\\𝒳", "u")).toThrow(SyntaxError);
expect(() => new RegExp("\\𝒳", "v")).toThrow(SyntaxError);
expect(() => new RegExp("[\\Ç]", "u")).toThrow(SyntaxError);
expect(() => new RegExp("[\\Ç]", "v")).toThrow(SyntaxError);
expect(() => new RegExp("[\\q{\\Ç}]", "v")).toThrow(SyntaxError);
});

test("ASCII identity escapes keep their behavior", () => {
// Still invalid under u: not a SyntaxCharacter or '/'.
expect(() => new RegExp("\\q", "u")).toThrow(SyntaxError);
expect(() => new RegExp("\\\u0000", "u")).toThrow(SyntaxError);
// Still valid.
expect(new RegExp("\\$", "u").test("$")).toBe(true);
expect(new RegExp("\\/", "u").test("/")).toBe(true);
expect(new RegExp("[\\-]", "u").test("-")).toBe(true);
expect(new RegExp("[\\&]", "v").test("&")).toBe(true);
});

test("non-unicode patterns and escaped code points are unchanged", () => {
expect(new RegExp("\\Ç").test("Ç")).toBe(true);
expect(new RegExp("Ç", "u").test("Ç")).toBe(true);
expect(new RegExp("\\u00C7", "u").test("Ç")).toBe(true);
});
});
Loading