Do not unconditionally add "//" to absolute URLs and handle authority-less URLs #7263
Conversation
Note: this does indeed represent a fix for gh-6574, but only once a version of Cordova sporting apache/cordova-wp8#30 is released. Closes gh-6597 Fixes gh-6574 Fixes gh-6599
// Always use our own URL parser, even though location potentially provides all the | ||
// fields we may need later on. This way, URL parsing is consistent, and we only | ||
// grab location.href from the browser. | ||
var uri = this.parseUrl( url || location.href ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please provide examples where the built in parser is inconsistent or incorrect? Those should be in the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, TBH, I think I was thinking of #6810 at the time, but we can't reproduce that one. If the location.host is empty on Android 4.4, then we're better of never relying on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... so, I'm not sure if that counts as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I've found another reason to do our own parsing. location does not provide the doubleSlash property. Our parser does provide this property, and now that we're not unconditionally appending the double slash, we need it below.
👍 |
Navigation: Test authority-less protocols with path.getLocation()
Navigation: Do not assume "//" is always part of an absolute URL
Navigation: Expect a trailing slash when testing path.getLocation()
Note: this does indeed represent a fix for gh-6574, but only once a version of
Cordova sporting apache/cordova-wp8#30 is released.
Closes gh-6597
Fixes gh-6574
Fixes gh-6599