From db951b2c4c8fce1304a13d97dec4ae14be629380 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 27 Mar 2012 18:35:51 +0100 Subject: Cherry-pick WebKit change r84762 to fix URL canonicalization This is to make sure URL parsing behaviour is up-to-date prior to fixing window.location. See bug for details. Note that the 'http:example.com/' test case in fast/url/standard-url.html fails with DRT2 because of an assumption in the test that it is served as a file scheme URL. See http://trac.webkit.org/changeset/84762 Bug: 2159848 Change-Id: Ie680debcad3d285efd40134932b72d429c0d2222 --- LayoutTests/fast/url/relative-expected.txt | 6 ++--- LayoutTests/fast/url/script-tests/segments.js | 15 +++++++++++-- LayoutTests/fast/url/script-tests/standard-url.js | 13 ++++++++++- LayoutTests/fast/url/segments-expected.txt | 26 ++++++++++++++++------ .../fast/url/segments-from-data-url-expected.txt | 6 ++--- LayoutTests/fast/url/standard-url-expected.txt | 25 +++++++++++++++------ 6 files changed, 68 insertions(+), 23 deletions(-) (limited to 'LayoutTests') diff --git a/LayoutTests/fast/url/relative-expected.txt b/LayoutTests/fast/url/relative-expected.txt index 8ee781c..7f93285 100644 --- a/LayoutTests/fast/url/relative-expected.txt +++ b/LayoutTests/fast/url/relative-expected.txt @@ -13,9 +13,9 @@ PASS canonicalize(' . ') is 'http://foo/' PASS canonicalize(' ') is 'http://foo/bar' PASS canonicalize('http:path') is 'http://host/path' PASS canonicalize('http:path') is 'http://host/a/path' -FAIL canonicalize('http:/path') should be http://host/path. Was http:/path. +FAIL canonicalize('http:/path') should be http://host/path. Was http://path/. FAIL canonicalize('HTTP:/path') should be http://host/path. Was http:/path. -FAIL canonicalize('https:host2') should be https://host2/. Was https:host2. +PASS canonicalize('https:host2') is 'https://host2/' PASS canonicalize('htto:/host2') is 'htto:/host2' PASS canonicalize('/b/c/d') is 'http://host/b/c/d' PASS canonicalize('\\b\\c\\d') is 'http://host/b/c/d' @@ -42,7 +42,7 @@ FAIL canonicalize('baz.html') should be . Was baz.html. PASS canonicalize('data:baz') is 'data:baz' PASS canonicalize('data:/base') is 'data:/base' PASS canonicalize('http://host/') is 'http://host/' -FAIL canonicalize('http:host') should be http://host/. Was http:host. +PASS canonicalize('http:host') is 'http://host/' PASS canonicalize('./asd:fgh') is 'http://foo/asd:fgh' PASS canonicalize(':foo') is 'http://foo/:foo' PASS canonicalize(' hello world') is 'http://foo/hello%20world' diff --git a/LayoutTests/fast/url/script-tests/segments.js b/LayoutTests/fast/url/script-tests/segments.js index a826703..037f243 100644 --- a/LayoutTests/fast/url/script-tests/segments.js +++ b/LayoutTests/fast/url/script-tests/segments.js @@ -73,14 +73,25 @@ cases = [ ["https:/example.com/", ["https:","example.com","0","/","",""]], ["madeupscheme:/example.com/", ["madeupscheme:","","0","/example.com/","",""]], ["file:/example.com/", ["file:","","0","/example.com/","",""]], - ["fops:/example.com/", ["fops:","","0","/example.com/","",""]], + ["ftps:/example.com/", ["ftps:","","0","/example.com/","",""]], ["gopher:/example.com/", ["gopher:","example.com","0","/","",""]], ["ws:/example.com/", ["ws:","example.com","0","/","",""]], ["wss:/example.com/", ["wss:","example.com","0","/","",""]], ["data:/example.com/", ["data:","","0","/example.com/","",""]], ["javascript:/example.com/", ["javascript:","","0","/example.com/","",""]], ["mailto:/example.com/", ["mailto:","","0","/example.com/","",""]], - + ["http:example.com/", ["http:","example.org","0","/foo/example.com/","",""]], + ["ftp:example.com/", ["ftp:","example.com","0","/","",""]], + ["https:example.com/", ["https:","example.com","0","/","",""]], + ["madeupscheme:example.com/", ["madeupscheme:","","0","example.com/","",""]], + ["file:example.com/", ["file:","","0","/example.com/","",""]], + ["ftps:example.com/", ["ftps:","","0","example.com/","",""]], + ["gopher:example.com/", ["gopher:","example.com","0","/","",""]], + ["ws:example.com/", ["ws:","example.com","0","/","",""]], + ["wss:example.com/", ["wss:","example.com","0","/","",""]], + ["data:example.com/", ["data:","","0","example.com/","",""]], + ["javascript:example.com/", ["javascript:","","0","example.com/","",""]], + ["mailto:example.com/", ["mailto:","","0","example.com/","",""]], ]; var originalBaseURL = canonicalize("."); diff --git a/LayoutTests/fast/url/script-tests/standard-url.js b/LayoutTests/fast/url/script-tests/standard-url.js index ef2f7a7..27afe76 100644 --- a/LayoutTests/fast/url/script-tests/standard-url.js +++ b/LayoutTests/fast/url/script-tests/standard-url.js @@ -40,13 +40,24 @@ cases = [ ["https:/example.com/", "https://example.com/"], ["madeupscheme:/example.com/", "madeupscheme:/example.com/"], ["file:/example.com/", "file://localhost/example.com/"], - ["fops:/example.com/", "fops:/example.com/"], + ["ftps:/example.com/", "ftps:/example.com/"], ["gopher:/example.com/", "gopher://example.com/"], ["ws:/example.com/", "ws://example.com/"], ["wss:/example.com/", "wss://example.com/"], ["data:/example.com/", "data:/example.com/"], ["javascript:/example.com/", "javascript:/example.com/"], ["mailto:/example.com/", "mailto:/example.com/"], + ["http:example.com/", "http://example.com/"], + ["ftp:example.com/", "ftp://example.com/"], + ["https:example.com/", "https://example.com/"], + ["madeupscheme:example.com/", "madeupscheme:example.com/"], + ["ftps:example.com/", "ftps:example.com/"], + ["gopher:example.com/", "gopher://example.com/"], + ["ws:example.com/", "ws://example.com/"], + ["wss:example.com/", "wss://example.com/"], + ["data:example.com/", "data:example.com/"], + ["javascript:example.com/", "javascript:example.com/"], + ["mailto:example.com/", "mailto:example.com/"], ]; for (var i = 0; i < cases.length; ++i) { diff --git a/LayoutTests/fast/url/segments-expected.txt b/LayoutTests/fast/url/segments-expected.txt index b98c50f..38ea324 100644 --- a/LayoutTests/fast/url/segments-expected.txt +++ b/LayoutTests/fast/url/segments-expected.txt @@ -69,18 +69,30 @@ PASS segments('http://2001::1]:80') is '[":","","0","","",""]' PASS segments('http://[2001::1]') is '["http:","[2001::1]","0","/","",""]' PASS segments('http://[2001::1]:80') is '["http:","[2001::1]","0","/","",""]' PASS segments('http://[[::]]') is '[":","","0","","",""]' -FAIL segments('http:/example.com/') should be ["http:","example.org","0","/example.com/","",""]. Was ["http:","","0","/example.com/","",""]. -FAIL segments('ftp:/example.com/') should be ["ftp:","example.com","0","/","",""]. Was ["ftp:","","0","/example.com/","",""]. -FAIL segments('https:/example.com/') should be ["https:","example.com","0","/","",""]. Was ["https:","","0","/example.com/","",""]. +FAIL segments('http:/example.com/') should be ["http:","example.org","0","/example.com/","",""]. Was ["http:","example.com","0","/","",""]. +PASS segments('ftp:/example.com/') is '["ftp:","example.com","0","/","",""]' +PASS segments('https:/example.com/') is '["https:","example.com","0","/","",""]' PASS segments('madeupscheme:/example.com/') is '["madeupscheme:","","0","/example.com/","",""]' PASS segments('file:/example.com/') is '["file:","","0","/example.com/","",""]' -PASS segments('fops:/example.com/') is '["fops:","","0","/example.com/","",""]' -FAIL segments('gopher:/example.com/') should be ["gopher:","example.com","0","/","",""]. Was ["gopher:","","0","/example.com/","",""]. -FAIL segments('ws:/example.com/') should be ["ws:","example.com","0","/","",""]. Was ["ws:","","0","/example.com/","",""]. -FAIL segments('wss:/example.com/') should be ["wss:","example.com","0","/","",""]. Was ["wss:","","0","/example.com/","",""]. +PASS segments('ftps:/example.com/') is '["ftps:","","0","/example.com/","",""]' +PASS segments('gopher:/example.com/') is '["gopher:","example.com","0","/","",""]' +PASS segments('ws:/example.com/') is '["ws:","example.com","0","/","",""]' +PASS segments('wss:/example.com/') is '["wss:","example.com","0","/","",""]' PASS segments('data:/example.com/') is '["data:","","0","/example.com/","",""]' PASS segments('javascript:/example.com/') is '["javascript:","","0","/example.com/","",""]' PASS segments('mailto:/example.com/') is '["mailto:","","0","/example.com/","",""]' +PASS segments('http:example.com/') is '["http:","example.org","0","/foo/example.com/","",""]' +PASS segments('ftp:example.com/') is '["ftp:","example.com","0","/","",""]' +PASS segments('https:example.com/') is '["https:","example.com","0","/","",""]' +PASS segments('madeupscheme:example.com/') is '["madeupscheme:","","0","example.com/","",""]' +FAIL segments('file:example.com/') should be ["file:","","0","/example.com/","",""]. Was ["file:","","0","example.com/","",""]. +PASS segments('ftps:example.com/') is '["ftps:","","0","example.com/","",""]' +PASS segments('gopher:example.com/') is '["gopher:","example.com","0","/","",""]' +PASS segments('ws:example.com/') is '["ws:","example.com","0","/","",""]' +PASS segments('wss:example.com/') is '["wss:","example.com","0","/","",""]' +PASS segments('data:example.com/') is '["data:","","0","example.com/","",""]' +PASS segments('javascript:example.com/') is '["javascript:","","0","example.com/","",""]' +PASS segments('mailto:example.com/') is '["mailto:","","0","example.com/","",""]' PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/fast/url/segments-from-data-url-expected.txt b/LayoutTests/fast/url/segments-from-data-url-expected.txt index b97e489..6066810 100644 --- a/LayoutTests/fast/url/segments-from-data-url-expected.txt +++ b/LayoutTests/fast/url/segments-from-data-url-expected.txt @@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS segments('http://user:pass@foo:21/bar;par?b#c') is '["http:","foo","21","/bar;par","?b","#c"]' -FAIL segments('http:foo.com') should be ["http:","foo.com","0","/","",""]. Was ["http:","","0","foo.com","",""]. +PASS segments('http:foo.com') is '["http:","foo.com","0","/","",""]' PASS segments('\t :foo.com \n') is '[":","","0","","",""]' PASS segments(' foo.com ') is '[":","","0","","",""]' PASS segments('a:\t foo.com') is '["a:","","0"," foo.com","",""]' @@ -41,7 +41,7 @@ PASS segments('::') is '[":","","0","","",""]' PASS segments('::23') is '[":","","0","","",""]' PASS segments('foo://') is '["foo:","","0","//","",""]' PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]' -FAIL segments('http::@c:29') should be ["http:","c","29","/","",""]. Was ["http:","","0",":@c:29","",""]. +PASS segments('http::@c:29') is '["http:","c","29","/","",""]' FAIL segments('http://&a:foo(b]c@d:2/') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. FAIL segments('http://::@c@d:2') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. PASS segments('http://foo.com:b@d/') is '["http:","d","0","/","",""]' @@ -60,7 +60,7 @@ PASS segments('http://foo/abcd?efgh?ijkl') is '["http:","foo","0","/abcd","?efgh PASS segments('http://foo/abcd#foo?bar') is '["http:","foo","0","/abcd","","#foo?bar"]' FAIL segments('[61:24:74]:98') should be ["data:","","0","text/[61:24:74]:98","",""]. Was [":","","0","","",""]. FAIL segments('http://[61:27]:98') should be [":","","0","","",""]. Was ["http:","[61:27]","98","/","",""]. -FAIL segments('http:[61:27]/:foo') should be [":","","0","","",""]. Was ["http:","","0","[61:27]/:foo","",""]. +FAIL segments('http:[61:27]/:foo') should be [":","","0","","",""]. Was ["http:","[61:27]","0","/:foo","",""]. PASS segments('http://[1::2]:3:4') is '[":","","0","","",""]' PASS segments('http://2001::1') is '[":","","0","","",""]' PASS segments('http://[2001::1') is '[":","","0","","",""]' diff --git a/LayoutTests/fast/url/standard-url-expected.txt b/LayoutTests/fast/url/standard-url-expected.txt index 5f5c710..99ba8bb 100644 --- a/LayoutTests/fast/url/standard-url-expected.txt +++ b/LayoutTests/fast/url/standard-url-expected.txt @@ -30,18 +30,29 @@ PASS canonicalize('wss://foo:80/') is 'wss://foo:80/' PASS canonicalize('wss://foo:81/') is 'wss://foo:81/' PASS canonicalize('wss://foo:443/') is 'wss://foo/' PASS canonicalize('wss://foo:815/') is 'wss://foo:815/' -FAIL canonicalize('http:/example.com/') should be http://example.com/. Was http:/example.com/. -FAIL canonicalize('ftp:/example.com/') should be ftp://example.com/. Was ftp:/example.com/. -FAIL canonicalize('https:/example.com/') should be https://example.com/. Was https:/example.com/. +PASS canonicalize('http:/example.com/') is 'http://example.com/' +PASS canonicalize('ftp:/example.com/') is 'ftp://example.com/' +PASS canonicalize('https:/example.com/') is 'https://example.com/' PASS canonicalize('madeupscheme:/example.com/') is 'madeupscheme:/example.com/' FAIL canonicalize('file:/example.com/') should be file://localhost/example.com/. Was file:///example.com/. -PASS canonicalize('fops:/example.com/') is 'fops:/example.com/' -FAIL canonicalize('gopher:/example.com/') should be gopher://example.com/. Was gopher:/example.com/. -FAIL canonicalize('ws:/example.com/') should be ws://example.com/. Was ws:/example.com/. -FAIL canonicalize('wss:/example.com/') should be wss://example.com/. Was wss:/example.com/. +PASS canonicalize('ftps:/example.com/') is 'ftps:/example.com/' +PASS canonicalize('gopher:/example.com/') is 'gopher://example.com/' +PASS canonicalize('ws:/example.com/') is 'ws://example.com/' +PASS canonicalize('wss:/example.com/') is 'wss://example.com/' PASS canonicalize('data:/example.com/') is 'data:/example.com/' PASS canonicalize('javascript:/example.com/') is 'javascript:/example.com/' PASS canonicalize('mailto:/example.com/') is 'mailto:/example.com/' +PASS canonicalize('http:example.com/') is 'http://example.com/' +PASS canonicalize('ftp:example.com/') is 'ftp://example.com/' +PASS canonicalize('https:example.com/') is 'https://example.com/' +PASS canonicalize('madeupscheme:example.com/') is 'madeupscheme:example.com/' +PASS canonicalize('ftps:example.com/') is 'ftps:example.com/' +PASS canonicalize('gopher:example.com/') is 'gopher://example.com/' +PASS canonicalize('ws:example.com/') is 'ws://example.com/' +PASS canonicalize('wss:example.com/') is 'wss://example.com/' +PASS canonicalize('data:example.com/') is 'data:example.com/' +PASS canonicalize('javascript:example.com/') is 'javascript:example.com/' +PASS canonicalize('mailto:example.com/') is 'mailto:example.com/' PASS successfullyParsed is true TEST COMPLETE -- cgit v1.1