-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Summary
Five integrations (Lockr, Permutive, DataDome, GTM, GPT) independently monkey-patch Element.prototype.appendChild and Element.prototype.insertBefore. Each captures the current prototype method at install time, creating a chain of 4+ wrappers. Every single appendChild call on the publisher page (including text nodes, divs, analytics pixels) now executes 4+ function calls with string checks.
The shared guard's reset() only flips a boolean — it does not restore the original prototype methods, so SPA contexts and test runs accumulate wrappers.
Refs
crates/js/lib/src/shared/script_guard.tslines 155-191 — shared factory patchescrates/js/lib/src/integrations/gpt/script_guard.tslines 432-450 — independent GPT patchcrates/js/lib/src/shared/script_guard.tslines 197-199 —reset()doesn't restore originals
Recommendation
Use a centralized dispatcher — single prototype patch, register per-integration handlers. Implement proper reset() that restores originals.
Context
Production readiness audit — see #396
Reactions are currently unavailable