mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-05-01 05:17:01 +02:00
Add doc that received url parameter must be a valid URL
The `new URL(url)` statement will throw an error if the supplied string is not a valid URL. Adding a note to the function to clarify that as requested by @Rob--W.
This commit is contained in:
@@ -27,6 +27,7 @@ function toggleCSS(tab) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Returns true only if the URL's protocol is in APPLICABLE_PROTOCOLS.
|
Returns true only if the URL's protocol is in APPLICABLE_PROTOCOLS.
|
||||||
|
Argument url must be a valid URL string.
|
||||||
*/
|
*/
|
||||||
function protocolIsApplicable(url) {
|
function protocolIsApplicable(url) {
|
||||||
const protocol = (new URL(url)).protocol;
|
const protocol = (new URL(url)).protocol;
|
||||||
|
|||||||
Reference in New Issue
Block a user