Truly independent web browser
LibWeb: Mark CookieStore change events as trusted
Shannon Booth315fffb0e8be
diff --git a/Libraries/LibWeb/Bindings/Rust/src/cookie_store/cookie_store.rs b/Libraries/LibWeb/Bindings/Rust/src/cookie_store/cookie_store.rsindex 3305a298180..1317c056cc7 100644--- a/Libraries/LibWeb/Bindings/Rust/src/cookie_store/cookie_store.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/cookie_store/cookie_store.rs@@ -1100,6 +1100,7 @@ impl CookieStore {};let event =CookieChangeEvent::create(vm, this.realm, &Utf16String::from_utf8("change"), event_init);+ event.event().set_is_trusted(true);// 7. Dispatch event at target.this.event_target.dispatch_event(event.event());diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex 10d5d973439..6a647afd4d0 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1292,6 +1292,7 @@ Text/input/third-party-cookies-are-partitioned.htmlText/input/cookies-of-a-frame-with-a-cross-site-ancestor-are-partitioned.htmlText/input/document-cookie-uses-the-partition-of-the-asking-document.htmlText/input/cookie-change-events-skip-other-partitions.html+Text/input/cookie-change-event-is-trusted.htmlText/input/SiteIsolation/iframe/removing-remote-iframe-aborts-its-navigation-api.htmlText/input/SiteIsolation/iframe/unload-runs-in-remote-iframe-when-parent-navigates.htmlText/input/SiteIsolation/iframe/remote-iframe-unloads-before-its-parent-hosts-it.htmldiff --git a/Tests/LibWeb/Text/expected/cookie-change-event-is-trusted.txt b/Tests/LibWeb/Text/expected/cookie-change-event-is-trusted.txtnew file mode 100644index 00000000000..8727108de4f--- /dev/null+++ b/Tests/LibWeb/Text/expected/cookie-change-event-is-trusted.txt@@ -0,0 +1 @@+isTrusted: truediff --git a/Tests/LibWeb/Text/input/cookie-change-event-is-trusted.html b/Tests/LibWeb/Text/input/cookie-change-event-is-trusted.htmlnew file mode 100644index 00000000000..ae89178e870--- /dev/null+++ b/Tests/LibWeb/Text/input/cookie-change-event-is-trusted.html@@ -0,0 +1,12 @@+<!DOCTYPE html>+<script src="include.js"></script>+<script>+ promiseTest(async () => {+ const event = await new Promise(resolve => {+ cookieStore.addEventListener("change", resolve, { once: true });+ cookieStore.set("trusted", "1");+ });+ println(`isTrusted: ${event.isTrusted}`);+ await cookieStore.delete("trusted");+ });+</script>