Problem/Motivation
I have a site that uses eu_c_c 1.36.
It is set to automatically delete cookies if consent is not given.
While the popup is displaying, and if I choose not to give consent, I see this JS error consistently, in both Edge and Chrome:
Uncaught TypeError: pattern.indexOf is not a function
at Function.Drupal.eu_cookie_compliance.cookieMatches (eu_cookie_compliance.js?qltg60:777)
at Function.Drupal.eu_cookie_compliance.isAllowed (eu_cookie_compliance.js?qltg60:804)
at Drupal.eu_cookie_compliance.BlockCookies (eu_cookie_compliance.js?qltg60:932)
The error goes away if I turn off automatic cookie deletion.
Unfortunately, I need automatic cookie deletion. :-)
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
mile23When I add some logging to show what's being passed to
cookieMatches(), I see this:So the first one is because there are no allowed cookies configured. The middle ones make sense. That last one however...
So we ignore functions by defensively checking for strings.
I'm far from a JavaScript expert, so there might be a better solution.
Here's a patch against 7.x-1.x.
Comment #3
mile23Comment #4
mile23It turns out this issue applies to 8.x-1.x as well.
The patch in #2 does not apply to 8.x-1.x, but can be easily reproduced for it.
Comment #5
suresh prabhu parkala commentedPatch against 8.x-1.x. Please review.
Comment #7
svenryen commentedComment #9
svenryen commentedFixed Drupal.settings => drupalSettings in the d8 patch.
Comment #11
svenryen commentedApplied and tested - thanks for the patches!