From 4a0f4488fd0d06650df7b422d98eb48e8e785a97 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 8 Nov 2026 18:33:26 -0800 Subject: [PATCH] Fix regressions --- styles/all/template/js/consentmanager.js | 2 +- tests/javascript/consentmanager.test.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/styles/all/template/js/consentmanager.js b/styles/all/template/js/consentmanager.js index 58a0fc1..5d687ed 100644 --- a/styles/all/template/js/consentmanager.js +++ b/styles/all/template/js/consentmanager.js @@ -309,7 +309,7 @@ } function buildGoogleConsentModeState() { - const consentState = Object.create(null); + const consentState = {}; if (!googleConsentMode.enabled) { return consentState; diff --git a/tests/javascript/consentmanager.test.js b/tests/javascript/consentmanager.test.js index 440987d..be47c33 100644 --- a/tests/javascript/consentmanager.test.js +++ b/tests/javascript/consentmanager.test.js @@ -175,6 +175,10 @@ function setupConsentManager(options) { if (settings.withGtag) { window.gtagCalls = gtagCalls; window.gtag = function() { + const consentState = arguments[2]; + if (consentState && typeof consentState.hasOwnProperty !== 'function') { + throw new TypeError('Google Consent Mode requires a plain state object.'); + } gtagCalls.push(Array.prototype.slice.call(arguments)); }; } @@ -412,7 +416,7 @@ test('marks the consent cookie secure only on HTTPS', () => { }); test('updates Google consent mode before activating newly consented marketing scripts', () => { - const { window, gtagCalls } = setupConsentManager({ + const { window, document, gtagCalls } = setupConsentManager({ withGtag: true, extraMarkup: `