aboutsummaryrefslogtreecommitdiff
path: root/html/popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/popup.js')
-rw-r--r--html/popup.js36
1 files changed, 29 insertions, 7 deletions
diff --git a/html/popup.js b/html/popup.js
index b4602f3..532feba 100644
--- a/html/popup.js
+++ b/html/popup.js
@@ -79,18 +79,40 @@ function show_page_info(page_info) {
by_id("scripts_blocked").innerText = page_info.allow ? "no" : "yes";
- by_id("injected_payload").innerText = page_info.payload ?
- page_info.payload.identifier : "None";
+ let payload_text = "None";
+
+ if (page_info.payload) {
+ if ("error" in page_info) {
+ if (page_info.error.haketilo_error_type === "missing")
+ payload_text = `None (error: resource with id '${page_info.error.id}' missing from the database)`;
+ else if (page_info.error.haketilo_error_type === "circular")
+ payload_text = `None (error: circular dependency of resource with id '${page_info.error.id}' on itself)`;
+ else if (page_info.error.haketilo_error_type === "db")
+ payload_text = `None (error: failure reading Haketilo internal database)`;
+ else if (page_info.error.haketilo_error_type === "other")
+ payload_text = `None (error: unknown failure occured)`;
+ } else {
+ payload_text = page_info.payload.identifier;
+ }
+ }
+
+ by_id("injected_payload").innerText = payload_text;
const scripts_fate = page_info.allow ? "allowed" : "blocked";
+ let mapping_text;
+
if (page_info.mapping === "~allow")
- var mapping = `None (scripts ${scripts_fate} by a rule)`;
+ mapping_text = `None (scripts ${scripts_fate} by a rule)`;
+ else if ("error" in page_info
+ && page_info.error.haketilo_error_type ==="deciding_policy")
+ mapping_text = `None (error occured when determining policy)`;
else if (page_info.mapping)
- var mapping = page_info.mapping;
- else if (page_info.error)
- var mapping = `None (error occured when determining policy)`;
- by_id("mapping_used").innerText = mapping;
+ mapping_text = page_info.mapping;
+ else
+ mapping_text = `None (scripts ${scripts_fate} by default policy)`;
+
+ by_id("mapping_used").innerText = mapping_text;
}
}