Comments (5)
I think the bug here is a bit more subtle. It should not be possible to set init["baseURL"] to null because its type is USVString
, not USVString?
. But I guess the spec does that in "initialize" step 2.3.
So we should add a guard to step 2.3 at least.
We may also need an empty string guard. I am less sure about that.
I also think that using map exists to check if values are properly set is maybe not the most robust practice as map exists can be true even if the value associated with the key is
null
orundefined
.
This is not quite right in our case. Because the dictionary member is defined to be of type USVString
, it cannot hold undefined
or null
values. So "map exists" is good enough and no more checks should be necessary.
from urlpattern.
I agree, 11. If init["baseURL"] exists: in process a URLPatternInit should also check if it's a non-empty string.
from urlpattern.
I think the bug here is a bit more subtle. It should not be possible to set init["baseURL"] to null because its type is USVString, not USVString?. But I guess the spec does that in "initialize" step 2.3.
I overlooked the type. Yes, it's USVString
so it can't be null. Thanks.
How about adding an empty string guard to between step 2.2 and 2.3 and throwing a TypeError?
from urlpattern.
You're right @domenic, type already should be insured. However there's other places where null
values are explicitely set URLPatternInit entries.
During initialization process a URLPatternInit is called with all url parts argument to null
! The function allow null to be passed for these arguments but they are only use to fill an URLPatternInit struct.
from urlpattern.
I don't follow the argument for a non-empty string guard. Of course this is going to fail ultimately, but it seems fine for it to do so in "process a URLPatternInit" 11.2 (after we fail to parse the empty string as a URL).
from urlpattern.
Related Issues (20)
- Base URL inheritance gives unintuitive results HOT 21
- Consider creating a RFC for base functionality HOT 2
- Add a "using URLPattern in other APIs" section HOT 9
- Backslash escaping is required for colon before password in string syntax
- WHATWG migration HOT 5
- Attribute to show the regular expression usage. HOT 9
- Hash test matching different from path matching HOT 1
- Consider cleaning up extra markdown documents
- Custom named full-wildcard HOT 2
- Base URL and empty pathname in URLPatternInit
- Incorrect handling of base URL in URLPatternInit processing HOT 10
- Handling of special character in hostname
- More consistent and robust segment wilcard generation
- Incorrect type in group name assignment
- "Hostname pattern is an IPv6 address" called with `null` HOT 1
- Constructor string parser has confusing result for paths containing a colon. HOT 1
- The way to integrate the API without depending on ECMAScript realm. HOT 3
- Accept URL as the match algorithm's input. HOT 4
- Opaque Host and domain encoding HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urlpattern.