aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-02 12:47:15 -0400
committerGitHub <noreply@github.com>2020-05-02 12:47:15 -0400
commit08ada6844af424e8ff28e592fc6b9dbc1a9a97eb (patch)
tree1c025f5522b76aa9dbb534b3328f96a5afb9125b /ext/bg
parentce861ce079f8588b12e7b6d6208dee817b09bafa (diff)
Remove Frontend inheritance (#486)
* Make Frontend use composition instead of inheritance for TextScanner * Use push instead of concat * Update setOptions and setEnabled APIs * Update how onWindowMessage event listener is added/removed * Rename options to _options * Use bind instead of arrow function * Fix selection being cleared due to settings changes
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/search-query-parser.js1
-rw-r--r--ext/bg/js/settings/popup-preview-frame.js9
2 files changed, 4 insertions, 6 deletions
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index 3215f8e4..137234e8 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -86,6 +86,7 @@ class QueryParser extends TextScanner {
setOptions(options) {
super.setOptions(options);
+ super.setEnabled(true);
this.queryParser.dataset.termSpacing = `${options.parsing.termSpacing}`;
}
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js
index e73c04a0..cb548ed7 100644
--- a/ext/bg/js/settings/popup-preview-frame.js
+++ b/ext/bg/js/settings/popup-preview-frame.js
@@ -66,12 +66,10 @@ class SettingsPopupPreview {
this.popup.setCustomOuterCss = this.popupSetCustomOuterCss.bind(this);
this.frontend = new Frontend(this.popup);
-
this.frontend.getOptionsContext = async () => this.optionsContext;
- this.frontend.setEnabled = () => {};
- this.frontend.clearSelection = () => {};
-
await this.frontend.prepare();
+ this.frontend.setDisabledOverride(true);
+ this.frontend.canClearSelection = false;
// Update search
this.updateSearch();
@@ -169,8 +167,7 @@ class SettingsPopupPreview {
const source = new TextSourceRange(range, range.toString(), null, null);
try {
- await this.frontend.onSearchSource(source, 'script');
- this.frontend.setCurrentTextSource(source);
+ await this.frontend.setTextSource(source);
} finally {
source.cleanup();
}