Permalink
Browse files

skin: add header/30x debug

  • Loading branch information...
1 parent ffdc64a commit 827ef864e58040283d4bab3da736ab1ebd3ba672 @presbrey presbrey committed Nov 2, 2012
Showing with 17 additions and 6 deletions.
  1. +6 −1 background.coffee
  2. +11 −5 skin.coffee
View
@@ -87,10 +87,15 @@ class Client
for {api, handler} in @hooks
api.removeListener handler
onCompleted: (d) ->
+ d.eventName = 'onCompleted'
@port.postMessage d
onHeadersReceived: (d) ->
- @port.postMessage d
+ d.eventName = 'onHeadersReceived'
+ d.statusCode = parseInt d.statusLine.split(' ')[1]
+ if d.statusCode in [301, 302, 303, 307]
+ @port.postMessage d
onErrorOccurred: (d) ->
+ d.eventName = 'onErrorOccurred'
@port.postMessage d
@hooks: [
api: chrome.webRequest.onCompleted
View
@@ -3,17 +3,23 @@
port = null
connect = ->
port = chrome.extension.connect()
- port.onMessage.addListener (data) ->
- {method, url, statusLine, responseHeaders} = data
- #console.log "#{method} <#{url}> #{statusLine}"
- #for {name, value} in data.responseHeaders when name is 'Location'
- # console.log "#{name}: #{value}"
+ port.onMessage.addListener (d) ->
+ console.log "[#{d.eventName}] [#{d.statusCode}] <#{d.url}>"
+ if d.responseHeaders
+ for {name, value} in d.responseHeaders when name.toLowerCase() in ['content-location','link','location','updates-via']
+ console.log Array(d.eventName.length+3).join(' '), "[#{name}] #{value}"
port.onDisconnect.addListener ->
setTimeout(connect, 1000)
connect()
+setup = (api) ->
+ api.sf.addCallback 'fail', (uri) ->
+ console.log '[onFetcherFail]', "<#{uri}>", arguments
+ true
+
load = (uri) ->
window.document.title = uri
+ setup tabulator
kb = tabulator.kb
subject = kb.sym(uri)
tabulator.outline.GotoSubject(subject, true, undefined, true, undefined)

0 comments on commit 827ef86

Please sign in to comment.