summaryrefslogtreecommitdiff
path: root/html/payload_create.js
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-01-13 16:47:07 +0100
committerWojtek Kosior <koszko@koszko.org>2022-01-13 16:47:07 +0100
commit299864ee0901df8db2314cc7c07d6c481927c8aa (patch)
treedcd1056c39fa6e90214cb2296e70f1060ad9583a /html/payload_create.js
parent5acb2499c1df14d6275b1ad9e139f02d1280cb9c (diff)
downloadbrowser-extension-299864ee0901df8db2314cc7c07d6c481927c8aa.tar.gz
browser-extension-299864ee0901df8db2314cc7c07d6c481927c8aa.zip
facilitate managing script blocking with a list of edtable entries
Diffstat (limited to 'html/payload_create.js')
-rw-r--r--html/payload_create.js17
1 files changed, 4 insertions, 13 deletions
diff --git a/html/payload_create.js b/html/payload_create.js
index c1563ae..503a461 100644
--- a/html/payload_create.js
+++ b/html/payload_create.js
@@ -46,7 +46,8 @@
#FROM html/DOM_helpers.js IMPORT clone_template
#FROM common/sha256.js IMPORT sha256
-#FROM common/patterns.js IMPORT deconstruct_url, patterns_doc_url
+#FROM common/patterns.js IMPORT validate_normalize_url_pattern, \
+ patterns_doc_url
/* https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid */
/* This is a helper function used by uuidv4(). */
@@ -81,18 +82,8 @@ function collect_form_data(form_ctx)
const payloads = {};
- for (const pattern of url_patterns) {
- try {
- deconstruct_url(pattern);
- } catch(e) {
- const patterns_doc_link = document.createElement("a");
- patterns_doc_link.href = patterns_doc_url;
- patterns_doc_link.innerText = "here";
- const msg = document.createElement("span");
- msg.prepend(`'${pattern}' is not a valid URL pattern. See `,
- patterns_doc_link, " for more details.");
- throw msg;
- }
+ for (let pattern of url_patterns) {
+ pattern = validate_normalize_url_pattern(pattern);
if (pattern in payloads)
throw `Pattern '${pattern}' specified multiple times!`;