Bug 1720171 - Ensure ga.getAll().filter exists in SmartBlock Google Analytics shim. r=twisniewski,webcompat-reviewers

The original GA code returns an Array for ga.getAll(), while the
shim was returning an Iterator. This caused code that relied on
ga.getAll().filter(..) to break with the shim. This patch wraps
the Iterator contents back into an Array.

Differential Revision: https://phabricator.services.mozilla.com/D119737
This commit is contained in:
Kartikaya Gupta 2021-07-13 16:44:42 +00:00
Родитель b81b2affb2
Коммит ebcf08cd70
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Web Compatibility Interventions", "name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.", "description": "Urgent post-release fixes for web compatibility.",
"version": "24.1.0", "version": "24.2.0",
"applications": { "applications": {
"gecko": { "gecko": {

Просмотреть файл

@ -140,7 +140,7 @@ if (window[window.GoogleAnalyticsObject || "ga"]?.loaded === undefined) {
Object.assign(ga, { Object.assign(ga, {
create: (a, b, c, d) => ga("create", a, b, c, d), create: (a, b, c, d) => ga("create", a, b, c, d),
getAll: () => trackers.values(), getAll: () => Array.from(trackers.values()),
getByName: name => trackers.get(name), getByName: name => trackers.get(name),
loaded: true, loaded: true,
remove: t => ga("remove", t), remove: t => ga("remove", t),