Created
June 23, 2016 02:53
-
-
Save r-k-b/f804b3c2e7f6800f4c326ec11a190b8d to your computer and use it in GitHub Desktop.
Break on alert()
This file contains 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
// ==UserScript== | |
// @name Break on alert() | |
// @namespace https://gist.github.com/r-k-b/ | |
// @version 1.0.0 | |
// @description Where is that damned `alert()` called from? This drops the trace in the console. If the Dev Tools are open, it'll also pause execution. | |
// @author Robert K. Bell | |
// @homepage https://gist.github.com/r-k-b/f804b3c2e7f6800f4c326ec11a190b8d | |
// @downloadURL https://gist.github.com/r-k-b/f804b3c2e7f6800f4c326ec11a190b8d/raw/break-on-alert.user.js | |
// @match *://*/* | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
/* jshint esnext: true */ | |
(() => { | |
'use strict'; | |
const oldAlert = alert; | |
alert = function() { | |
console.trace('here\'s the trace for an `alert()`, called with args:', arguments); | |
debugger; | |
oldAlert(...arguments); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment