aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorilya2011-03-17 17:12:30 -0700
committerilya2011-03-17 17:12:30 -0700
commit74b2c05f7a42ab382e9bdea5502807424dc72b79 (patch)
tree0348946fd5d9c57cffa179529aac4afb648085fe /background_page.html
parentde4c7daaae2d21c535023c46823b3bd2c3ca8ff1 (diff)
downloadvimium-74b2c05f7a42ab382e9bdea5502807424dc72b79.tar.bz2
Simplified the completion keys logic and fixed a discovered bug regarding refreshing completion keys when a new mapping is saved.
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html17
1 files changed, 9 insertions, 8 deletions
diff --git a/background_page.html b/background_page.html
index 0e47bbf7..4763c0d6 100644
--- a/background_page.html
+++ b/background_page.html
@@ -69,7 +69,7 @@
};
var sendRequestHandlers = {
- getCompletionKeys: getCompletionKeys,
+ getCompletionKeys: getCompletionKeysRequest,
getLinkHintCss: getLinkHintCss,
openUrlInNewTab: openUrlInNewTab,
openUrlInCurrentTab: openUrlInCurrentTab,
@@ -234,8 +234,11 @@
/**
* Returns the keys that can complete a valid command given the current key queue.
*/
- function getCompletionKeys(request) {
- return {completionKeys: generateCompletionKeys()};
+ function getCompletionKeysRequest(request) {
+ return { name: "refreshCompletionKeys",
+ completionKeys: generateCompletionKeys(),
+ validFirstKeys: validFirstKeys
+ };
}
/**
@@ -500,7 +503,7 @@
populateValidFirstKeys();
populateSingleKeyCommands();
- sendRequestToAllTabs({ name: "refreshCompletionKeys", completionKeys: generateCompletionKeys() });
+ sendRequestToAllTabs(getCompletionKeysRequest());
}
/*
@@ -590,10 +593,8 @@
// If we haven't sent the completion keys piggybacked on executePageCommand,
// send them by themselves.
- if (!refreshedCompletionKeys)
- {
- var port = chrome.tabs.connect(tabId, { name: "refreshCompletionKeys" });
- port.postMessage({ completionKeys: generateCompletionKeys(newKeyQueue) });
+ if (!refreshedCompletionKeys) {
+ chrome.tabs.sendRequest(tabId, getCompletionKeysRequest(), null);
}
return newKeyQueue;