Created
April 24, 2017 01:36
-
-
Save whitehat101/e70cf14ec1fe09140c3b0e1973c4873b to your computer and use it in GitHub Desktop.
Debugging WebExtension's webRequest
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
# https://developer.chrome.com/extensions/webRequest | |
listener = (label) -> (details) -> console.log label, details | |
[ | |
'onBeforeRequest' # requestBody, blocking | |
'onBeforeSendHeaders' # requestHeaders, blocking | |
'onSendHeaders' # requestHeaders | |
'onHeadersReceived' # responseHeaders, blocking | |
'onAuthRequired' # responseHeaders, blocking, asyncBlocking | |
'onResponseStarted' # responseHeaders | |
'onBeforeRedirect' # responseHeaders | |
'onCompleted' # responseHeaders | |
'onErrorOccurred' | |
].forEach (event) -> | |
chrome.webRequest[event].addListener listener(event), | |
urls: [ | |
# URL (glob) | |
], | |
[] # extra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment