From 0f4c885acf88b9a6c57d04cb6bfd05852f0acf67 Mon Sep 17 00:00:00 2001 From: Derek Dohler Date: Fri, 30 Sep 2022 17:06:33 -0400 Subject: [PATCH 1/2] Validate defaultPrefix is a valid URL If it isn't, use undefined instead. An invalid (but non-undefined) URL will always cause loam.initialize() to throw an exception, even if the user attempts to provide a valid URL as a parameter to initialize(). This now validates defaultPrefix before attempting to use it, and uses undefined if the defaultPrefix is not a valid URL. The user in this case will be _required_ to provide a valid absolute URL parameter to initialize(), because there is no default to fall back on. --- CHANGELOG | 3 +++ README.md | 2 +- src/workerCommunication.js | 13 ++++++++++++- test/loam.spec.js | 13 ++----------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b431625..d91493d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +## UPCOMING +- Allow users to specify a valid absolute URL when the default URL is invalid + ## 1.1.1 (2022-09-30) - Document bytes() method - Fix production bundle not including unminified assets. diff --git a/README.md b/README.md index 4d8f9e3..fbc568f 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Although this function is called automatically by other functions, such as `loam This function is safe to call multiple times. #### Parameters -- `pathPrefix` (optional): The path or URL that Loam should use as a prefix when fetching its Web Worker. If left undefined, Loam will make a best guess based on the source path of its own `