Last active
October 7, 2023 23:20
-
-
Save jorendorff/6fff207db165d32c1182de34430ecd04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var XHREventTargetPrototype = Object.getPrototypeOf(XMLHttpRequest.prototype); | |
var desc = Object.getOwnPropertyDescriptor(XHREventTargetPrototype, "onload"); | |
var real_set_onload = desc.set; | |
Object.defineProperty(XHREventTargetPrototype, "onload", { | |
set: function onload(real_callback) { | |
real_set_onload.call(this, function fake_callback() { | |
console.log("loaded:", arguments); | |
return real_callback.apply(this, arguments); | |
}); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment