diff options
Diffstat (limited to 'background')
-rw-r--r-- | background/page_actions_server.js | 27 |
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 { |