From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- browser/extensions/webcompat/shims/eluminate.js | 95 +++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 browser/extensions/webcompat/shims/eluminate.js (limited to 'browser/extensions/webcompat/shims/eluminate.js') diff --git a/browser/extensions/webcompat/shims/eluminate.js b/browser/extensions/webcompat/shims/eluminate.js new file mode 100644 index 0000000000..3fa65c048c --- /dev/null +++ b/browser/extensions/webcompat/shims/eluminate.js @@ -0,0 +1,95 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * Bug 1606448 - Shim CoreMetrics Eluminate analytics + * + * Sites may rely on eluminate.js tracking in ways which cause breakage, + * which has been seen on shopping sites such as Vans.com, where the + * search filtering UX is broken. This shim mitigates such breakage. + */ + +if (!window.CM_DDX) { + window.CM_DDX = { + domReadyFired: false, + headScripts: true, + dispatcherLoadRequested: false, + firstPassFunctionBinding: false, + BAD_PAGE_ID_ELAPSED_TIMEOUT: 5000, + version: -1, + standalone: false, + test: { + syndicate: true, + testCounter: "", + doTest: false, + newWin: false, + process: () => {}, + }, + partner: {}, + invokeFunctionWhenAvailable: a => { + a(); + }, + gup: d => "", + privacy: { + isDoNotTrackEnabled: () => false, + setDoNotTrack: () => {}, + getDoNotTrack: () => false, + }, + setSubCookie: () => {}, + }; + const noopfn = () => {}; + const w = window; + w.cmAddShared = noopfn; + w.cmCalcSKUString = noopfn; + w.cmCreateManualImpressionTag = noopfn; + w.cmCreateManualLinkClickTag = noopfn; + w.cmCreateManualPageviewTag = noopfn; + w.cmCreateOrderTag = noopfn; + w.cmCreatePageviewTag = noopfn; + w.cmExecuteTagQueue = noopfn; + w.cmRetrieveUserID = noopfn; + w.cmSetClientID = noopfn; + w.cmSetCurrencyCode = noopfn; + w.cmSetFirstPartyIDs = noopfn; + w.cmSetSubCookie = noopfn; + w.cmSetupCookieMigration = noopfn; + w.cmSetupNormalization = noopfn; + w.cmSetupOther = noopfn; + w.cmStartTagSet = noopfn; + w.cmCreateConversionEventTag = noopfn; + w.cmCreateDefaultPageviewTag = noopfn; + w.cmCreateElementTag = noopfn; + w.cmCreateManualImpressionTag = noopfn; + w.cmCreateManualLinkClickTag = noopfn; + w.cmCreateManualPageviewTag = noopfn; + w.cmCreatePageElementTag = noopfn; + w.cmCreatePageviewTag = noopfn; + w.cmCreateProductElementTag = noopfn; + w.cmCreateProductviewTag = noopfn; + w.cmCreateTechPropsTag = noopfn; + w.cmLoadIOConfig = noopfn; + w.cmSetClientID = noopfn; + w.cmSetCurrencyCode = noopfn; + w.cmSetFirstPartyIDs = noopfn; + w.cmSetupCookieMigration = noopfn; + w.cmSetupNormalization = noopfn; + + w.cmSetupOther = b => { + for (const a in b) { + window[a] = b[a]; + } + }; + + const techProps = {}; + + w.coremetrics = { + cmLastReferencedPageID: "", + cmLoad: noopfn, + cmUpdateConfig: noopfn, + getTechProps: () => techProps, + isDef: c => typeof c !== "undefined" && c, + }; +} -- cgit v1.2.3