Don't pass null textSource into searchSource
This commit is contained in:
parent
185963899b
commit
dcb6f68826
@ -158,9 +158,14 @@ class SettingsPopupPreview {
|
||||
const range = document.createRange();
|
||||
range.selectNode(textNode);
|
||||
const source = new TextSourceRange(range, range.toString(), null);
|
||||
if (source === null) { return; }
|
||||
|
||||
this.frontend.textSourceLast = null;
|
||||
try {
|
||||
await this.frontend.searchSource(source, 'script');
|
||||
} finally {
|
||||
source.cleanup();
|
||||
}
|
||||
await this.frontend.lastShowPromise;
|
||||
|
||||
if (this.frontend.popup.isVisible()) {
|
||||
|
@ -319,19 +319,27 @@ class Frontend {
|
||||
}
|
||||
|
||||
const textSource = docRangeFromPoint(x, y, this.options);
|
||||
if (textSource === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.searchSource(textSource, cause);
|
||||
} finally {
|
||||
textSource.cleanup();
|
||||
}
|
||||
} catch (e) {
|
||||
this.onError(e);
|
||||
}
|
||||
}
|
||||
|
||||
async searchSource(textSource, cause) {
|
||||
let hideResults = textSource === null;
|
||||
let hideResults = false;
|
||||
let searched = false;
|
||||
let success = false;
|
||||
|
||||
try {
|
||||
if (!hideResults && (!this.textSourceLast || !this.textSourceLast.equals(textSource))) {
|
||||
if (!this.textSourceLast || !this.textSourceLast.equals(textSource)) {
|
||||
searched = true;
|
||||
this.pendingLookup = true;
|
||||
const focus = (cause === 'mouse');
|
||||
@ -351,9 +359,6 @@ class Frontend {
|
||||
this.onError(e);
|
||||
}
|
||||
} finally {
|
||||
if (textSource !== null) {
|
||||
textSource.cleanup();
|
||||
}
|
||||
if (hideResults && this.options.scanning.autoHideResults) {
|
||||
this.searchClear(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user