From 3876a4f06de77d190fdaecc6cf99eb57134d0372 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 15 Mar 2015 12:32:42 +0000 Subject: Populate popup with frame's URL. Previously, we have been populating the suggested exclusion URL in the page popup with the tab's URL. This uses the active frame's URL instead: - because this is the URL which will affect the current frame (without this, a user can naively add an exclusion rule and it has no effect), and - because, without this, the user has no reasonable way to add exclusion rules for frames such as the hangouts frame on gmail (for which, the URL is not displayed in the address bar). --- pages/options.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pages') diff --git a/pages/options.coffee b/pages/options.coffee index d2950348..61b055c2 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -271,8 +271,12 @@ initPopupPage = -> exclusions = null document.getElementById("optionsLink").setAttribute "href", chrome.runtime.getURL("pages/options.html") + # As the active URL, we choose the most recently registered URL from a frame in the tab, or the tab's own + # URL. + url = chrome.extension.getBackgroundPage().urlForTab[tab.id] || tab.url + updateState = -> - rule = bgExclusions.getRule tab.url, exclusions.readValueFromElement() + rule = bgExclusions.getRule url, exclusions.readValueFromElement() $("state").innerHTML = "Vimium will " + if rule and rule.passKeys "exclude #{rule.passKeys}" @@ -302,7 +306,7 @@ initPopupPage = -> window.close() # Populate options. Just one, here. - exclusions = new ExclusionRulesOnPopupOption(tab.url, "exclusionRules", onUpdated) + exclusions = new ExclusionRulesOnPopupOption(url, "exclusionRules", onUpdated) updateState() document.addEventListener "keyup", updateState -- cgit v1.2.3 From fb24c770645ce1b8178729d4be612d58497ffa5f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 15 Mar 2015 15:04:23 +0000 Subject: Rework page icon handling. Setting the page icon is now driven from the corrently-active frame. - Eliminates a race condition. - Icon matches actual frame state (not tab URL state). - Exclusion-rule changes propagate to all frames. --- pages/options.coffee | 2 -- 1 file changed, 2 deletions(-) (limited to 'pages') diff --git a/pages/options.coffee b/pages/options.coffee index 61b055c2..f60f3bb4 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -295,8 +295,6 @@ initPopupPage = -> Option.saveOptions() $("saveOptions").innerHTML = "Saved" $("saveOptions").disabled = true - chrome.tabs.query { windowId: chrome.windows.WINDOW_ID_CURRENT, active: true }, (tabs) -> - chrome.extension.getBackgroundPage().updateActiveState(tabs[0].id) $("saveOptions").addEventListener "click", saveOptions -- cgit v1.2.3 From 5b84f5cf94d32b6e8be75448f9c06aa7f2068582 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 15 Mar 2015 15:38:36 +0000 Subject: Tidy up exclusion rules/propagation. --- pages/options.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pages') diff --git a/pages/options.coffee b/pages/options.coffee index f60f3bb4..6545189b 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -304,7 +304,7 @@ initPopupPage = -> window.close() # Populate options. Just one, here. - exclusions = new ExclusionRulesOnPopupOption(url, "exclusionRules", onUpdated) + exclusions = new ExclusionRulesOnPopupOption url, "exclusionRules", onUpdated updateState() document.addEventListener "keyup", updateState -- cgit v1.2.3