Changeset 84762 in webkit
- Timestamp:
- Apr 24, 2011 3:53:59 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r84761 r84762 1 2011-04-24 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by George Staikos. 4 5 Handling of URLs like http:/example.com/ is incorrect 6 https://bugs.webkit.org/show_bug.cgi?id=59300 7 <rdar://problem/9231956> 8 9 Added some new test cases. Also updated results for the 10 change. The changes are progressions. 11 12 * fast/url/relative-expected.txt: 13 * fast/url/script-tests/segments.js: 14 * fast/url/script-tests/standard-url.js: 15 * fast/url/segments-expected.txt: 16 * fast/url/segments-from-data-url-expected.txt: 17 * fast/url/standard-url-expected.txt: 18 1 19 2011-04-24 Adam Barth <abarth@webkit.org> 2 20 -
trunk/LayoutTests/fast/url/relative-expected.txt
r78395 r84762 14 14 PASS canonicalize('http:path') is 'http://host/path' 15 15 PASS canonicalize('http:path') is 'http://host/a/path' 16 FAIL canonicalize('http:/path') should be http://host/path. Was http:/ path.16 FAIL canonicalize('http:/path') should be http://host/path. Was http://path/. 17 17 FAIL canonicalize('HTTP:/path') should be http://host/path. Was http:/path. 18 FAIL canonicalize('https:host2') should be https://host2/. Was https:host2. 18 PASS canonicalize('https:host2') is 'https://host2/' 19 19 PASS canonicalize('htto:/host2') is 'htto:/host2' 20 20 PASS canonicalize('/b/c/d') is 'http://host/b/c/d' … … 43 43 PASS canonicalize('data:/base') is 'data:/base' 44 44 PASS canonicalize('http://host/') is 'http://host/' 45 FAIL canonicalize('http:host') should be http://host/. Was http:host. 45 PASS canonicalize('http:host') is 'http://host/' 46 46 PASS canonicalize('./asd:fgh') is 'http://foo/asd:fgh' 47 47 PASS canonicalize(':foo') is 'http://foo/:foo' -
trunk/LayoutTests/fast/url/script-tests/segments.js
r84756 r84762 74 74 ["madeupscheme:/example.com/", ["madeupscheme:","","0","/example.com/","",""]], 75 75 ["file:/example.com/", ["file:","","0","/example.com/","",""]], 76 ["f ops:/example.com/", ["fops:","","0","/example.com/","",""]],76 ["ftps:/example.com/", ["ftps:","","0","/example.com/","",""]], 77 77 ["gopher:/example.com/", ["gopher:","example.com","0","/","",""]], 78 78 ["ws:/example.com/", ["ws:","example.com","0","/","",""]], … … 81 81 ["javascript:/example.com/", ["javascript:","","0","/example.com/","",""]], 82 82 ["mailto:/example.com/", ["mailto:","","0","/example.com/","",""]], 83 83 ["http:example.com/", ["http:","example.org","0","/foo/example.com/","",""]], 84 ["ftp:example.com/", ["ftp:","example.com","0","/","",""]], 85 ["https:example.com/", ["https:","example.com","0","/","",""]], 86 ["madeupscheme:example.com/", ["madeupscheme:","","0","example.com/","",""]], 87 ["file:example.com/", ["file:","","0","/example.com/","",""]], 88 ["ftps:example.com/", ["ftps:","","0","example.com/","",""]], 89 ["gopher:example.com/", ["gopher:","example.com","0","/","",""]], 90 ["ws:example.com/", ["ws:","example.com","0","/","",""]], 91 ["wss:example.com/", ["wss:","example.com","0","/","",""]], 92 ["data:example.com/", ["data:","","0","example.com/","",""]], 93 ["javascript:example.com/", ["javascript:","","0","example.com/","",""]], 94 ["mailto:example.com/", ["mailto:","","0","example.com/","",""]], 84 95 ]; 85 96 -
trunk/LayoutTests/fast/url/script-tests/standard-url.js
r84756 r84762 41 41 ["madeupscheme:/example.com/", "madeupscheme:/example.com/"], 42 42 ["file:/example.com/", "file://localhost/example.com/"], 43 ["f ops:/example.com/", "fops:/example.com/"],43 ["ftps:/example.com/", "ftps:/example.com/"], 44 44 ["gopher:/example.com/", "gopher://example.com/"], 45 45 ["ws:/example.com/", "ws://example.com/"], … … 48 48 ["javascript:/example.com/", "javascript:/example.com/"], 49 49 ["mailto:/example.com/", "mailto:/example.com/"], 50 ["http:example.com/", "http://example.com/"], 51 ["ftp:example.com/", "ftp://example.com/"], 52 ["https:example.com/", "https://example.com/"], 53 ["madeupscheme:example.com/", "madeupscheme:example.com/"], 54 ["ftps:example.com/", "ftps:example.com/"], 55 ["gopher:example.com/", "gopher://example.com/"], 56 ["ws:example.com/", "ws://example.com/"], 57 ["wss:example.com/", "wss://example.com/"], 58 ["data:example.com/", "data:example.com/"], 59 ["javascript:example.com/", "javascript:example.com/"], 60 ["mailto:example.com/", "mailto:example.com/"], 50 61 ]; 51 62 -
trunk/LayoutTests/fast/url/segments-expected.txt
r84756 r84762 70 70 PASS segments('http://[2001::1]:80') is '["http:","[2001::1]","0","/","",""]' 71 71 PASS segments('http://[[::]]') is '[":","","0","","",""]' 72 FAIL segments('http:/example.com/') should be ["http:","example.org","0","/example.com/","",""]. Was ["http:"," ","0","/example.com/","",""].73 FAIL segments('ftp:/example.com/') should be ["ftp:","example.com","0","/","",""]. Was ["ftp:","","0","/example.com/","",""]. 74 FAIL segments('https:/example.com/') should be ["https:","example.com","0","/","",""]. Was ["https:","","0","/example.com/","",""]. 72 FAIL segments('http:/example.com/') should be ["http:","example.org","0","/example.com/","",""]. Was ["http:","example.com","0","/","",""]. 73 PASS segments('ftp:/example.com/') is '["ftp:","example.com","0","/","",""]' 74 PASS segments('https:/example.com/') is '["https:","example.com","0","/","",""]' 75 75 PASS segments('madeupscheme:/example.com/') is '["madeupscheme:","","0","/example.com/","",""]' 76 76 PASS segments('file:/example.com/') is '["file:","","0","/example.com/","",""]' 77 PASS segments('f ops:/example.com/') is '["fops:","","0","/example.com/","",""]'78 FAIL segments('gopher:/example.com/') should be ["gopher:","example.com","0","/","",""]. Was ["gopher:","","0","/example.com/","",""]. 79 FAIL segments('ws:/example.com/') should be ["ws:","example.com","0","/","",""]. Was ["ws:","","0","/example.com/","",""]. 80 FAIL segments('wss:/example.com/') should be ["wss:","example.com","0","/","",""]. Was ["wss:","","0","/example.com/","",""]. 77 PASS segments('ftps:/example.com/') is '["ftps:","","0","/example.com/","",""]' 78 PASS segments('gopher:/example.com/') is '["gopher:","example.com","0","/","",""]' 79 PASS segments('ws:/example.com/') is '["ws:","example.com","0","/","",""]' 80 PASS segments('wss:/example.com/') is '["wss:","example.com","0","/","",""]' 81 81 PASS segments('data:/example.com/') is '["data:","","0","/example.com/","",""]' 82 82 PASS segments('javascript:/example.com/') is '["javascript:","","0","/example.com/","",""]' 83 83 PASS segments('mailto:/example.com/') is '["mailto:","","0","/example.com/","",""]' 84 PASS segments('http:example.com/') is '["http:","example.org","0","/foo/example.com/","",""]' 85 PASS segments('ftp:example.com/') is '["ftp:","example.com","0","/","",""]' 86 PASS segments('https:example.com/') is '["https:","example.com","0","/","",""]' 87 PASS segments('madeupscheme:example.com/') is '["madeupscheme:","","0","example.com/","",""]' 88 FAIL segments('file:example.com/') should be ["file:","","0","/example.com/","",""]. Was ["file:","","0","example.com/","",""]. 89 PASS segments('ftps:example.com/') is '["ftps:","","0","example.com/","",""]' 90 PASS segments('gopher:example.com/') is '["gopher:","example.com","0","/","",""]' 91 PASS segments('ws:example.com/') is '["ws:","example.com","0","/","",""]' 92 PASS segments('wss:example.com/') is '["wss:","example.com","0","/","",""]' 93 PASS segments('data:example.com/') is '["data:","","0","example.com/","",""]' 94 PASS segments('javascript:example.com/') is '["javascript:","","0","example.com/","",""]' 95 PASS segments('mailto:example.com/') is '["mailto:","","0","example.com/","",""]' 84 96 PASS successfullyParsed is true 85 97 -
trunk/LayoutTests/fast/url/segments-from-data-url-expected.txt
r78383 r84762 5 5 6 6 PASS segments('http://user:pass@foo:21/bar;par?b#c') is '["http:","foo","21","/bar;par","?b","#c"]' 7 FAIL segments('http:foo.com') should be ["http:","foo.com","0","/","",""]. Was ["http:","","0","foo.com","",""]. 7 PASS segments('http:foo.com') is '["http:","foo.com","0","/","",""]' 8 8 PASS segments('\t :foo.com \n') is '[":","","0","","",""]' 9 9 PASS segments(' foo.com ') is '[":","","0","","",""]' … … 42 42 PASS segments('foo://') is '["foo:","","0","//","",""]' 43 43 PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]' 44 FAIL segments('http::@c:29') should be ["http:","c","29","/","",""]. Was ["http:","","0",":@c:29","",""]. 44 PASS segments('http::@c:29') is '["http:","c","29","/","",""]' 45 45 FAIL segments('http://&a:foo(b]c@d:2/') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. 46 46 FAIL segments('http://::@c@d:2') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. … … 61 61 FAIL segments('[61:24:74]:98') should be ["data:","","0","text/[61:24:74]:98","",""]. Was [":","","0","","",""]. 62 62 FAIL segments('http://[61:27]:98') should be [":","","0","","",""]. Was ["http:","[61:27]","98","/","",""]. 63 FAIL segments('http:[61:27]/:foo') should be [":","","0","","",""]. Was ["http:"," ","0","[61:27]/:foo","",""].63 FAIL segments('http:[61:27]/:foo') should be [":","","0","","",""]. Was ["http:","[61:27]","0","/:foo","",""]. 64 64 PASS segments('http://[1::2]:3:4') is '[":","","0","","",""]' 65 65 PASS segments('http://2001::1') is '[":","","0","","",""]' -
trunk/LayoutTests/fast/url/standard-url-expected.txt
r84756 r84762 31 31 PASS canonicalize('wss://foo:443/') is 'wss://foo/' 32 32 PASS canonicalize('wss://foo:815/') is 'wss://foo:815/' 33 FAIL canonicalize('http:/example.com/') should be http://example.com/. Was http:/example.com/. 34 FAIL canonicalize('ftp:/example.com/') should be ftp://example.com/. Was ftp:/example.com/. 35 FAIL canonicalize('https:/example.com/') should be https://example.com/. Was https:/example.com/. 33 PASS canonicalize('http:/example.com/') is 'http://example.com/' 34 PASS canonicalize('ftp:/example.com/') is 'ftp://example.com/' 35 PASS canonicalize('https:/example.com/') is 'https://example.com/' 36 36 PASS canonicalize('madeupscheme:/example.com/') is 'madeupscheme:/example.com/' 37 37 FAIL canonicalize('file:/example.com/') should be file://localhost/example.com/. Was file:///example.com/. 38 PASS canonicalize('f ops:/example.com/') is 'fops:/example.com/'39 FAIL canonicalize('gopher:/example.com/') should be gopher://example.com/. Was gopher:/example.com/. 40 FAIL canonicalize('ws:/example.com/') should be ws://example.com/. Was ws:/example.com/. 41 FAIL canonicalize('wss:/example.com/') should be wss://example.com/. Was wss:/example.com/. 38 PASS canonicalize('ftps:/example.com/') is 'ftps:/example.com/' 39 PASS canonicalize('gopher:/example.com/') is 'gopher://example.com/' 40 PASS canonicalize('ws:/example.com/') is 'ws://example.com/' 41 PASS canonicalize('wss:/example.com/') is 'wss://example.com/' 42 42 PASS canonicalize('data:/example.com/') is 'data:/example.com/' 43 43 PASS canonicalize('javascript:/example.com/') is 'javascript:/example.com/' 44 44 PASS canonicalize('mailto:/example.com/') is 'mailto:/example.com/' 45 PASS canonicalize('http:example.com/') is 'http://example.com/' 46 PASS canonicalize('ftp:example.com/') is 'ftp://example.com/' 47 PASS canonicalize('https:example.com/') is 'https://example.com/' 48 PASS canonicalize('madeupscheme:example.com/') is 'madeupscheme:example.com/' 49 PASS canonicalize('ftps:example.com/') is 'ftps:example.com/' 50 PASS canonicalize('gopher:example.com/') is 'gopher://example.com/' 51 PASS canonicalize('ws:example.com/') is 'ws://example.com/' 52 PASS canonicalize('wss:example.com/') is 'wss://example.com/' 53 PASS canonicalize('data:example.com/') is 'data:example.com/' 54 PASS canonicalize('javascript:example.com/') is 'javascript:example.com/' 55 PASS canonicalize('mailto:example.com/') is 'mailto:example.com/' 45 56 PASS successfullyParsed is true 46 57 -
trunk/Source/WebCore/ChangeLog
r84760 r84762 1 2011-04-24 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by George Staikos. 4 5 Handling of URLs like http:/example.com/ is incorrect 6 https://bugs.webkit.org/show_bug.cgi?id=59300 7 <rdar://problem/9231956> 8 9 URLs like http:/example.com/ or http:example.com/ are now correctly 10 canonicalized as http://example.com/ 11 12 The code still doesn't quite match other browsers - at least some 13 other browsers seem to base parsing behavior on whether they 14 recongize a scheme from a fixed list, and ignore whether // is 15 present in the URL or not. 16 17 * platform/KURL.cpp: 18 (WebCore::isNonFileHierarchicalScheme): New helper function. 19 (WebCore::KURL::parse): For a particular list of whitelisted schemes, 20 assume they are hierarchical and need an authority even if there is no // 21 after the :/ 22 1 23 2011-04-24 Dan Bernstein <mitz@apple.com> 2 24 -
trunk/Source/WebCore/platform/KURL.cpp
r82181 r84762 1138 1138 } 1139 1139 1140 static bool isNonFileHierarchicalScheme(const char* scheme, size_t schemeLength) 1141 { 1142 switch (schemeLength) { 1143 case 2: 1144 return equal("ws", 2, scheme, schemeLength); 1145 case 3: 1146 return equal("ftp", 3, scheme, schemeLength) || equal("wss", 3, scheme, schemeLength); 1147 case 4: 1148 return equal("http", 4, scheme, schemeLength); 1149 case 5: 1150 return equal("https", 5, scheme, schemeLength); 1151 case 6: 1152 return equal("gopher", 6, scheme, schemeLength); 1153 } 1154 return false; 1155 } 1156 1140 1157 void KURL::parse(const char* url, const String* originalString) 1141 1158 { … … 1174 1191 1175 1192 bool hierarchical = url[schemeEnd + 1] == '/'; 1193 bool hasSecondSlash = hierarchical && url[schemeEnd + 2] == '/'; 1176 1194 1177 1195 bool isFile = schemeEnd == 4 … … 1187 1205 && (url[4] == ':' || (matchLetter(url[4], 's') && url[5] == ':')); 1188 1206 1189 if ( hierarchical && url[schemeEnd + 2] == '/') {1207 if ((hierarchical && hasSecondSlash) || isNonFileHierarchicalScheme(url, schemeEnd)) { 1190 1208 // The part after the scheme is either a net_path or an abs_path whose first path segment is empty. 1191 1209 // Attempt to find an authority. 1192 1193 1210 // FIXME: Authority characters may be scanned twice, and it would be nice to be faster. 1194 userStart += 2; 1211 1212 if (hierarchical) 1213 userStart++; 1214 if (hasSecondSlash) 1215 userStart++; 1195 1216 userEnd = userStart; 1196 1217 … … 1395 1416 1396 1417 // For canonicalization, ensure we have a '/' for no path. 1397 // Do this only for hierarchicalURL with protocol http or https.1398 if (m_protocolInHTTPFamily && hierarchical &&pathEnd == pathStart)1418 // Do this only for URL with protocol http or https. 1419 if (m_protocolInHTTPFamily && pathEnd == pathStart) 1399 1420 *p++ = '/'; 1400 1421
Note: See TracChangeset
for help on using the changeset viewer.