Reviewed by Darin Adler.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 19:16:15 +0000 (19:16 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 19:16:15 +0000 (19:16 +0000)
commitb71bac36b0c5e725894e52805449796667c64158
tree387f8f129d90272af51c65664ba57628fc20be6f
parent0041870b2e58833201ddf6244338c7b4abbd910e
    Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=32085
        WebSocket should block the same ports that are blocked for resource loading

        Test: websocket/tests/url-parsing.html

        * page/SecurityOrigin.cpp:
        (WebCore::SecurityOrigin::SecurityOrigin):
        (WebCore::SecurityOrigin::localURLSchemes):
        * page/SecurityOrigin.h:
        Move isDefaultPortForProtocol() to KURL, because that's a better place for it (SecurityOrigin
        is not even in WebCore/platform directory).

        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::host):
        (WebCore::HTMLAnchorElement::setHost):
        (WebCore::HTMLAnchorElement::setPort):
        Updated for the new location of isDefaultPortForProtocol().

        * platform/KURL.cpp:
        (WebCore::KURL::protocolIs): In an assertion, compare to "javascript" case-insensitively,
        since the function deosn't require lower case input.
        (WebCore::isDefaultPortForProtocol): Moved from SecurityOrigin.
        (WebCore::portAllowed): Moved from ResourceHandle.
        * platform/KURL.h:

        * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): Updated for the
        new location of portAllowed().

        * websockets/WebSocket.cpp: (WebCore::WebSocket::connect): Per the spec, raise a SECURITY_ERR
        if trying to connect to a blocked port.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/websocket/tests/script-tests/url-parsing.js [new file with mode: 0644]
LayoutTests/websocket/tests/url-parsing-expected.txt [new file with mode: 0644]
LayoutTests/websocket/tests/url-parsing.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLAnchorElement.cpp
WebCore/page/SecurityOrigin.cpp
WebCore/page/SecurityOrigin.h
WebCore/platform/KURL.cpp
WebCore/platform/KURL.h
WebCore/platform/network/ResourceHandle.cpp
WebCore/websockets/WebSocket.cpp