diff options
| author | mrmr1993 | 2016-01-30 13:00:53 +0000 |
|---|---|---|
| committer | mrmr1993 | 2016-01-30 13:07:14 +0000 |
| commit | 91fb337c9d92f6291ef42c55c4d29ca35b710203 (patch) | |
| tree | dc3fbc4f3e0dab37c9fbce5dd61ff46cb6c9c8a4 /background_scripts | |
| parent | c3373252db73430ec466eb0b81a16a5953975e19 (diff) | |
| download | vimium-91fb337c9d92f6291ef42c55c4d29ca35b710203.tar.bz2 | |
Add a basic log page
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index df817e8d..2c93f6fb 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -96,6 +96,11 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) -> # Ensure the sendResponse callback is freed. return false) +logMessage = (message) -> + for viewWindow in chrome.extension.getViews {type: "tab"} + if viewWindow.location.pathname == "/pages/logging.html" + viewWindow.document.getElementById("log-text").value += "#{(new Date()).toISOString()}: #{message}\n" + # # Used by the content scripts to get their full URL. This is needed for URLs like "view-source:http:# .." # because window.location doesn't know anything about the Chrome-specific "view-source:". @@ -513,12 +518,12 @@ splitKeyQueue = (queue) -> handleKeyDown = (request, port) -> key = request.keyChar if (key == "<ESC>") - console.log("clearing keyQueue") + logMessage "clearing keyQueue" keyQueue = "" else - console.log("checking keyQueue: [", keyQueue + key, "]") + logMessage "checking keyQueue: [#{keyQueue + key}]" keyQueue = checkKeyQueue(keyQueue + key, port.sender.tab.id, request.frameId) - console.log("new KeyQueue: " + keyQueue) + logMessage "new KeyQueue: #{keyQueue}" # Tell the content script whether there are keys in the queue. # FIXME: There is a race condition here. The behaviour in the content script depends upon whether this message gets # back there before or after the next keystroke. |
