fix _canEnable being used before setting options

This commit is contained in:
siikamiika 2020-04-14 20:59:42 +03:00
parent 950f50ef94
commit b6f7f8c026

View File

@ -147,7 +147,8 @@ class Frontend extends TextScanner {
} }
async updateOptions() { async updateOptions() {
this.setOptions(await apiOptionsGet(this.getOptionsContext()), this._canEnable()); this.options = await apiOptionsGet(this.getOptionsContext());
this.setOptions(this.options, this._canEnable());
const ignoreNodes = ['.scan-disable', '.scan-disable *']; const ignoreNodes = ['.scan-disable', '.scan-disable *'];
if (!this.options.scanning.enableOnPopupExpressions) { if (!this.options.scanning.enableOnPopupExpressions) {
@ -287,7 +288,6 @@ class Frontend extends TextScanner {
} }
_canEnable() { _canEnable() {
if (this.options === null) { return true; } // called by updateOptions for the first time
return this.popup.depth <= this.options.scanning.popupNestingMaxDepth && !this._disabledOverride; return this.popup.depth <= this.options.scanning.popupNestingMaxDepth && !this._disabledOverride;
} }