Changeset 57712 in webkit


Ignore:
Timestamp:
Apr 15, 2010 7:50:21 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-15 Adam Barth <abarth@webkit.org>

Reviewed by Jeremy Orlow.

Clean up unicode URL tests cases
https://bugs.webkit.org/show_bug.cgi?id=37678

When we started writing these URL tests, I didn't understand how to
handle the unicodes test cases properly. With a bunch of help (and a
pointer to http://rishida.net/tools/conversion/), I've fixed these to
be more or less faithful to the original unit tests.

  • fast/url/anchor-expected.txt:
  • fast/url/query-expected.txt:
  • fast/url/script-tests/anchor.js:
  • fast/url/script-tests/query.js:
  • fast/url/script-tests/standard-url.js:
  • fast/url/script-tests/trivial.js:
    • Updated this test to use the shared implementations
    • Also, removed assumptions about the base URL.
  • fast/url/standard-url-expected.txt:
  • fast/url/trivial-expected.txt:
Location:
trunk/LayoutTests
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57711 r57712  
     12010-04-15  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Clean up unicode URL tests cases
     6        https://bugs.webkit.org/show_bug.cgi?id=37678
     7
     8        When we started writing these URL tests, I didn't understand how to
     9        handle the unicodes test cases properly.  With a bunch of help (and a
     10        pointer to http://rishida.net/tools/conversion/), I've fixed these to
     11        be more or less faithful to the original unit tests.
     12
     13        * fast/url/anchor-expected.txt:
     14        * fast/url/query-expected.txt:
     15        * fast/url/script-tests/anchor.js:
     16        * fast/url/script-tests/query.js:
     17        * fast/url/script-tests/standard-url.js:
     18        * fast/url/script-tests/trivial.js:
     19            - Updated this test to use the shared implementations
     20            - Also, removed assumptions about the base URL.
     21        * fast/url/standard-url-expected.txt:
     22        * fast/url/trivial-expected.txt:
     23
    1242010-04-15  Adam Barth  <abarth@webkit.org>
    225
  • trunk/LayoutTests/fast/url/anchor-expected.txt

    r57502 r57712  
    66FAIL canonicalize('http://www.example.com/#hello, world') should be http://www.example.com/#hello, world. Was http://www.example.com/#hello,%20world.
    77FAIL canonicalize('http://www.example.com/#©') should be http://www.example.com/#©. Was http://www.example.com/#%C2%A9.
    8 FAIL canonicalize('http://www.example.com/#𐌀ss') should be http://www.example.com/#𐌀ss. Was http://www.example.com/#%F0%90%26%23140%3B%26%23128%3Bss.
     8FAIL canonicalize('http://www.example.com/#𐌀ss') should be http://www.example.com/#𐌀ss. Was http://www.example.com/#%26%2366304%3Bss.
    99PASS canonicalize('http://www.example.com/#%41%a') is 'http://www.example.com/#%41%a'
    10 FAIL canonicalize('http://www.example.com/#Â') should be http://www.example.com/#�. Was http://www.example.com/#%C2.
    11 FAIL canonicalize('http://www.example.com/#a﷐') should be http://www.example.com/#a�. Was http://www.example.com/#a%EF%B7%90.
     10FAIL canonicalize('http://www.example.com/#\ud800\u597d') should be http://www.example.com/#�好. Was http://www.example.com/#%26%2355296%3B%26%2322909%3B.
     11FAIL canonicalize('http://www.example.com/#a\uFDD0') should be http://www.example.com/#a﷐. Was http://www.example.com/#a%26%2364976%3B.
    1212FAIL canonicalize('http://www.example.com/#asdf#qwer') should be http://www.example.com/#asdf#qwer. Was http://www.example.com/#asdf%23qwer.
    1313FAIL canonicalize('http://www.example.com/##asdf') should be http://www.example.com/##asdf. Was http://www.example.com/#%23asdf.
  • trunk/LayoutTests/fast/url/query-expected.txt

    r57501 r57712  
    66PASS canonicalize('http://www.example.com/?foo=bar') is 'http://www.example.com/?foo=bar'
    77PASS canonicalize('http://www.example.com/?as?df') is 'http://www.example.com/?as?df'
    8 FAIL canonicalize('http://www.example.com/?as#df') should be http://www.example.com/?as%23df. Was http://www.example.com/?as#df.
    9 FAIL canonicalize('http://www.example.com/?hello bye') should be http://www.example.com/?%02hello%7F%20bye. Was http://www.example.com/?hello%7F%20bye.
     8FAIL canonicalize('http://www.example.com/?\x02hello bye') should be http://www.example.com/?%02hello%7F%20bye. Was http://www.example.com/?hello%7F%20bye.
    109PASS canonicalize('http://www.example.com/?%40%41123') is 'http://www.example.com/?%40%41123'
    11 PASS canonicalize('http://www.example.com/?q=你好') is 'http://www.example.com/?q=%E4%BD%A0%E5%A5%BD'
    12 FAIL canonicalize('http://www.example.com/?q=íí') should be http://www.example.com/?q=%EF%BF%BD%EF%BF%BD. Was http://www.example.com/?q=%ED%ED.
     10PASS canonicalize('http://www.example.com/?q=你好') is 'http://www.example.com/?q=%26%2320320%3B%26%2322909%3B'
     11PASS canonicalize('http://www.example.com/?q=\ud800\ud800') is 'http://www.example.com/?q=%26%2355296%3B%26%2355296%3B'
    1312PASS canonicalize('http://www.example.com/?q=<asdf>') is 'http://www.example.com/?q=%3Casdf%3E'
    1413PASS canonicalize('http://www.example.com/?q="asdf"') is 'http://www.example.com/?q=%22asdf%22'
  • trunk/LayoutTests/fast/url/script-tests/anchor.js

    r57502 r57712  
    44  ["hello, world", "hello, world"],
    55  ["\xc2\xa9", "\xc2\xa9"],
    6   ["\xF0\x90\x8C\x80ss", "\xF0\x90\x8C\x80ss"],
     6  ["\ud800\udf00ss", "\ud800\udf00ss"],
    77  ["%41%a", "%41%a"],
    8   ["\xc2", "\xef\xbf\xbd"],
    9   ["a\xef\xb7\x90", "a\xef\xbf\xbd"],
     8  ["\\ud800\\u597d", "\\uFFFD\\u597D"],
     9  ["a\\uFDD0", "a\\uFDD0"],
    1010  ["asdf#qwer", "asdf#qwer"],
    1111  ["#asdf", "#asdf"],
  • trunk/LayoutTests/fast/url/script-tests/query.js

    r57501 r57712  
    22
    33cases = [
     4  // Regular ASCII case in some different encodings.
    45  ["foo=bar", "foo=bar"],
     6  // Allow question marks in the query without escaping
    57  ["as?df", "as?df"],
    6   ["as#df", "as%23df"],
    7   ["\x02hello\x7f bye", "%02hello%7F%20bye"],
     8  // Always escape '#' since it would mark the ref.
     9  // Disabled because this test requires being able to set the query directly.
     10  // ["as#df", "as%23df"],
     11  // Escape some questionable 8-bit characters, but never unescape.
     12  ["\\x02hello\x7f bye", "%02hello%7F%20bye"],
    813  ["%40%41123", "%40%41123"],
    9   ["q=\xe4\xbd\xa0\xe5\xa5\xbd", "q=%E4%BD%A0%E5%A5%BD"],
    10   ["q=\xed\xed", "q=%EF%BF%BD%EF%BF%BD"],
     14  // Chinese input/output
     15  ["q=\u4F60\u597D", "q=%26%2320320%3B%26%2322909%3B"],
     16  // Invalid UTF-8/16 input should be replaced with invalid characters.
     17  ["q=\\ud800\\ud800", "q=%26%2355296%3B%26%2355296%3B"],
     18  // Don't allow < or > because sometimes they are used for XSS if the
     19  // URL is echoed in content. Firefox does this, IE doesn't.
    1120  ["q=<asdf>", "q=%3Casdf%3E"],
     21  // Escape double quotemarks in the query.
    1222  ["q=\"asdf\"", "q=%22asdf%22"],
    1323];
  • trunk/LayoutTests/fast/url/script-tests/standard-url.js

    r57585 r57712  
    44  ["http://www.google.com/foo?bar=baz#", "http://www.google.com/foo?bar=baz#"],
    55  ["http://[www.google.com]/", "http://[www.google.com]/"],
    6   ["ht\ttp:@www.google.com:80/;p?#", "ht%09tp://www.google.com:80/;p?#"],
     6  // Disabled because whitespace gets treated different in this API.
     7  // ["ht\ttp:@www.google.com:80/;p?#", "ht%09tp://www.google.com:80/;p?#"],
    78  ["http:////////user:@google.com:99?foo", "http://user@google.com:99/?foo"],
    89  // Disabled because this gets treated as a relative URL.
     
    1516  ["http:\\\\\\\\www.google.com\\\\foo", "http://www.google.com/foo"],
    1617  // Busted refs shouldn't make the whole thing fail.
    17   ["http://www.google.com/asdf#\xc2", "http://www.google.com/asdf#\xef\xbf\xbd"],
     18  ["http://www.google.com/asdf#\\ud800", "http://www.google.com/asdf#\\uFFFD"],
    1819  // Basic port tests.
    1920  ["http://foo:80/", "http://foo/"],
  • trunk/LayoutTests/fast/url/script-tests/trivial.js

    r57489 r57712  
    11description("Test basic features of URL canonicalization");
    2 
    3 function canonicalize(url) {
    4   var a = document.createElement("a");
    5   a.href = url;
    6   return a.href;
    7 }
    82
    93cases = [
    104  ["http://example.com/", "http://example.com/"],
    11   ["/", "file:///"],
     5  ["/", "http://example.org/"]
    126];
     7
     8var originalBaseURL = canonicalize(".");
     9setBaseURL("http://example.org/foo/bar");
    1310
    1411for (var i = 0; i < cases.length; ++i) {
     
    1714}
    1815
     16setBaseURL(originalBaseURL);
     17
    1918var successfullyParsed = true;
  • trunk/LayoutTests/fast/url/standard-url-expected.txt

    r57585 r57712  
    66PASS canonicalize('http://www.google.com/foo?bar=baz#') is 'http://www.google.com/foo?bar=baz#'
    77PASS canonicalize('http://[www.google.com]/') is 'http://[www.google.com]/'
    8 FAIL canonicalize('ht   tp:@www.google.com:80/;p?#') should be ht%09tp://www.google.com:80/;p?#. Was http:@www.google.com:80/;p?#.
    98FAIL canonicalize('http:////////user:@google.com:99?foo') should be http://user@google.com:99/?foo. Was http://////user:@google.com:99?foo.
    109FAIL canonicalize('http://192.0x00A80001') should be http://192.168.0.1/. Was http://192.0x00A80001/.
     
    1312PASS canonicalize('http://%25DOMAIN:foobar@foodomain.com/') is 'http://%25DOMAIN:foobar@foodomain.com/'
    1413PASS canonicalize('http:\\\\www.google.com\\foo') is 'http://www.google.com/foo'
    15 FAIL canonicalize('http://www.google.com/asdf#Â') should be http://www.google.com/asdf#�. Was http://www.google.com/asdf#%C2.
     14FAIL canonicalize('http://www.google.com/asdf#\ud800') should be http://www.google.com/asdf#�. Was http://www.google.com/asdf#%26%2355296%3B.
    1615FAIL canonicalize('http://foo:80/') should be http://foo/. Was http://foo:80/.
    1716PASS canonicalize('http://foo:81/') is 'http://foo:81/'
  • trunk/LayoutTests/fast/url/trivial-expected.txt

    r57489 r57712  
    55
    66PASS canonicalize('http://example.com/') is 'http://example.com/'
    7 PASS canonicalize('/') is 'file:///'
     7PASS canonicalize('/') is 'http://example.org/'
    88PASS successfullyParsed is true
    99
Note: See TracChangeset for help on using the changeset viewer.