aboutsummaryrefslogtreecommitdiff
path: root/background
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-07-21 22:00:20 +0200
committerWojtek Kosior <koszko@koszko.org>2021-07-21 22:00:20 +0200
commitc483ae19e110ef5c1e539883a38fbc79b3dd4e4e (patch)
tree60298e3852ce74233eacc95c77a6e5cdc297418d /background
parent5c68551800e477db41ae6fe3a318b2ff2d7a9cb1 (diff)
downloadbrowser-extension-c483ae19e110ef5c1e539883a38fbc79b3dd4e4e.tar.gz
browser-extension-c483ae19e110ef5c1e539883a38fbc79b3dd4e4e.zip
add ability to query page content from repo and display it in the popup
Diffstat (limited to 'background')
-rw-r--r--background/page_actions_server.js27
1 files changed, 4 insertions, 23 deletions
diff --git a/background/page_actions_server.js b/background/page_actions_server.js
index c6800a0..a7a44c1 100644
--- a/background/page_actions_server.js
+++ b/background/page_actions_server.js
@@ -14,6 +14,7 @@
* IMPORT listen_for_connection
* IMPORT sha256
* IMPORT get_query_best
+ * IMPORT make_ajax_request
* IMPORTS_END
*/
@@ -23,9 +24,10 @@ var handler;
function send_actions(url, port)
{
- let [pattern, settings] = query_best(url);
+ const [pattern, settings] = query_best(url);
+ const repos = storage.get_all(TYPE_PREFIX.REPO);
- port.postMessage(["settings", [pattern, settings]]);
+ port.postMessage(["settings", [pattern, settings, repos]]);
if (settings === undefined)
return;
@@ -85,27 +87,6 @@ async function get_script_text(script_name)
}
}
-function ajax_callback()
-{
- if (this.readyState == 4)
- this.resolve_callback(this);
-}
-
-function initiate_ajax_request(resolve, method, url)
-{
- var xhttp = new XMLHttpRequest();
- xhttp.resolve_callback = resolve;
- xhttp.onreadystatechange = ajax_callback;
- xhttp.open(method, url, true);
- xhttp.send();
-}
-
-function make_ajax_request(method, url)
-{
- return new Promise((resolve, reject) =>
- initiate_ajax_request(resolve, method, url));
-}
-
async function fetch_remote_script(script_data)
{
try {