⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 94057 in webkit


Ignore:
Timestamp:
Aug 30, 2011, 1:02:59 AM (15 years ago)
Author:
commit-queue@webkit.org
Message:

[WebSocket] Prevent unnecessary pywebsocket warnings on layout tests.
https://bugs.webkit.org/show_bug.cgi?id=67182

Patch by Takashi Toyoshima <toyoshim@chromium.org> on 2011-08-30
Reviewed by Kent Tamura.

Some layout tests for WebSocket raised Exception to prevent unnecessary
pywebsocket warning. But it doesn't work any more on pywebsocket 0.6b4.
Now pywebsocket support AbortedByUserException to prevent warning.
This change make raise AbortedByUserException instead of Exception.

handshake-fail-by-prepended-null_wsh.py didn't use Exception, but
expected abnormal closure on sending response could raise unexpected
Exception by chance. This change also takes care of it.

  • http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py:
  • http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py:
  • http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py:
  • http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py:
  • http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py:
  • http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py:
  • http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py:
  • http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py:
  • http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py:
  • http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py:
  • http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py:
  • http/tests/websocket/tests/hybi/long-invalid-header_wsh.py:
  • http/tests/websocket/tests/hybi/masked-frames_wsh.py:

Use AbortedByUserException instead of Exception.

Location:
trunk/LayoutTests
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94052 r94057  
     12011-08-30  Takashi Toyoshima  <toyoshim@chromium.org>
     2
     3        [WebSocket] Prevent unnecessary pywebsocket warnings on layout tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=67182
     5
     6        Reviewed by Kent Tamura.
     7
     8        Some layout tests for WebSocket raised Exception to prevent unnecessary
     9        pywebsocket warning. But it doesn't work any more on pywebsocket 0.6b4.
     10        Now pywebsocket support AbortedByUserException to prevent warning.
     11        This change make raise AbortedByUserException instead of Exception.
     12
     13        handshake-fail-by-prepended-null_wsh.py didn't use Exception, but
     14        expected abnormal closure on sending response could raise unexpected
     15        Exception by chance. This change also takes care of it.
     16
     17        * http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py:
     18        * http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py:
     19        * http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py:
     20        * http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py:
     21        * http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py:
     22        * http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py:
     23        * http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py:
     24        * http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py:
     25        * http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py:
     26        * http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py:
     27        * http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py:
     28        * http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py:
     29        * http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py:
     30        * http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py:
     31        * http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py:
     32        * http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py:
     33        * http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py:
     34        * http/tests/websocket/tests/hybi/long-invalid-header_wsh.py:
     35        * http/tests/websocket/tests/hybi/masked-frames_wsh.py:
     36        Use AbortedByUserException instead of Exception.
     37
    1382011-08-29  Takashi Toyoshima  <toyoshim@chromium.org>
    239
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    msg = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
     
    1013    request.connection.write(msg)
    1114    print msg
    12     raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
     15    raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
    1316
    1417
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    pass
     
    912    msg += "\0should be skipped\xff"
    1013    request.connection.write(msg)
    11     raise Exception("Abort the connection") # Prevents pywebsocket from starting closing handshake.
     14    raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from starting closing handshake.
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    pass
     
    69    msg = 16 * '\xff'
    710    request.connection.write(msg)
    8     raise Exception('Abort the connection') # Prevents pywebsocket from starting closing handshake.
     11    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from starting closing handshake.
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py

    r90445 r94057  
    2121
    2222
     23from mod_pywebsocket import handshake
     24
     25
    2326def web_socket_do_extra_handshake(request):
    2427    # This will cause the handshake to fail because it pushes the length of the
     
    3336    msg += request.ws_challenge_md5
    3437    request.connection.write(msg)
    35     raise Exception('abort the connection') # Prevents pywebsocket from sending its own handshake message.
     38    raise handshake.AbortedByUserException('abort the connection') # Prevents pywebsocket from sending its own handshake message.
    3639
    3740
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    msg = 'HTTP/1.1 101 WebSocket Protocol Handshake\r\n'
     
    912    request.connection.write(msg)
    1013    print msg
    11     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     14    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1215
    1316
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    msg = 'HTTP/1.1 101 WebSocket Protocol Handshake\n' # Does not end with "\r\n".
     
    912    request.connection.write(msg)
    1013    print msg
    11     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     14    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1215
    1316
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    msg = 'HTTP/1.1 101 WebSocket Protocol Handshake\r\n'
     
    912    request.connection.write(msg)
    1013    print msg
    11     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     14    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1215
    1316
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py

    r90445 r94057  
    2121
    2222import time
     23from mod_pywebsocket import handshake
    2324
    2425
     
    4546        numFrames = 1024 / len(frame) # write over 1024 bytes including the above handshake
    4647        for i in range(0, numFrames):
    47             request.connection.write(frame)
     48            try:
     49                request.connection.write(frame)
     50            except Exception, e:
     51                raise handshake.AbortedByUserException(e)
    4852
    4953
  • trunk/LayoutTests/http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py

    r90445 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    msg = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
     
    58    msg += request.ws_challenge_md5
    69    request.connection.write(msg)
    7     raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
     10    raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
    811
    912
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py

    r91052 r94057  
     1from mod_pywebsocket import handshake
    12from mod_pywebsocket.handshake.hybi import compute_accept
    23
     
    1112    request.connection.write(msg)
    1213    print msg
    13     raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
     14    raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
    1415
    1516
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py

    r91052 r94057  
     1from mod_pywebsocket import handshake
    12from mod_pywebsocket.handshake.hybi import compute_accept
    23
     
    1011    message += '\r\n'
    1112    request.connection.write(message)
    12     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     13    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1314
    1415
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py

    r91052 r94057  
    2121
    2222
     23from mod_pywebsocket import handshake
    2324from mod_pywebsocket.handshake.hybi import compute_accept
    2425
     
    3435    msg += '\r\n'
    3536    request.connection.write(msg)
    36     raise Exception('abort the connection') # Prevents pywebsocket from sending its own handshake message.
     37    raise handshake.AbortedByUserException('abort the connection') # Prevents pywebsocket from sending its own handshake message.
    3738
    3839
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py

    r90979 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    message = 'HTTP/1.1 101 Switching Protocols\r\n'
     
    58    message += '\r\n'
    69    request.connection.write(message)
    7     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     10    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    811
    912
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py

    r91052 r94057  
     1from mod_pywebsocket import handshake
    12from mod_pywebsocket.handshake.hybi import compute_accept
    23
     
    1011    request.connection.write(msg)
    1112    print msg
    12     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     13    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1314
    1415
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py

    r91052 r94057  
     1from mod_pywebsocket import handshake
    12from mod_pywebsocket.handshake.hybi import compute_accept
    23
     
    1011    request.connection.write(msg)
    1112    print msg
    12     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     13    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1314
    1415
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py

    r91052 r94057  
     1from mod_pywebsocket import handshake
    12from mod_pywebsocket.handshake.hybi import compute_accept
    23
     
    1011    request.connection.write(msg)
    1112    print msg
    12     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     13    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    1314
    1415
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py

    r90979 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    message = 'HTTP/1.1 101 Switching Protocols\r\n'
     
    69    message += '\r\n'
    710    request.connection.write(message)
    8     raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
     11    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
    912
    1013
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/long-invalid-header_wsh.py

    r90979 r94057  
     1from mod_pywebsocket import handshake
     2
     3
    14def web_socket_do_extra_handshake(request):
    25    msg = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
     
    47    msg += "\r\n"
    58    request.connection.write(msg)
    6     raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
     9    raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
    710
    811
  • trunk/LayoutTests/http/tests/websocket/tests/hybi/masked-frames_wsh.py

    r91243 r94057  
    11from mod_pywebsocket import common
     2from mod_pywebsocket import handshake
    23from mod_pywebsocket import stream
    34from mod_pywebsocket import msgutil
     
    3233    request.connection.write(stream.create_close_frame('', mask=True))
    3334
    34     raise Exception('Abort the connection') # Prevents pywebsocket from starting its own closing handshake.
     35    raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from starting its own closing handshake.
Note: See TracChangeset for help on using the changeset viewer.