Skip to content

Instantly share code, notes, and snippets.

@doronguttman
Created April 26, 2022 19:34
Show Gist options
  • Save doronguttman/15e58e51871ec095c6a2f38df20963d4 to your computer and use it in GitHub Desktop.
Save doronguttman/15e58e51871ec095c6a2f38df20963d4 to your computer and use it in GitHub Desktop.
Find what code touches url history state
(() => {
const org = history;
const keys = ["pushState", "replaceState"];
keys.forEach(k => {
const desc = Object.getOwnPropertyDescriptor(history, k);
const value = desc.value;
delete desc.value;
delete desc.writable;
desc.get = function() {
debugger;
return value;
}
Object.defineProperty(org, k, desc);
});
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment