(options)
| 22 | } |
| 23 | |
| 24 | export async function activate(options) { |
| 25 | Utils.assertType(VomnibarShowOptions, options || {}); |
| 26 | await Settings.onLoaded(); |
| 27 | userSearchEngines.set(Settings.get("searchEngines")); |
| 28 | |
| 29 | const defaults = { |
| 30 | completer: "omni", |
| 31 | query: "", |
| 32 | newTab: false, |
| 33 | selectFirst: false, |
| 34 | keyword: null, |
| 35 | }; |
| 36 | |
| 37 | options = Object.assign(defaults, options); |
| 38 | |
| 39 | if (ui == null) { |
| 40 | ui = new VomnibarUI(); |
| 41 | } |
| 42 | ui.setCompleterName(options.completer); |
| 43 | ui.refreshCompletions(); |
| 44 | ui.setInitialSelectionValue(options.selectFirst ? 0 : -1); |
| 45 | ui.setForceNewTab(options.newTab); |
| 46 | ui.setQuery(options.query); |
| 47 | ui.setActiveUserSearchEngine(userSearchEngines.keywordToEngine[options.keyword]); |
| 48 | // Use await here for vomnibar_test.js, so that this page doesn't get unloaded while a test is |
| 49 | // running. |
| 50 | await ui.update(); |
| 51 | } |
| 52 | |
| 53 | class VomnibarUI { |
| 54 | constructor() { |
no test coverage detected