Skip to content

Commit

Permalink
Bug 1895215 - [devtools] Display cookie's partitionKey in storage pan…
Browse files Browse the repository at this point in the history
…el. r=timhuang,devtools-reviewers,ochameau

Differential Revision: https://phabricator.services.mozilla.com/D216397

UltraBlame original commit: a551f98b192c80a6b84cf2e9d9f441251d522f67
  • Loading branch information
marco-c committed Dec 13, 2024
1 parent eade7b2 commit 17ae93c
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 10 deletions.
128 changes: 128 additions & 0 deletions devtools/client/storage/test/browser_storage_cookies_partitioned.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,14 @@ expandAll
(
)
;
showColumn
(
"
partitionKey
"
true
)
;
info
(
"
Expand Down Expand Up @@ -366,6 +374,36 @@ top
"
)
;
checkCell
(
topLevelExampleComFooId
"
partitionKey
"
"
"
)
;
await
findVariableViewProperties
(
[
{
name
:
"
foo
.
Partition
Key
"
dontMatch
:
true
}
]
)
;
const
nestedExampleComFooId
=
Expand Down Expand Up @@ -412,6 +450,51 @@ nested
"
)
;
checkCell
(
nestedExampleComFooId
"
partitionKey
"
"
https
:
/
/
example
.
com
"
)
;
await
findVariableViewProperties
(
[
{
name
:
"
foo
.
Partition
Key
"
value
:
"
https
:
/
/
example
.
com
"
}
]
)
;
await
selectTreeItem
(
Expand Down Expand Up @@ -478,6 +561,51 @@ party
"
)
;
checkCell
(
thirdPartyPartitionedId
"
partitionKey
"
"
https
:
/
/
example
.
com
"
)
;
await
findVariableViewProperties
(
[
{
name
:
"
fooThirdPartyPartitioned
.
Partition
Key
"
value
:
"
https
:
/
/
example
.
com
"
}
]
)
;
info
(
"
Expand Down
6 changes: 6 additions & 0 deletions devtools/client/storage/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@ isSecure
"
Secure
"
partitionKey
:
"
Partition
Key
"
path
:
"
Expand Down
2 changes: 2 additions & 0 deletions devtools/client/themes/storage.css
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ hostOnly
isHttpOnly
#
sameSite
#
partitioned
{
min
-
Expand Down
162 changes: 160 additions & 2 deletions devtools/server/actors/resources/storage/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,9 @@ return
null
;
}
return
const
obj
=
{
uniqueKey
:
Expand Down Expand Up @@ -1045,6 +1047,116 @@ cookie
)
}
;
if
(
cookie
.
isPartitioned
)
{
const
rawPartitionKey
=
cookie
.
originAttributes
.
partitionKey
;
const
[
scheme
baseDomain
port
]
=
rawPartitionKey
.
replace
(
/
(
?
<
openingparen
>
^
\
(
)
|
(
?
<
closingparen
>
\
)
)
/
g
"
"
)
.
split
(
"
"
)
;
const
partitionKey
=
{
scheme
}
:
/
/
{
baseDomain
}
{
port
!
=
=
undefined
&
&
/
^
\
d
+
/
.
test
(
port
)
?
"
:
"
+
port
:
"
"
}
;
obj
.
partitionKey
=
partitionKey
;
}
return
obj
;
}
getSameSiteStringFromCookie
(
Expand Down Expand Up @@ -1439,7 +1551,9 @@ getFields
(
)
{
return
const
fields
=
[
{
name
Expand Down Expand Up @@ -1612,6 +1726,50 @@ true
}
]
;
if
(
Services
.
prefs
.
getBoolPref
(
"
network
.
cookie
.
CHIPS
.
enabled
"
false
)
)
{
fields
.
push
(
{
name
:
"
partitionKey
"
editable
:
false
hidden
:
false
}
)
;
}
return
fields
;
}
async
editItem
Expand Down
10 changes: 2 additions & 8 deletions devtools/server/actors/resources/utils/parent-process-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1636,14 +1636,6 @@ principal
getBrowsingContextsFromHost
(
host
{
acceptSameProcessIframes
=
true
}
=
{
}
)
{
return
Expand All @@ -1655,6 +1647,8 @@ getAllBrowsingContexts
(
{
acceptSameProcessIframes
:
true
}
)
.
Expand Down

0 comments on commit 17ae93c

Please sign in to comment.