The onChanged
event of the cookies
API fires when a cookie that the extension can access is set or removed.
Note: When storage partitioning is active, cookies.Cookie.partitionKey
contains the description of the cookie's storage partition. When modifying cookies, it's important to pass this value to cookies.set()
or cookies.remove()
to ensure the extension works with the correct cookie.
Note that updating a cookie's properties is implemented as a two step process:
- First, the cookie to be updated is first removed entirely, generating a notification with a
cookies.OnChangedCause
ofoverwrite
. - Next, a new cookie is written with the updated values, generating a second notification with a
cookies.OnChangedCause
ofexplicit
.