Skip to content

Instantly share code, notes, and snippets.

@whitehat101
Created April 24, 2017 01:36
Show Gist options
  • Save whitehat101/e70cf14ec1fe09140c3b0e1973c4873b to your computer and use it in GitHub Desktop.
Save whitehat101/e70cf14ec1fe09140c3b0e1973c4873b to your computer and use it in GitHub Desktop.
Debugging WebExtension's webRequest
# 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