Skip to content

cdpToBiDiCookie mapping of expiration values not compliant with WebDriver BiDi spec #3936

@jimevans

Description

@jimevans

The WebDriver BiDi spec says that a cookie's expiry field should be a js-uint. The expires field of CDP's Network.Cookie object is defined to be a number. The cdpToBiDiCookie function in NetworkUtils.ts sets the value of the BiDi cookie's expiry field directly to the value of the incoming CDP cookie's expires field. This leads to the protocol value across the wire of the BiDi Cookie to potentially be a floating point value.

Relevant log lines captured from client testing (note the floating-point expiry value in the second cookie in the response):

Log message: SEND >>> {
  "id":4,
  "method":"storage.getCookies",
  "params":{}
}
Log message: RECV <<< {
  "id":4,
  "result":{
    "cookies":[
      {
        "domain":"web-platform.test",
        "goog:priority":"Medium",
        "goog:sameParty":false,
        "goog:session":true,
        "goog:sourcePort":62610,
        "goog:sourceScheme":"NonSecure",
        "httpOnly":false,
        "name":"customCookieName",
        "path":"/",
        "sameSite":"none",
        "secure":false,
        "size":33,
        "value":{
          "type":"string",
          "value":"customCookieValue"
        }
      },
      {
        "domain":"web-platform.test",
        "expiry":1765140031.259585,
        "goog:priority":"Medium",
        "goog:sameParty":false,
        "goog:session":false,
        "goog:sourcePort":62610,
        "goog:sourceScheme":"NonSecure",
        "httpOnly":false,
        "name":"ServerSuppliedCookie",
        "path":"/",
        "sameSite":"none",
        "secure":false,
        "size":37,
        "value":{
          "type":"string",
          "value":"ServerCookieValue"
        }
      }
    ],
    "partitionKey":{
      "userContext":"default"
    }
  },
  "type":"success"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions