From 24a6217f26911ba4e934f4a7bff8bcd30c227163 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 23 Oct 2016 16:50:48 +0100 Subject: Move SearchEngines to bg-utils.coffee. `SearchEngines` was previously in `utils.coffee`, which means it was loaded in *every* content frame. This is unnecessary, since it is only used on the background page. So this PR moves it there. Also: - Simplify some unnecessarily complex logic in `vomnibar.coffee`. - Re-use `Utils.parseLines()` to parse the custom search engine configuation text. --- content_scripts/vomnibar.coffee | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 49c4288e..04499523 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -4,22 +4,19 @@ Vomnibar = vomnibarUI: null - # Parse any additional options from the command's registry entry. Currently, this only includes a flag of - # the form "keyword=X", for direct activation of a custom search engine. - parseRegistryEntry: (registryEntry = { options: [] }, callback = null) -> - searchEngines = Settings.get("searchEngines") ? "" - SearchEngines.refreshAndUse searchEngines, (engines) -> - callback? registryEntry.options + # Extract any additional options from the command's registry entry. + extractOptionsFromRegistryEntry: (registryEntry, callback) -> + callback? extend {}, registryEntry.options # sourceFrameId here (and below) is the ID of the frame from which this request originates, which may be different # from the current frame. activate: (sourceFrameId, registryEntry) -> - @parseRegistryEntry registryEntry, (options) => + @extractOptionsFromRegistryEntry registryEntry, (options) => @open sourceFrameId, extend options, completer:"omni" activateInNewTab: (sourceFrameId, registryEntry) -> - @parseRegistryEntry registryEntry, (options) => + @extractOptionsFromRegistryEntry registryEntry, (options) => @open sourceFrameId, extend options, completer:"omni", newTab: true activateTabSelection: (sourceFrameId) -> @open sourceFrameId, { -- cgit v1.2.3