From e48d279609693b4d164199748c93ad791547c649 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 27 Mar 2012 18:40:26 +0100 Subject: Cherry-pick WebKit change r96779 to fix window.location See http://trac.webkit.org/changeset/96779 Note that a conflict occurred in Source/WebCore/platform/qt/KURLQt.cpp but the change is not required. Bug: 2159848 Change-Id: I56e645b2f187302c6f1858c8c6c291209f130cad --- LayoutTests/fast/url/file-http-base-expected.txt | 3 ++- LayoutTests/fast/url/mailto-expected.txt | 2 +- LayoutTests/fast/url/script-tests/file-http-base.js | 3 ++- LayoutTests/fast/url/script-tests/segments.js | 11 +++++++++-- LayoutTests/fast/url/script-tests/standard-url.js | 7 ++++++- LayoutTests/fast/url/segments-expected.txt | 7 ++++++- LayoutTests/fast/url/segments-from-data-url-expected.txt | 2 +- LayoutTests/fast/url/segments.html | 3 ++- LayoutTests/fast/url/standard-url-expected.txt | 4 ++++ 9 files changed, 33 insertions(+), 9 deletions(-) (limited to 'LayoutTests') diff --git a/LayoutTests/fast/url/file-http-base-expected.txt b/LayoutTests/fast/url/file-http-base-expected.txt index afd3131..f9169cd 100644 --- a/LayoutTests/fast/url/file-http-base-expected.txt +++ b/LayoutTests/fast/url/file-http-base-expected.txt @@ -20,7 +20,8 @@ PASS canonicalize('file:///foo/bar.txt') is 'file:///foo/bar.txt' FAIL canonicalize('FILE:/\\/\\7:\\\\//foo\\bar.html') should be file://7:////foo/bar.html. Was file:////7:////foo/bar.html. PASS canonicalize('file:filer/home\\me') is 'file://filer/home/me' FAIL canonicalize('file:///C:/foo/../../../bar.html') should be file:///C:/bar.html. Was file:///bar.html. -FAIL canonicalize('file:///C:/asdf#\xc2') should be file:///C:/asdf#�. Was file:///C:/asdf#%C2. +FAIL canonicalize('file:///C:/asdf#\xc2') should be file:///C:/asdf#Â. Was file:///C:/asdf#%C2. +FAIL canonicalize('file:///C:/asdf#Â') should be file:///C:/asdf#Â. Was file:///C:/asdf#%C2. PASS canonicalize('file:///home/me') is 'file:///home/me' FAIL canonicalize('file:c:\\foo\\bar.html') should be file:///c:/foo/bar.html. Was file://c:/foo/bar.html. FAIL canonicalize('file:c|//foo\\bar.html') should be file:///c%7C//foo/bar.html. Was file://c|//foo/bar.html. diff --git a/LayoutTests/fast/url/mailto-expected.txt b/LayoutTests/fast/url/mailto-expected.txt index cd318f9..dc49e91 100644 --- a/LayoutTests/fast/url/mailto-expected.txt +++ b/LayoutTests/fast/url/mailto-expected.txt @@ -8,7 +8,7 @@ PASS canonicalize('mailto:addr1@foo.com') is 'mailto:addr1@foo.com' PASS canonicalize('mailto:addr1 ') is 'mailto:addr1' PASS canonicalize('mailto:addr1?to=jon') is 'mailto:addr1?to=jon' PASS canonicalize('mailto:addr1,addr2') is 'mailto:addr1,addr2' -FAIL canonicalize('mailto:addr1, addr2') should be mailto:addr1, addr2. Was mailto:addr1,%20addr2. +PASS canonicalize('mailto:addr1, addr2') is 'mailto:addr1, addr2' PASS canonicalize('mailto:addr1%2caddr2') is 'mailto:addr1%2caddr2' PASS canonicalize('mailto:𐌀') is 'mailto:%F0%90%8C%80' PASS canonicalize('mailto:addr1?') is 'mailto:addr1?' diff --git a/LayoutTests/fast/url/script-tests/file-http-base.js b/LayoutTests/fast/url/script-tests/file-http-base.js index ca9e734..00965b8 100644 --- a/LayoutTests/fast/url/script-tests/file-http-base.js +++ b/LayoutTests/fast/url/script-tests/file-http-base.js @@ -36,7 +36,8 @@ cases = [ // Make sure relative paths can't go above the "C:" ["file:///C:/foo/../../../bar.html", "file:///C:/bar.html"], // Busted refs shouldn't make the whole thing fail. - ["file:///C:/asdf#\\xc2", "file:///C:/asdf#\\xef\\xbf\\xbd"], + ["file:///C:/asdf#\\xc2", "file:///C:/asdf#\\xc2"], + ["file:///C:/asdf#\xc2", "file:///C:/asdf#\xc2"], // Unix-style paths ["file:///home/me", "file:///home/me"], diff --git a/LayoutTests/fast/url/script-tests/segments.js b/LayoutTests/fast/url/script-tests/segments.js index a1e5dba..a83cb61 100644 --- a/LayoutTests/fast/url/script-tests/segments.js +++ b/LayoutTests/fast/url/script-tests/segments.js @@ -1,6 +1,6 @@ description("Test URL segmentation"); -cases = [ +cases = [ // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]] ["http://user:pass@foo:21/bar;par?b#c", ["http:","foo","21","/bar;par","?b","#c"]], ["http:foo.com", ["http:","example.org","","/foo/foo.com","",""]], @@ -91,7 +91,14 @@ cases = [ ["wss:example.com/", ["wss:","example.com","","/","",""]], ["data:example.com/", ["data:","","","example.com/","",""]], ["javascript:example.com/", ["javascript:","","","example.com/","",""]], - ["mailto:example.com/", ["mailto:","","","example.com/","",""]], + ["mailto:example.com/", ["mailto:","","","example.com/","",""]], + + ["/a/b/c", ["http:","example.org","","/a/b/c","",""]], + ["/a/ /c", ["http:","example.org","","/a/%20/c","",""]], + ["/a%2fc", ["http:","example.org","","/a%2fc","",""]], + ["/a/%2f/c", ["http:","example.org","","/a/%2f/c","",""]], + + ["#\u03B2", ["http:","example.org","","/foo/bar","","#\u03B2"]], ]; var originalBaseURL = canonicalize("."); diff --git a/LayoutTests/fast/url/script-tests/standard-url.js b/LayoutTests/fast/url/script-tests/standard-url.js index 27afe76..5611faa 100644 --- a/LayoutTests/fast/url/script-tests/standard-url.js +++ b/LayoutTests/fast/url/script-tests/standard-url.js @@ -1,8 +1,10 @@ description("Canonicalization of standard URLs"); -cases = [ +cases = [ ["http://www.google.com/foo?bar=baz#", "http://www.google.com/foo?bar=baz#"], + ["http://www.google.com/foo?bar=baz# \u00bb", "http://www.google.com/foo?bar=baz# \u00bb"], ["http://[www.google.com]/", "http://[www.google.com]/"], + ["http://www.google.com", "http://www.google.com/"], // Disabled because whitespace gets treated different in this API. // ["ht\ttp:@www.google.com:80/;p?#", "ht%09tp://www.google.com:80/;p?#"], ["http:////////user:@google.com:99?foo", "http://user@google.com:99/?foo"], @@ -58,6 +60,9 @@ cases = [ ["data:example.com/", "data:example.com/"], ["javascript:example.com/", "javascript:example.com/"], ["mailto:example.com/", "mailto:example.com/"], + // Escaping of non hierarchical URLs + ["javascript:alert(\\t 1 \\n\\r)", "javascript:alert( 1 )"], + ['javascript:alert(" \1 \u03B2 ")', 'javascript:alert(" %01 %CE%B2 ")'], ]; 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 0e51a1a..76e49aa 100644 --- a/LayoutTests/fast/url/segments-expected.txt +++ b/LayoutTests/fast/url/segments-expected.txt @@ -8,7 +8,7 @@ PASS segments('http:foo.com') is '["http:","example.org","","/foo/foo.com","","" PASS segments('\t :foo.com \n') is '["http:","example.org","","/foo/:foo.com","",""]' PASS segments(' foo.com ') is '["http:","example.org","","/foo/foo.com","",""]' PASS segments('a:\t foo.com') is '["a:","",""," foo.com","",""]' -FAIL segments('http://f:21/ b ? d # e ') should be ["http:","f","21","/%20b%20","?%20d%20","# e"]. Was ["http:","f","21","/ b ","?%20d%20","# e"]. +PASS segments('http://f:21/ b ? d # e ') is '["http:","f","21","/%20b%20","?%20d%20","# e"]' PASS segments('http://f:/c') is '["http:","f","","/c","",""]' PASS segments('http://f:0/c') is '["http:","f","0","/c","",""]' PASS segments('http://f:00000000000000/c') is '["http:","f","0","/c","",""]' @@ -93,6 +93,11 @@ PASS segments('wss:example.com/') is '["wss:","example.com","","/","",""]' PASS segments('data:example.com/') is '["data:","","","example.com/","",""]' PASS segments('javascript:example.com/') is '["javascript:","","","example.com/","",""]' PASS segments('mailto:example.com/') is '["mailto:","","","example.com/","",""]' +PASS segments('/a/b/c') is '["http:","example.org","","/a/b/c","",""]' +PASS segments('/a/ /c') is '["http:","example.org","","/a/%20/c","",""]' +PASS segments('/a%2fc') is '["http:","example.org","","/a%2fc","",""]' +PASS segments('/a/%2f/c') is '["http:","example.org","","/a/%2f/c","",""]' +FAIL segments('#β') should be ["http:","example.org","","/foo/bar","","#β"]. Was ["http:","example.org","","/foo/bar","","#%CE%B2"]. 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 b4195a4..c64aefc 100644 --- a/LayoutTests/fast/url/segments-from-data-url-expected.txt +++ b/LayoutTests/fast/url/segments-from-data-url-expected.txt @@ -8,7 +8,7 @@ PASS segments('http:foo.com') is '["http:","foo.com","","/","",""]' PASS segments('\t :foo.com \n') is '[":","","","","",""]' PASS segments(' foo.com ') is '[":","","","","",""]' PASS segments('a:\t foo.com') is '["a:","",""," foo.com","",""]' -FAIL segments('http://f:21/ b ? d # e ') should be ["http:","f","21","/%20b%20","?%20d%20","# e"]. Was ["http:","f","21","/ b ","?%20d%20","# e"]. +PASS segments('http://f:21/ b ? d # e ') is '["http:","f","21","/%20b%20","?%20d%20","# e"]' PASS segments('http://f:/c') is '["http:","f","","/c","",""]' PASS segments('http://f:0/c') is '["http:","f","0","/c","",""]' PASS segments('http://f:00000000000000/c') is '["http:","f","0","/c","",""]' diff --git a/LayoutTests/fast/url/segments.html b/LayoutTests/fast/url/segments.html index 5cc2f82..96aa871 100644 --- a/LayoutTests/fast/url/segments.html +++ b/LayoutTests/fast/url/segments.html @@ -1,6 +1,7 @@ - + + diff --git a/LayoutTests/fast/url/standard-url-expected.txt b/LayoutTests/fast/url/standard-url-expected.txt index 99ba8bb..d274059 100644 --- a/LayoutTests/fast/url/standard-url-expected.txt +++ b/LayoutTests/fast/url/standard-url-expected.txt @@ -4,7 +4,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS canonicalize('http://www.google.com/foo?bar=baz#') is 'http://www.google.com/foo?bar=baz#' +FAIL canonicalize('http://www.google.com/foo?bar=baz# »') should be http://www.google.com/foo?bar=baz# ». Was http://www.google.com/foo?bar=baz# %BB. PASS canonicalize('http://[www.google.com]/') is 'http://[www.google.com]/' +PASS canonicalize('http://www.google.com') is 'http://www.google.com/' FAIL canonicalize('http:////////user:@google.com:99?foo') should be http://user@google.com:99/?foo. Was http://////user:@google.com:99?foo. FAIL canonicalize('http://192.0x00A80001') should be http://192.168.0.1/. Was http://192.0x00A80001/. FAIL canonicalize('http://www/foo%2Ehtml') should be http://www/foo.html. Was http://www/foo%2Ehtml. @@ -53,6 +55,8 @@ 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('javascript:alert(\t 1 \n\r)') is 'javascript:alert( 1 )' +PASS canonicalize('javascript:alert("  β ")') is 'javascript:alert(" %01 %CE%B2 ")' PASS successfullyParsed is true TEST COMPLETE -- cgit v1.1