aboutsummaryrefslogtreecommitdiff
path: root/bg/ExternalLicenses.js
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-27 12:40:23 +1000
committerYuchen Pei <hi@ypei.me>2022-09-27 12:43:24 +1000
commitc26ad83e2e0c29a6e18a36fcff86554815ea6bea (patch)
treec520a99ceb64c8ac8cc847974419e025d44af6f1 /bg/ExternalLicenses.js
parentad1a6ea51386feccfb1da0bc0fc4f5ace101b71b (diff)
Refactoring response handler to improve readability
Diffstat (limited to 'bg/ExternalLicenses.js')
-rw-r--r--bg/ExternalLicenses.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/bg/ExternalLicenses.js b/bg/ExternalLicenses.js
index 6eda008..6d35863 100644
--- a/bg/ExternalLicenses.js
+++ b/bg/ExternalLicenses.js
@@ -48,7 +48,17 @@ const ExternalLicenses = {
cachedHrefs.delete(tabId);
},
- // Checks external script using web labels
+ /**
+ * Checks external script using web labels
+ *
+ * If the script cannot be found in the web labels table, returns null.
+ *
+ * If the script can be found in the web labels table, and at least
+ * one of its licenses can be found in our free license DB, returns
+ * "free".
+ *
+ * Otherwise returns "nonfree".
+ */
async check(script) {
const { url, tabId, frameId, documentUrl } = script;
const tabCache = cachedHrefs.get(tabId);