When using the module and accessing the site in Firefox with the network.cookie.sameSite.laxByDefault
configuration set to true
, the following error message appears repeatedly in the browser console:
Cookie “0” has “SameSite” policy set to “Lax” because it is missing a “SameSite” attribute, and “SameSite=Lax” is the default value for this attribute.
The same message is shown for cookies "1"
and "2"
, and the messages are logged every 5 seconds. However, these cookie names ("0"
, "1"
, "2"
) do not exist.
The module sets three valid cookies: cookie-agreed-categories
, cookie-agreed-version
, cookie-agreed
. These cookies are set with SameSite=Strict.
The issue seems to arise from a Javascript bug.
In version 1.25, the function used to retrieve cookies changed:
cookies.get()
function returned an object.getCookie()
function returns an array.
See https://git.drupalcode.org/project/eu-cookie-compliance/-/commit/898b662...
This behavior explains the incorrect cookie names "0"
, "1"
, "2"
: they are array indices instead of actual cookie names.
While the problem is evident in Firefox when network.cookie.sameSite.laxByDefault
is set to true
, the underlying issue affects all browsers. For users of other browsers or those not enabling this Firefox configuration, the issue may not produce visible console errors but still results in incorrect cookie handling.
network.cookie.sameSite.laxByDefault
to true
in about:config
."0"
, "1"
, "2"
.The Javascript function responsible for reading and deleting cookies must correctly handle the array output from getCookie()
. Specifically:
getCookie()
.Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.