Skip to content

Commit a09da87

Browse files
committed
rollback exception
1 parent 68e48a9 commit a09da87

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/contentScript.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ var listenText = "";
7070
injectGoogleDocAnnotation(); //check google doc and add annotation env var
7171
loadDestructor(); //remove previous tooltip script
7272
await getSetting(); //load setting
73-
checkExcludeUrl(); //check url is excluded or not in the whitelist
73+
if(checkExcludeUrl()) {
74+
return;
75+
}
7476
await dom_util.waitJquery(); //wait jquery load
7577
detectPDF(); //check current page is pdf
7678
checkVideo(); // check video site for subtitle
@@ -83,12 +85,7 @@ var listenText = "";
8385
startMouseoverDetector(); // start current mouseover text detector
8486
startTextSelectDetector(); // start current text select detector
8587
} catch (error) {
86-
if (error instanceof util.TooltipUrlExcludeError) {
87-
// Do nothing
88-
// console.log(error);
89-
} else {
90-
console.log(error);
91-
}
88+
console.log(error);
9289
}
9390
})();
9491

@@ -819,7 +816,7 @@ function checkExcludeUrl() {
819816
var isExcludeBan = matchUrl(url, setting["websiteExcludeList"]);
820817
var isWhiteListBan = setting["websiteWhiteList"]?.length != 0 && !matchUrl(url, setting["websiteWhiteList"]);
821818
if (isExcludeBan || isWhiteListBan) {
822-
throw new util.TooltipUrlExcludeError();
819+
return true;
823820
}
824821
}
825822

src/util/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,3 @@ export function getAllShadows(el = document.body) {
618618
const result = Array.from(childShadows);
619619
return result.concat(childResults).flat();
620620
}
621-
622-
export class TooltipUrlExcludeError extends Error {
623-
constructor(name = "TooltipUrlExcludeError", message = "URL is excluded or not in the whitelist.", details = {}) {
624-
super(message);
625-
this.name = name;
626-
this.details = details;
627-
}
628-
}

0 commit comments

Comments
 (0)