aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <wk@koszkonutek-tmp.pl.eu.org>2021-05-12 17:41:08 +0200
committerWojtek Kosior <wk@koszkonutek-tmp.pl.eu.org>2021-05-12 17:41:08 +0200
commitf6a7f24e61a78f197250875ac9833f497a455d20 (patch)
tree9549ac201aeb8f8ed1cfef6270bae9c459476577
parent55fb3e4bd833f042a82657cc75e7e4c657402f9e (diff)
downloadbrowser-extension-f6a7f24e61a78f197250875ac9833f497a455d20.tar.gz
browser-extension-f6a7f24e61a78f197250875ac9833f497a455d20.zip
rename "bundles" to "bags"
-rw-r--r--TODOS.org2
-rw-r--r--background/main.js4
-rw-r--r--background/page_actions_server.js24
-rw-r--r--background/reverse_use_info.js6
-rw-r--r--background/storage.js6
-rw-r--r--background/storage_server.js2
-rw-r--r--common/storage_client.js4
-rw-r--r--common/stored_types.js6
-rw-r--r--html/options.html32
-rw-r--r--html/options_main.js16
10 files changed, 51 insertions, 51 deletions
diff --git a/TODOS.org b/TODOS.org
index 48e3717..0abef25 100644
--- a/TODOS.org
+++ b/TODOS.org
@@ -20,7 +20,6 @@ TODO:
- find some way not to require each chrome user to modify manifest.json
- rename the extension to something good
- port to gecko-based browsers -- CRUCIAL
-- rename "bundles" to "bags" to avoid confusion with Web Bundles
- make it possible to modify CSP to suit our custom scripts' needs
- find a way to additionally block all other scripts using CSP
as an additional safety measure
@@ -40,6 +39,7 @@ TODO:
to manage imports/exports
DONE:
+- rename "bundles" to "bags" to avoid confusion with Web Bundles -- DONE 2021-05-12
- use non-predictable value in place of "myext-allow", utilizing hashes -- DONE 2021-05-12
- stop using modules (not available on all browsers) -- DONE 2021-05-12
- clean up the remnants of LibreJS -- DONE 2021-05-12
diff --git a/background/main.js b/background/main.js
index f4b01f8..6b636c4 100644
--- a/background/main.js
+++ b/background/main.js
@@ -116,10 +116,10 @@
text: "console.log(\"hello, every1!\");\n"
};
await storage.set(TYPE_PREFIX.SCRIPT, "hello", hello_script);
- await storage.set(TYPE_PREFIX.BUNDLE, "hello",
+ await storage.set(TYPE_PREFIX.BAG, "hello",
[[TYPE_PREFIX.SCRIPT, "hello"]]);
await storage.set(TYPE_PREFIX.PAGE, "https://my.fsf.org/", {
- components: [[TYPE_PREFIX.BUNDLE, "hello"]],
+ components: [[TYPE_PREFIX.BAG, "hello"]],
allow: true
});
diff --git a/background/page_actions_server.js b/background/page_actions_server.js
index fbb672e..2a0b858 100644
--- a/background/page_actions_server.js
+++ b/background/page_actions_server.js
@@ -29,31 +29,31 @@
return;
let components = settings.components;
- let processed_bundles = new Set();
+ let processed_bags = new Set();
- send_scripts_rec(components, port, processed_bundles);
+ send_scripts_rec(components, port, processed_bags);
}
// TODO: parallelize script fetching
- async function send_scripts_rec(components, port, processed_bundles)
+ async function send_scripts_rec(components, port, processed_bags)
{
for (let [prefix, name] of components) {
- if (prefix === TYPE_PREFIX.BUNDLE) {
- if (processed_bundles.has(name)) {
- console.log(`preventing recursive inclusion of bundle ${name}`);
+ if (prefix === TYPE_PREFIX.BAG) {
+ if (processed_bags.has(name)) {
+ console.log(`preventing recursive inclusion of bag ${name}`);
continue;
}
- var bundle = storage.get(TYPE_PREFIX.BUNDLE, name);
+ var bag = storage.get(TYPE_PREFIX.BAG, name);
- if (bundle === undefined) {
- console.log(`no bundle in storage for key ${name}`);
+ if (bag === undefined) {
+ console.log(`no bag in storage for key ${name}`);
continue;
}
- processed_bundles.add(name);
- await send_scripts_rec(bundle, port, processed_bundles);
- processed_bundles.delete(name);
+ processed_bags.add(name);
+ await send_scripts_rec(bag, port, processed_bags);
+ processed_bags.delete(name);
} else {
let script_text = await get_script_text(name);
if (script_text === undefined)
diff --git a/background/reverse_use_info.js b/background/reverse_use_info.js
index 3399285..688cd64 100644
--- a/background/reverse_use_info.js
+++ b/background/reverse_use_info.js
@@ -1,5 +1,5 @@
/**
-* Myext scripts and bundles usage index
+* Myext scripts and bags usage index
*
* Copyright (C) 2021 Wojtek Kosior
*
@@ -11,7 +11,7 @@
"use strict";
/*
- * We want to count referenes to scripts and bundles in order to know,
+ * We want to count referenes to scripts and bags in order to know,
* for example, whether one can be safely deleted.
*/
@@ -83,7 +83,7 @@
{
storage = await get_storage();
- prefixes = [TYPE_PREFIX.PAGE, TYPE_PREFIX.BUNDLE];
+ prefixes = [TYPE_PREFIX.PAGE, TYPE_PREFIX.BAG];
for (let prefix of prefixes)
build_reverse_uses_info(prefix);
diff --git a/background/storage.js b/background/storage.js
index ea390ef..5578109 100644
--- a/background/storage.js
+++ b/background/storage.js
@@ -104,7 +104,7 @@
}
var pages;
- var bundles;
+ var bags;
var scripts;
var list_by_prefix = {};
@@ -310,8 +310,8 @@
*/
/*
- * For bundles, item name is chosen by user, data is an array of 2-element
- * arrays with type prefix and script/bundle names.
+ * For bags, item name is chosen by user, data is an array of 2-element
+ * arrays with type prefix and script/bag names.
*/
/*
diff --git a/background/storage_server.js b/background/storage_server.js
index 05f616b..a4b292c 100644
--- a/background/storage_server.js
+++ b/background/storage_server.js
@@ -41,7 +41,7 @@
port.postMessage({
[TYPE_PREFIX.SCRIPT] : storage.get_all(TYPE_PREFIX.SCRIPT),
- [TYPE_PREFIX.BUNDLE] : storage.get_all(TYPE_PREFIX.BUNDLE),
+ [TYPE_PREFIX.BAG] : storage.get_all(TYPE_PREFIX.BAG),
[TYPE_PREFIX.PAGE] : storage.get_all(TYPE_PREFIX.PAGE)
});
diff --git a/common/storage_client.js b/common/storage_client.js
index 39ece44..f1ae272 100644
--- a/common/storage_client.js
+++ b/common/storage_client.js
@@ -55,12 +55,12 @@
}
var scripts = list("scripts", TYPE_PREFIX.SCRIPT);
- var bundles = list("bundles", TYPE_PREFIX.BUNDLE);
+ var bags = list("bags", TYPE_PREFIX.BAG);
var pages = list("pages", TYPE_PREFIX.PAGE);
const list_by_prefix = {
[TYPE_PREFIX.SCRIPT] : scripts,
- [TYPE_PREFIX.BUNDLE] : bundles,
+ [TYPE_PREFIX.BAG] : bags,
[TYPE_PREFIX.PAGE] : pages
};
diff --git a/common/stored_types.js b/common/stored_types.js
index de0ec71..31254a9 100644
--- a/common/stored_types.js
+++ b/common/stored_types.js
@@ -21,20 +21,20 @@
(() => {
const TYPE_PREFIX = {
PAGE : "p",
- BUNDLE : "b",
+ BAG : "b",
SCRIPT : "s",
VAR : "_"
};
const TYPE_NAME = {
[TYPE_PREFIX.PAGE] : "page",
- [TYPE_PREFIX.BUNDLE] : "bundle",
+ [TYPE_PREFIX.BAG] : "bag",
[TYPE_PREFIX.SCRIPT] : "script"
}
const list_prefixes = [
TYPE_PREFIX.PAGE,
- TYPE_PREFIX.BUNDLE,
+ TYPE_PREFIX.BAG,
TYPE_PREFIX.SCRIPT
];
diff --git a/html/options.html b/html/options.html
index 0bce6fc..cb39090 100644
--- a/html/options.html
+++ b/html/options.html
@@ -30,13 +30,13 @@
/* tabbed view */
#show_pages:not(:checked) ~ #pages,
- #show_bundles:not(:checked) ~ #bundles,
+ #show_bags:not(:checked) ~ #bags,
#show_scripts:not(:checked) ~ #scripts {
display: none;
}
#show_pages:checked ~ #pages_lbl,
- #show_bundles:checked ~ #bundles_lbl,
+ #show_bags:checked ~ #bags_lbl,
#show_scripts:checked ~ #scripts_lbl {
border-left: 2px solid green;
border-right: 2px solid green;
@@ -89,12 +89,12 @@
</div>
<input type="radio" name="tabs" id="show_pages" checked></input>
- <input type="radio" name="tabs" id="show_bundles"></input>
+ <input type="radio" name="tabs" id="show_bags"></input>
<input type="radio" name="tabs" id="show_scripts"></input>
<label for="show_pages" id="pages_lbl"
class="tab_head"> Pages </label>
- <label for="show_bundles" id="bundles_lbl"
- class="tab_head"> Bundles </label>
+ <label for="show_bags" id="bags_lbl"
+ class="tab_head"> Bags </label>
<label for="show_scripts" id="scripts_lbl"
class="tab_head"> Scripts </label>
@@ -119,23 +119,23 @@
<button id="add_page_but" type="button"> Add page </button>
</div>
- <div id="bundles">
- <ul id="bundles_ul">
- <li id="work_bundle_li" class="hide">
- <label for="bundle_name_field"> Name: </label>
- <input id="bundle_name_field"></input>
- <ul id="bundle_components_ul">
- <li id="empty_bundle_component_li" class="hide"></li>
+ <div id="bags">
+ <ul id="bags_ul">
+ <li id="work_bag_li" class="hide">
+ <label for="bag_name_field"> Name: </label>
+ <input id="bag_name_field"></input>
+ <ul id="bag_components_ul">
+ <li id="empty_bag_component_li" class="hide"></li>
</ul>
- <button id="bundle_select_components_but">
+ <button id="bag_select_components_but">
Add scripts
</button>
<br/>
- <button id="bundle_save_but"> Save </button>
- <button id="bundle_discard_but"> Cancel </button>
+ <button id="bag_save_but"> Save </button>
+ <button id="bag_discard_but"> Cancel </button>
</li>
</ul>
- <button id="add_bundle_but" type="button"> Add bundle </button>
+ <button id="add_bag_but" type="button"> Add bag </button>
</div>
<div id="scripts">
diff --git a/html/options_main.js b/html/options_main.js
index ca591d5..104f771 100644
--- a/html/options_main.js
+++ b/html/options_main.js
@@ -92,7 +92,7 @@
/*
* Used to construct and update components list of edited
- * bundle as well as edited page.
+ * bag as well as edited page.
*/
function add_components(ul, components)
{
@@ -114,7 +114,7 @@
components_ul.appendChild(ul.work_empty_component_li);
}
- /* Used to reset edited bundle as well as edited page. */
+ /* Used to reset edited bag as well as edited page. */
function generic_reset_work_li(ul, item, components)
{
if (item === undefined) {
@@ -138,7 +138,7 @@
generic_reset_work_li(ul, item, settings?.components);
}
- /* Used to get edited bundle as well as edited page data for saving. */
+ /* Used to get edited bag as well as edited page data for saving. */
function generic_work_li_data(ul)
{
let components_ul = ul.work_name_input.nextElementSibling;
@@ -305,11 +305,11 @@
state : UL_STATE.IDLE,
edited_item : undefined,
},
- [TYPE_PREFIX.BUNDLE] : {
- ul : by_id("bundles_ul"),
- work_li : by_id("work_bundle_li"),
- work_name_input : by_id("bundle_name_field"),
- work_empty_component_li : by_id("empty_bundle_component_li"),
+ [TYPE_PREFIX.BAG] : {
+ ul : by_id("bags_ul"),
+ work_li : by_id("work_bag_li"),
+ work_name_input : by_id("bag_name_field"),
+ work_empty_component_li : by_id("empty_bag_component_li"),
reset_work_li : generic_reset_work_li,
get_work_li_data : generic_work_li_data,
state : UL_STATE.IDLE,