aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-03-04 16:57:07 +0100
committerWojtek Kosior <koszko@koszko.org>2022-03-04 17:25:17 +0100
commit4970930c2f866133c38fa73800f1a963f0856692 (patch)
tree5cb1f7aaa317b02dbc266a62e07c21b05340b106
parent7fdb3e8474488de2b18da7e9b63719bb05961819 (diff)
downloadbrowser-extension-4970930c2f866133c38fa73800f1a963f0856692.tar.gz
browser-extension-4970930c2f866133c38fa73800f1a963f0856692.zip
prepend all generated console messages with 'Haketilo:'
-rw-r--r--background/broadcast_broker.js2
-rw-r--r--background/indexeddb_files_server.js4
-rw-r--r--background/stream_filter.js4
-rw-r--r--background/webrequest.js6
-rw-r--r--common/indexeddb.js2
-rw-r--r--common/patterns.js2
-rw-r--r--common/policy.js2
-rw-r--r--content/content.js6
-rw-r--r--content/policy_enforcing.js6
-rw-r--r--html/DOM_helpers.js4
-rw-r--r--html/install.js4
-rw-r--r--html/item_list.js2
-rw-r--r--html/payload_create.js2
-rw-r--r--html/popup.js4
-rw-r--r--html/repo_query.js2
-rw-r--r--html/settings.js2
16 files changed, 27 insertions, 27 deletions
diff --git a/background/broadcast_broker.js b/background/broadcast_broker.js
index d8a0e28..5e6384e 100644
--- a/background/broadcast_broker.js
+++ b/background/broadcast_broker.js
@@ -154,7 +154,7 @@ function broadcast(channel_name, value)
try {
listener_ctx.port.postMessage([channel_name, value]);
} catch (e) {
- console.error(e);
+ console.error("Haketilo:", e);
remove_broadcast_listener(listener_ctx);
}
}
diff --git a/background/indexeddb_files_server.js b/background/indexeddb_files_server.js
index c548b74..d3ea8ab 100644
--- a/background/indexeddb_files_server.js
+++ b/background/indexeddb_files_server.js
@@ -124,12 +124,12 @@ async function send_resource_files(root_resource_id, send_cb) {
} catch(e) {
if (typeof e === "object" && "haketilo_error_type" in e) {
if (e.haketilo_error_type === "db") {
- console.error(e.e);
+ console.error("Haketilo:", e.e);
delete e.e;
}
var to_send = {error: e};
} else {
- console.error(e);
+ console.error("Haketilo:", e);
var to_send = {error: {haketilo_error_type: "other"}};
}
}
diff --git a/background/stream_filter.js b/background/stream_filter.js
index 0de7f49..921523a 100644
--- a/background/stream_filter.js
+++ b/background/stream_filter.js
@@ -106,8 +106,8 @@ function create_decoder(properties, data)
{
let charset = charset_from_BOM(data) || properties.detected_charset;
if (!charset && data.indexOf(0) !== -1) {
- console.debug("Warning: zeroes in bytestream, probable cached encoding mismatch. Trying to decode it as UTF-16.",
- properties);
+ console.warn("Haketilo: zeroes in bytestream, probable cached encoding mismatch. Trying to decode it as UTF-16.",
+ properties);
return new TextDecoder("utf-16be");
}
diff --git a/background/webrequest.js b/background/webrequest.js
index bceba26..f0c5b1b 100644
--- a/background/webrequest.js
+++ b/background/webrequest.js
@@ -117,7 +117,7 @@ function on_before_request(details)
return;
#IF DEBUG
- console.debug(`Settings queried using XHR for '${details.url}'.`);
+ console.debug(`Haketilo: Settings queried using XHR for '${details.url}'.`);
#ENDIF
/*
@@ -129,7 +129,7 @@ function on_before_request(details)
const queried_url = decodeURIComponent(match[1]);
if (details.initiator && !queried_url.startsWith(details.initiator)) {
- console.warn(`Blocked suspicious query of '${url}' by '${details.initiator}'. This might be the result of page fingerprinting the browser.`);
+ console.warn(`Haketilo: Blocked suspicious query of '${url}' by '${details.initiator}'. This might be the result of page fingerprinting the browser.`);
return {cancel: true};
}
@@ -140,7 +140,7 @@ function on_before_request(details)
}
}
- console.warn(`Bad request! Expected ${browser.runtime.getURL("dummy")}?url=<valid_urlencoded_url>. Got ${details.url}. This might be the result of page fingerprinting the browser.`);
+ console.warn(`Haketilo: Bad request! Expected ${browser.runtime.getURL("dummy")}?url=<valid_urlencoded_url>. Got ${details.url}. This might be the result of page fingerprinting the browser.`);
return {cancel: true};
}
diff --git a/common/indexeddb.js b/common/indexeddb.js
index 1c6244b..bd87399 100644
--- a/common/indexeddb.js
+++ b/common/indexeddb.js
@@ -215,7 +215,7 @@ async function finalize_transaction(context)
{
for (const uses of Object.values(context.file_uses)) {
if (uses.uses < 0)
- console.error("internal error: uses < 0 for file " + uses.sha256);
+ console.error("Haketilo: internal error: uses < 0 for file " + uses.sha256);
const is_new = uses.new;
const initial_uses = uses.initial;
diff --git a/common/patterns.js b/common/patterns.js
index 6f5aa40..9e9d387 100644
--- a/common/patterns.js
+++ b/common/patterns.js
@@ -174,7 +174,7 @@ function* each_url_pattern(url)
const deco = deconstruct_url(url);
if (deco === undefined) {
- console.error("bad url format", url);
+ console.error("Haketilo: bad url format", url);
return false;
}
diff --git a/common/policy.js b/common/policy.js
index 546aeed..47b2d1d 100644
--- a/common/policy.js
+++ b/common/policy.js
@@ -64,7 +64,7 @@ function decide_policy(patterns_tree, url, default_allow, secret)
try {
var payloads = pqt.search(patterns_tree, url).next().value;
} catch (e) {
- console.error(e);
+ console.error("Haketilo:", e);
policy.allow = false;
policy.error = {haketilo_error_type: "deciding_policy"};
}
diff --git a/content/content.js b/content/content.js
index 7cbb523..ef2ee39 100644
--- a/content/content.js
+++ b/content/content.js
@@ -59,7 +59,7 @@ function synchronously_get_policy(url)
xhttp.open("GET", request_url, false);
xhttp.send();
} catch(e) {
- console.error("Failure to synchronously fetch policy for url.", e);
+ console.error("Haketilo: Failure to synchronously fetch policy for url.", e);
return fallback_policy();
}
@@ -67,7 +67,7 @@ function synchronously_get_policy(url)
const policy = /^[^?]*\?settings=(.*)$/.exec(xhttp.responseURL)[1];
return JSON.parse(decodeURIComponent(policy));
} catch(e) {
- console.error("Failure to process synchronously fetched policy for url.", e);
+ console.error("Haketilo: Failure to process synchronously fetched policy for url.", e);
return fallback_policy()
}
}
@@ -108,7 +108,7 @@ async function main() {
globalThis.haketilo_default_allow,
globalThis.haketilo_secret);
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
var policy = fallback_policy();
}
#ELSE
diff --git a/content/policy_enforcing.js b/content/policy_enforcing.js
index 63c5119..0b74de9 100644
--- a/content/policy_enforcing.js
+++ b/content/policy_enforcing.js
@@ -224,7 +224,7 @@ function sanitize_element_onevent(element) {
* blocked and unable to redefine properties, anyway.
*/
if (Object.getOwnPropertyDescriptor(element.wrappedJSObject, attr)) {
- console.error("Redefined property on a DOM object! The page might have bypassed our script blocking measures!");
+ console.error("Haketilo: Redefined property on a DOM object! The page might have bypassed our script blocking measures!");
continue;
}
element.wrappedJSObject[attr] = null;
@@ -348,7 +348,7 @@ async function _disable_service_workers() {
if (registrations.length === 0)
return;
- console.warn("Service Workers detected on this page! Unregistering and reloading.");
+ console.warn("Haketilo: Service Workers detected on this page! Unregistering and reloading.");
try {
await Promise.all(registrations.map(r => r.unregister()));
@@ -369,7 +369,7 @@ async function disable_service_workers() {
try {
await _disable_service_workers()
} catch (e) {
- console.debug("Exception thrown during an attempt to detect and disable service workers.", e);
+ console.warn("Haketilo: Exception thrown during an attempt to detect and disable service workers.", e);
}
}
diff --git a/html/DOM_helpers.js b/html/DOM_helpers.js
index 9e64956..9097af0 100644
--- a/html/DOM_helpers.js
+++ b/html/DOM_helpers.js
@@ -110,7 +110,7 @@ function Showable(on_show_cb, on_hide_cb) {
try {
on_show_cb();
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
}
return true;
@@ -125,7 +125,7 @@ function Showable(on_show_cb, on_hide_cb) {
try {
on_hide_cb();
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
}
return true;
diff --git a/html/install.js b/html/install.js
index c502719..fddee5d 100644
--- a/html/install.js
+++ b/html/install.js
@@ -105,7 +105,7 @@ async function init_work() {
work.err = function (error, user_message) {
if (error)
- console.error(error);
+ console.error("Haketilo:", error);
work.is_ok = false;
work.reject_cb(user_message);
}
@@ -392,7 +392,7 @@ function InstallView(tab_id, on_view_show, on_view_hide) {
try {
await haketilodb.save_items(data);
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
const msg = "Error writing to Haketilo's internal database :(";
var dialog_prom = dialog.error(this.dialog_ctx, msg);
}
diff --git a/html/item_list.js b/html/item_list.js
index bc1acb9..ba6b352 100644
--- a/html/item_list.js
+++ b/html/item_list.js
@@ -145,7 +145,7 @@ async function remove_clicked(list_ctx)
try {
await list_ctx.remove_cb(identifier);
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
dialog.error(list_ctx.dialog_ctx, `Couldn't remove '${identifier}' :(`)
}
}
diff --git a/html/payload_create.js b/html/payload_create.js
index ebd9236..28ddc6b 100644
--- a/html/payload_create.js
+++ b/html/payload_create.js
@@ -199,7 +199,7 @@ async function create_clicked(form_ctx)
dialog.info(form_ctx.dialog_ctx, "Successfully saved payload!");
clear_form(form_ctx);
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
dialog.error(form_ctx.dialog_ctx, "Failed to save payload :(");
}
diff --git a/html/popup.js b/html/popup.js
index ddc0f51..5a5db6c 100644
--- a/html/popup.js
+++ b/html/popup.js
@@ -59,7 +59,7 @@ async function get_current_tab() {
try {
return (await promise)[0];
} catch(e) {
- console.log(e);
+ console.log("Haketilo:", e);
}
}
@@ -157,7 +157,7 @@ async function main() {
else
var page_info = await get_page_info(tab_id);
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
}
if (page_info) {
diff --git a/html/repo_query.js b/html/repo_query.js
index 61f4b10..7cfd6fe 100644
--- a/html/repo_query.js
+++ b/html/repo_query.js
@@ -96,7 +96,7 @@ function RepoEntry(query_view, repo_url) {
const schema = haketilo_schemas[$id];
const result = haketilo_validator.validate(response.json, schema);
if (result.errors.length > 0) {
- console.error(result.errors);
+ console.error("Haketilo:", result.errors);
const reg = new RegExp(schema.properties.$schema.pattern);
if (response.json.$schema && !reg.test(response.json.$schema))
diff --git a/html/settings.js b/html/settings.js
index 686cc11..e258fcb 100644
--- a/html/settings.js
+++ b/html/settings.js
@@ -150,7 +150,7 @@ async function init_settings_page() {
try {
await haketilodb.get();
} catch(e) {
- console.error(e);
+ console.error("Haketilo:", e);
show_indexeddb_error();
return;
}