Changeset 52402 in webkit


Ignore:
Timestamp:
Dec 19, 2009 11:36:50 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-12-19 Adam Barth <abarth@webkit.org>

No review, rolling out r52399.
http://trac.webkit.org/changeset/52399

  • websocket/tests/bad-sub-protocol-expected.txt:
  • websocket/tests/script-tests/url-parsing.js:
  • websocket/tests/url-parsing-expected.txt:

2009-12-19 Adam Barth <abarth@webkit.org>

No review, rolling out r52399.
http://trac.webkit.org/changeset/52399

  • websockets/WebSocket.cpp: (WebCore::WebSocket::connect):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r52401 r52402  
     12009-12-19  Adam Barth  <abarth@webkit.org>
     2
     3        No review, rolling out r52399.
     4        http://trac.webkit.org/changeset/52399
     5
     6        * websocket/tests/bad-sub-protocol-expected.txt:
     7        * websocket/tests/script-tests/url-parsing.js:
     8        * websocket/tests/url-parsing-expected.txt:
     9
    1102009-12-19  Adam Barth  <abarth@webkit.org>
    211
  • trunk/LayoutTests/websocket/tests/bad-sub-protocol-expected.txt

    r52399 r52402  
    1 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket
    2 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket
    3 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket   
    4 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket
    5 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket 
    6 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket €
    7 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket あ
    8 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket ￿
    9 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket
    10 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket ￾
    11 CONSOLE MESSAGE: line 0: Wrong protocol for WebSocket 𠀋
    121Test WebSocket bad sub-protocol names.
    132
  • trunk/LayoutTests/websocket/tests/script-tests/url-parsing.js

    r52399 r52402  
    11description("Test WebSocket URL parsing.");
    2 
    3 // Invalid url will fail to be parsed.
    4 shouldThrow('new WebSocket("ws://javascript:a")');
    52
    63// Can't use relative URLs - because spec says so, and because the scheme is different anyway.
    74shouldThrow('new WebSocket("/applet")');
    85
    9 // Non ws URL is not allowed.
    10 shouldThrow('new WebSocket("javascript:a")');
    11 
    126// UA is allowed to block access to some ports, which we do.
    137shouldThrow('new WebSocket("ws://127.0.0.1:25/")');
    148
    15 // Resolve the url string using the resolve a Web address algorithm.
    16 // Use 127.0.0.1:8880 and existing ws handler to make sure we don't receive unexpected response (so no console message appears)
    17 shouldBe('(new WebSocket("ws://127.0.0.1:8880/a/../websocket/tests/simple")).URL', '"ws://127.0.0.1:8880/websocket/tests/simple"');
    18 shouldBe('(new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple?")).URL', '"ws://127.0.0.1:8880/websocket/tests/simple?"');
    19 shouldBe('(new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple?k=v")).URL', '"ws://127.0.0.1:8880/websocket/tests/simple?k=v"');
     9// This is what we currently do, but not what the spec says (as of Editor's Draft 1 December 2009).
     10shouldBe('(new WebSocket("ws://127.0.0.1/a/../")).URL', '"ws://127.0.0.1/"');
     11
     12shouldBe('(new WebSocket("ws://127.0.0.1/path?")).URL', '"ws://127.0.0.1/path?"');
     13shouldBe('(new WebSocket("ws://127.0.0.1/path?k=v")).URL', '"ws://127.0.0.1/path?k=v"');
    2014
    2115// draft-hixie-thewebsocketprotocol-60 says If /url/ has a <fragment>
  • trunk/LayoutTests/websocket/tests/url-parsing-expected.txt

    r52399 r52402  
    1 CONSOLE MESSAGE: line 0: Invalid url for WebSocket ws://javascript:a
    2 CONSOLE MESSAGE: line 0: Wrong url scheme for WebSocket http://127.0.0.1:8880/applet
    3 CONSOLE MESSAGE: line 0: Wrong url scheme for WebSocket javascript:a
    4 CONSOLE MESSAGE: line 0: WebSocket port 25 blocked
    5 CONSOLE MESSAGE: line 0: URL has fragment component ws://127.0.0.1/path#
    6 CONSOLE MESSAGE: line 0: URL has fragment component ws://127.0.0.1/path#fragment
    71Test WebSocket URL parsing.
    82
    93On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    104
    11 PASS new WebSocket("ws://javascript:a") threw exception Error: SYNTAX_ERR: DOM Exception 12.
    125PASS new WebSocket("/applet") threw exception Error: SYNTAX_ERR: DOM Exception 12.
    13 PASS new WebSocket("javascript:a") threw exception Error: SYNTAX_ERR: DOM Exception 12.
    146PASS new WebSocket("ws://127.0.0.1:25/") threw exception Error: SECURITY_ERR: DOM Exception 18.
    15 PASS (new WebSocket("ws://127.0.0.1:8880/a/../websocket/tests/simple")).URL is "ws://127.0.0.1:8880/websocket/tests/simple"
    16 PASS (new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple?")).URL is "ws://127.0.0.1:8880/websocket/tests/simple?"
    17 PASS (new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple?k=v")).URL is "ws://127.0.0.1:8880/websocket/tests/simple?k=v"
     7PASS (new WebSocket("ws://127.0.0.1/a/../")).URL is "ws://127.0.0.1/"
     8PASS (new WebSocket("ws://127.0.0.1/path?")).URL is "ws://127.0.0.1/path?"
     9PASS (new WebSocket("ws://127.0.0.1/path?k=v")).URL is "ws://127.0.0.1/path?k=v"
    1810PASS new WebSocket("ws://127.0.0.1/path#") threw exception Error: SYNTAX_ERR: DOM Exception 12.
    1911PASS new WebSocket("ws://127.0.0.1/path#fragment") threw exception Error: SYNTAX_ERR: DOM Exception 12.
  • trunk/WebCore/ChangeLog

    r52401 r52402  
     12009-12-19  Adam Barth  <abarth@webkit.org>
     2
     3        No review, rolling out r52399.
     4        http://trac.webkit.org/changeset/52399
     5
     6        * websockets/WebSocket.cpp:
     7        (WebCore::WebSocket::connect):
     8
    192009-12-19  Adam Barth  <abarth@webkit.org>
    210
  • trunk/WebCore/websockets/WebSocket.cpp

    r52399 r52402  
    102102    m_protocol = protocol;
    103103
    104     if (!m_url.isValid()) {
    105         scriptExecutionContext()->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Invalid url for WebSocket " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString());
     104    if (!m_url.protocolIs("ws") && !m_url.protocolIs("wss")) {
     105        LOG(Network, "Wrong url scheme for WebSocket %s", url.string().utf8().data());
    106106        m_state = CLOSED;
    107107        ec = SYNTAX_ERR;
    108108        return;
    109109    }
    110 
    111     if (!m_url.protocolIs("ws") && !m_url.protocolIs("wss")) {
    112         scriptExecutionContext()->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Wrong url scheme for WebSocket " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString());
     110    if (m_url.hasFragmentIdentifier()) {
     111        LOG(Network, "URL has fragment component %s", url.string().utf8().data());
    113112        m_state = CLOSED;
    114113        ec = SYNTAX_ERR;
    115114        return;
    116115    }
    117     if (m_url.hasFragmentIdentifier()) {
    118         scriptExecutionContext()->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "URL has fragment component " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString());
     116    if (!isValidProtocolString(m_protocol)) {
     117        LOG(Network, "Wrong protocol for WebSocket %s", m_protocol.utf8().data());
    119118        m_state = CLOSED;
    120119        ec = SYNTAX_ERR;
    121120        return;
    122121    }
    123     if (!isValidProtocolString(m_protocol)) {
    124         scriptExecutionContext()->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Wrong protocol for WebSocket " + m_protocol, 0, scriptExecutionContext()->securityOrigin()->toString());
    125         m_state = CLOSED;
    126         ec = SYNTAX_ERR;
    127         return;
    128     }
    129122    if (!portAllowed(url)) {
    130         scriptExecutionContext()->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket port %d blocked", url.port()), 0, scriptExecutionContext()->securityOrigin()->toString());
     123        LOG(Network, "WebSocket port %d blocked", url.port());
    131124        m_state = CLOSED;
    132125        ec = SECURITY_ERR;
Note: See TracChangeset for help on using the changeset viewer.