Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
inspect assignments to innerHTML
/* inject via
ppmm.loadFrameScript("data:,<js source>", true);
(where ppmm is the message manager, e.g. in shell.js)
framescript documentation explains why this works[1] and
the message manager docs[2] explain that the parent process
manager defined as ppmm in shell.js[3] can be used.
(function () {
var setter = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML').set;
Object.defineProperty(Element.prototype, 'innerHTML', {
set: function innerHTML_Setter(val) {;
console.log('innerHTML on Object:', this, );
console.log('Value:', JSON.stringify(val));
var stack = new Error().stack;
// Remove this function from the stack:
stack = stack.trim().split('\n').slice(1).join(' <- ')
console.log('Stack: ', stack)
// call original innerHTML setter:
return, val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.