Bug 1884647 - [bidi] Fix partitioning in cookie commands. r=webdriver-reviewers,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D204220
This commit is contained in:
Alexandra Borovova 2024-03-15 15:08:55 +00:00
parent fab6b87d22
commit 1510b2cfbf
2 changed files with 11 additions and 37 deletions

View File

@ -1248,7 +1248,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox default partition key is inconsistent: #12004"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.deleteCookie should delete cookie",
@ -1257,13 +1257,6 @@
"expectations": ["FAIL"],
"comment": "Not supported with cdp"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.deleteCookie should delete cookie for specified URL",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox default partition key is inconsistent: #12004"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.deleteCookie should delete cookie for specified URL",
"platforms": ["darwin", "linux", "win32"],
@ -1276,7 +1269,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "Firefox default partition key is inconsistent: #12004"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.deleteCookie should not delete cookie for different domain",
@ -1285,13 +1278,6 @@
"expectations": ["FAIL"],
"comment": "Not supported with cdp"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should be able to set insecure cookie for HTTP website",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should default to setting secure cookie for HTTPS websites",
"platforms": ["darwin", "linux", "win32"],
@ -1313,13 +1299,6 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set a cookie on a different domain",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set a cookie with a path",
"platforms": ["darwin", "linux", "win32"],
@ -1332,7 +1311,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set cookie with reasonable defaults",
@ -1353,7 +1332,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set multiple cookies",
@ -1367,7 +1346,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set secure same-site cookies from a frame",
@ -1388,7 +1367,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[debugInfo.spec] DebugInfo Browser.debugInfo should work",
@ -1416,7 +1395,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[defaultbrowsercontext.spec] DefaultBrowserContext page.setCookie() should work",
@ -1430,7 +1409,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648"
},
{
"testIdPattern": "[device-request-prompt.spec] device request prompt does not crash",

View File

@ -741,18 +741,14 @@ class StorageModule extends Module {
// Prepare the data in the format required for the platform API.
const originAttributes = this.#getOriginAttributes(storagePartitionKey);
// In case we want to get the cookies for a certain `sourceOrigin`,
// we have to additionally specify `hostname`. When `sourceOrigin` is not present
// `hostname` will stay equal undefined.
let hostname;
// In case we want to get the cookies for a certain `sourceOrigin`,
// we have to separately retrieve cookies for a hostname built from `sourceOrigin`,
// and with `partitionKey` equal an empty string to retrieve the cookies that which were set
// by this hostname but without `partitionKey`, e.g. with `document.cookie`
// by this hostname but without `partitionKey`, e.g. with `document.cookie`.
if (storagePartitionKey.sourceOrigin) {
const url = new URL(storagePartitionKey.sourceOrigin);
hostname = url.hostname;
const hostname = url.hostname;
const principal = Services.scriptSecurityManager.createContentPrincipal(
Services.io.newURI(url),
@ -780,8 +776,7 @@ class StorageModule extends Module {
// Add the cookies which exactly match a built partition attributes.
store = store.concat(
Services.cookies.getCookiesWithOriginAttributes(
JSON.stringify(originAttributes),
hostname
JSON.stringify(originAttributes)
)
);