Changeset 279666 in webkit
- Timestamp:
- Jul 7, 2021 1:59:59 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r279662 r279666 1 2021-07-07 Alex Christensen <achristensen@webkit.org> 2 3 Allow setting empty hosts of URLs with non-special schemes 4 https://bugs.webkit.org/show_bug.cgi?id=227752 5 6 Reviewed by Chris Dumez. 7 8 * web-platform-tests/url/url-setters-a-area.window-expected.txt: 9 * web-platform-tests/url/url-setters.any-expected.txt: 10 * web-platform-tests/url/url-setters.any.worker-expected.txt: 11 1 12 2021-07-07 Alex Christensen <achristensen@webkit.org> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-a-area.window-expected.txt
r279662 r279666 149 149 PASS <a>: Setting <http://example.net>.host = '' The empty host is not valid for special schemes 150 150 PASS <area>: Setting <http://example.net>.host = '' The empty host is not valid for special schemes 151 FAIL <a>: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 152 FAIL <area>: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 151 PASS <a>: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes 152 PASS <area>: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes 153 153 PASS <a>: Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host 154 154 PASS <area>: Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host … … 233 233 PASS <a>: Setting <sc://x/>.hostname = '#' 234 234 PASS <area>: Setting <sc://x/>.hostname = '#' 235 FAIL <a>: Setting <sc://x/>.hostname = '/' assert_equals: expected "sc:///" but got "sc://x/" 236 FAIL <area>: Setting <sc://x/>.hostname = '/' assert_equals: expected "sc:///" but got "sc://x/" 235 PASS <a>: Setting <sc://x/>.hostname = '/' 236 PASS <area>: Setting <sc://x/>.hostname = '/' 237 237 PASS <a>: Setting <sc://x/>.hostname = '?' 238 238 PASS <area>: Setting <sc://x/>.hostname = '?' … … 247 247 PASS <a>: Setting <http://example.net>.hostname = '' The empty host is not valid for special schemes 248 248 PASS <area>: Setting <http://example.net>.hostname = '' The empty host is not valid for special schemes 249 FAIL <a>: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 250 FAIL <area>: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 249 PASS <a>: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes 250 PASS <area>: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes 251 251 PASS <a>: Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host 252 252 PASS <area>: Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host … … 291 291 PASS <a>: Setting <non-spec:/.//p>.hostname = 'h' Drop /. from path 292 292 PASS <area>: Setting <non-spec:/.//p>.hostname = 'h' Drop /. from path 293 FAIL <a>: Setting <non-spec:/.//p>.hostname = '' assert_equals: expected "non-spec:////p" but got "non-spec:/.//p" 294 FAIL <area>: Setting <non-spec:/.//p>.hostname = '' assert_equals: expected "non-spec:////p" but got "non-spec:/.//p" 293 PASS <a>: Setting <non-spec:/.//p>.hostname = '' 294 PASS <area>: Setting <non-spec:/.//p>.hostname = '' 295 295 FAIL <a>: Setting <http://example.com/>.hostname = '///bad.com' Leading / is not stripped assert_equals: expected "http://example.com/" but got "http://bad.com/" 296 296 FAIL <area>: Setting <http://example.com/>.hostname = '///bad.com' Leading / is not stripped assert_equals: expected "http://example.com/" but got "http://bad.com/" -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any-expected.txt
r279662 r279666 75 75 PASS URL: Setting <http://example.net:8080>.host = 'example.com:' Port number is unchanged if not specified 76 76 PASS URL: Setting <http://example.net>.host = '' The empty host is not valid for special schemes 77 FAIL URL: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 77 PASS URL: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes 78 78 PASS URL: Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host 79 79 PASS URL: Setting <http://example.net>.host = '0x7F000001:8080' IPv4 address syntax is normalized … … 117 117 PASS URL: Setting <sc://x/>.hostname = ' ' 118 118 PASS URL: Setting <sc://x/>.hostname = '#' 119 FAIL URL: Setting <sc://x/>.hostname = '/' assert_equals: expected "sc:///" but got "sc://x/" 119 PASS URL: Setting <sc://x/>.hostname = '/' 120 120 PASS URL: Setting <sc://x/>.hostname = '?' 121 121 PASS URL: Setting <sc://x/>.hostname = '@' … … 124 124 PASS URL: Setting <http://example.net:8080>.hostname = 'example.com' 125 125 PASS URL: Setting <http://example.net>.hostname = '' The empty host is not valid for special schemes 126 FAIL URL: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 126 PASS URL: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes 127 127 PASS URL: Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host 128 128 PASS URL: Setting <http://example.net:8080>.hostname = '0x7F000001' IPv4 address syntax is normalized … … 146 146 PASS URL: Setting <sc://test:12/>.hostname = '' 147 147 PASS URL: Setting <non-spec:/.//p>.hostname = 'h' Drop /. from path 148 FAIL URL: Setting <non-spec:/.//p>.hostname = '' assert_equals: expected "non-spec:////p" but got "non-spec:/.//p" 148 PASS URL: Setting <non-spec:/.//p>.hostname = '' 149 149 FAIL URL: Setting <http://example.com/>.hostname = '///bad.com' Leading / is not stripped assert_equals: expected "http://example.com/" but got "http://bad.com/" 150 150 FAIL URL: Setting <sc://example.com/>.hostname = '///bad.com' Leading / is not stripped assert_equals: expected "sc:///" but got "sc://bad.com/" -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any.worker-expected.txt
r279662 r279666 75 75 PASS URL: Setting <http://example.net:8080>.host = 'example.com:' Port number is unchanged if not specified 76 76 PASS URL: Setting <http://example.net>.host = '' The empty host is not valid for special schemes 77 FAIL URL: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 77 PASS URL: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes 78 78 PASS URL: Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host 79 79 PASS URL: Setting <http://example.net>.host = '0x7F000001:8080' IPv4 address syntax is normalized … … 117 117 PASS URL: Setting <sc://x/>.hostname = ' ' 118 118 PASS URL: Setting <sc://x/>.hostname = '#' 119 FAIL URL: Setting <sc://x/>.hostname = '/' assert_equals: expected "sc:///" but got "sc://x/" 119 PASS URL: Setting <sc://x/>.hostname = '/' 120 120 PASS URL: Setting <sc://x/>.hostname = '?' 121 121 PASS URL: Setting <sc://x/>.hostname = '@' … … 124 124 PASS URL: Setting <http://example.net:8080>.hostname = 'example.com' 125 125 PASS URL: Setting <http://example.net>.hostname = '' The empty host is not valid for special schemes 126 FAIL URL: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes assert_equals: expected "view-source+http:///foo" but got "view-source+http://example.net/foo" 126 PASS URL: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes 127 127 PASS URL: Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host 128 128 PASS URL: Setting <http://example.net:8080>.hostname = '0x7F000001' IPv4 address syntax is normalized … … 146 146 PASS URL: Setting <sc://test:12/>.hostname = '' 147 147 PASS URL: Setting <non-spec:/.//p>.hostname = 'h' Drop /. from path 148 FAIL URL: Setting <non-spec:/.//p>.hostname = '' assert_equals: expected "non-spec:////p" but got "non-spec:/.//p" 148 PASS URL: Setting <non-spec:/.//p>.hostname = '' 149 149 FAIL URL: Setting <http://example.com/>.hostname = '///bad.com' Leading / is not stripped assert_equals: expected "http://example.com/" but got "http://bad.com/" 150 150 FAIL URL: Setting <sc://example.com/>.hostname = '///bad.com' Leading / is not stripped assert_equals: expected "sc:///" but got "sc://bad.com/" -
trunk/Source/WebCore/ChangeLog
r279661 r279666 1 2021-07-07 Alex Christensen <achristensen@webkit.org> 2 3 Allow setting empty hosts of URLs with non-special schemes 4 https://bugs.webkit.org/show_bug.cgi?id=227752 5 6 Reviewed by Chris Dumez. 7 8 asdf:/// is fine. 9 http:/// is not fine. 10 11 * html/URLDecomposition.cpp: 12 (WebCore::URLDecomposition::setHost): 13 (WebCore::URLDecomposition::setHostname): 14 (WebCore::URLDecomposition::hash const): 15 1 16 2021-07-07 Ryosuke Niwa <rniwa@webkit.org> 2 17 -
trunk/Source/WebCore/html/URLDecomposition.cpp
r278253 r279666 98 98 { 99 99 auto fullURL = this->fullURL(); 100 if (value.isEmpty() && !fullURL.protocolIs("file") )100 if (value.isEmpty() && !fullURL.protocolIs("file") && fullURL.hasSpecialScheme()) 101 101 return; 102 102 … … 151 151 auto fullURL = this->fullURL(); 152 152 auto host = removeAllLeadingSolidusCharacters(value); 153 if (host.isEmpty() && !fullURL.protocolIs("file") )153 if (host.isEmpty() && !fullURL.protocolIs("file") && fullURL.hasSpecialScheme()) 154 154 return; 155 155 if (fullURL.cannotBeABaseURL() || !fullURL.canSetHostOrPort()) … … 230 230 String URLDecomposition::hash() const 231 231 { 232 // FIXME: Why convert this string to an atom here instead of just a string? Intentionally to save memory? An error? 233 auto fullURL = this->fullURL(); 234 return fullURL.fragmentIdentifier().isEmpty() ? emptyAtom() : fullURL.fragmentIdentifierWithLeadingNumberSign().toAtomString(); 232 auto fullURL = this->fullURL(); 233 return fullURL.fragmentIdentifier().isEmpty() ? emptyString() : fullURL.fragmentIdentifierWithLeadingNumberSign().toString(); 235 234 } 236 235
Note: See TracChangeset
for help on using the changeset viewer.