From 7ce0bd8575fcb83184d7538cb3a71a747a2a49cb Mon Sep 17 00:00:00 2001 From: Sebastian C Date: Fri, 5 Sep 2025 12:47:42 -0500 Subject: [PATCH] script: Remove CookieListItem fields that were removed in the spec (#39170) The spec removed all fields from CookieListItem except for name and value Testing: WPT tests cover this already. Signed-off-by: Sebastian C --- components/script/dom/cookiestore.rs | 33 +------------------ .../webidls/CookieStore.webidl | 6 ---- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/components/script/dom/cookiestore.rs b/components/script/dom/cookiestore.rs index 1d445ff3ed2..e3ce07d38e9 100644 --- a/components/script/dom/cookiestore.rs +++ b/components/script/dom/cookiestore.rs @@ -7,7 +7,6 @@ use std::collections::VecDeque; use std::rc::Rc; use base::id::CookieStoreId; -use cookie::Expiration::DateTime; use cookie::{Cookie, SameSite}; use dom_struct::dom_struct; use hyper_serde::Serde; @@ -22,11 +21,9 @@ use servo_url::ServoUrl; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::CookieStoreBinding::{ - CookieInit, CookieListItem, CookieSameSite, CookieStoreDeleteOptions, CookieStoreGetOptions, - CookieStoreMethods, + CookieInit, CookieListItem, CookieStoreDeleteOptions, CookieStoreGetOptions, CookieStoreMethods, }; use crate::dom::bindings::error::Error; -use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object}; use crate::dom::bindings::root::DomRoot; @@ -149,37 +146,9 @@ fn cookie_to_list_item(cookie: Cookie) -> CookieListItem { // TODO: Investigate if we need to explicitly UTF-8 decode without BOM here or if thats // already being done by cookie-rs or implicitly by using rust strings CookieListItem { - // Let domain be the result of running UTF-8 decode without BOM on cookie’s domain. - domain: cookie - .domain() - .map(|domain| Some(domain.to_string().into())), - - // Let expires be cookie’s expiry-time (as a timestamp). - expires: match cookie.expires() { - None | Some(cookie::Expiration::Session) => None, - Some(DateTime(time)) => Some(Some(Finite::wrap((time.unix_timestamp() * 1000) as f64))), - }, - // Let name be the result of running UTF-8 decode without BOM on cookie’s name. name: Some(cookie.name().to_string().into()), - // Let partitioned be a boolean indicating that the user agent supports cookie partitioning and that i - // that cookie has a partition key. - partitioned: Some(false), // Do we support partitioning? Spec says true only if UA supports it - - // Let path be the result of running UTF-8 decode without BOM on cookie’s path. - path: cookie.path().map(|path| path.to_string().into()), - - sameSite: match cookie.same_site() { - Some(SameSite::None) => Some(CookieSameSite::None), - Some(SameSite::Lax) => Some(CookieSameSite::Lax), - Some(SameSite::Strict) => Some(CookieSameSite::Strict), - None => None, // The spec doesnt handle this case, which implies the default of Lax? - }, - - // Let secure be cookie’s secure-only-flag. - secure: cookie.secure(), - // Let value be the result of running UTF-8 decode without BOM on cookie’s value. value: Some(cookie.value().to_string().into()), } diff --git a/components/script_bindings/webidls/CookieStore.webidl b/components/script_bindings/webidls/CookieStore.webidl index 7e81cdbc8cd..14dbd1e8a48 100644 --- a/components/script_bindings/webidls/CookieStore.webidl +++ b/components/script_bindings/webidls/CookieStore.webidl @@ -55,12 +55,6 @@ dictionary CookieStoreDeleteOptions { dictionary CookieListItem { USVString name; USVString value; - USVString? domain; - USVString path; - DOMHighResTimeStamp? expires; - boolean secure; - CookieSameSite sameSite; - boolean partitioned; }; typedef sequence CookieList;