--- wsapi.html 2012-07-10 22:38:35.000000000 +0100 +++ ws.html 2012-07-11 19:20:05.712293700 +0100 @@ -507,7 +507,7 @@

4 The WebSocket interface

[Constructor(DOMString url, optional (DOMString or DOMString[]) protocols)]
-interface WebSocket : EventTarget {
+interface WebSocket : EventTarget {
   readonly attribute DOMString url;
 
   // ready state
@@ -519,23 +519,23 @@
   readonly attribute unsigned long bufferedAmount;
 
   // networking
-           attribute EventHandler onopen;
-           attribute EventHandler onerror;
-           attribute EventHandler onclose;
+           attribute EventHandler onopen;
+           attribute EventHandler onerror;
+           attribute EventHandler onclose;
   readonly attribute DOMString extensions;
   readonly attribute DOMString protocol;
   void close([Clamp] optional unsigned short code, optional DOMString reason);
 
   // messaging
-           attribute EventHandler onmessage;
+           attribute EventHandler onmessage;
            attribute DOMString binaryType;
   void send(DOMString data);
   void send(ArrayBufferView data);
-  void send(Blob data);
+  void send(Blob data);
 };

The WebSocket(url, protocols) - constructor takes one or two arguments. The first argument, url, specifies the URL to which to + constructor takes one or two arguments. The first argument, url, specifies the URL to which to connect. The second, protocols, if present, is either a string or an array of strings. If it is a string, it is equivalent to an array consisting of just that string; if it is @@ -555,7 +555,7 @@ SyntaxError exception and abort these steps. [WSP]

  • If secure is false but the - origin of the entry script has a scheme + origin of the entry script has a scheme component that is itself a secure protocol, e.g. HTTPS, then throw a SecurityError exception.

  • @@ -594,8 +594,8 @@
  • Let origin be the ASCII serialization of the - origin of the entry script, - converted to ASCII lowercase.

  • + origin of the entry script, + converted to ASCII lowercase.
  • Return a new WebSocket object, and continue these steps in the background (without blocking scripts).

  • @@ -633,15 +633,15 @@ -

    This constructor must be visible when the script's global - object is either a Window object or an object +

    This constructor must be visible when the script's global + object is either a Window object or an object implementing the WorkerUtils interface.


    The url attribute must return the result of resolving the URL that was passed to the + url">resolving the URL that was passed to the constructor. (It doesn't matter what it is resolved relative to, - since we already know it is an absolute URL.)

    + since we already know it is an absolute URL.)

    The readyState attribute represents the state of the connection. It can have the @@ -792,7 +792,7 @@


    The bufferedAmount attribute must return the number of bytes of application data (UTF-8 text and binary data) that have been queued using send() but that, as of the last - time the event loop started executing a task, had not yet been transmitted to + time the event loop started executing a task, had not yet been transmitted to the network. (This thus includes any text sent during the execution of the current task, regardless of whether the user agent is able to transmit text asynchronously with script execution.) This does not @@ -920,12 +920,12 @@ -


    The following are the event handlers (and their - corresponding event handler - event types) that must be supported, as IDL attributes, by +


    The following are the event handlers (and their + corresponding event handler + event types) that must be supported, as IDL attributes, by all objects implementing the WebSocket interface:

    -
    Event handler Event handler event type +
    Event handler Event handler event type
    onopen open
    onmessage message
    onerror error @@ -933,7 +933,7 @@

    5 Feedback from the protocol

    When the WebSocket connection is established, the user - agent must queue a task to run these steps:

    + agent must queue a task to run these steps:

    1. Change the readyState attribute's value to OPEN (1).

    2. @@ -949,11 +949,11 @@ of the cookies set during the server's opening handshake, for the URL url given to the WebSocket() constructor. [COOKIES] [RFC3629] [WSP] -
    3. Fire a simple event named open at the WebSocket +

    4. Fire a simple event named open at the WebSocket object.


    When a WebSocket message has been received with type type and data data, the user - agent must queue a task to follow these steps: [WSP]

    + agent must queue a task to follow these steps: [WSP]

    1. @@ -977,8 +977,8 @@
    2. Initialize event's origin attribute to the Unicode - serialization of the origin of the - URL that was passed to the WebSocket + serialization of the origin of the + URL that was passed to the WebSocket object's constructor.

    3. @@ -1036,7 +1036,7 @@

      When the WebSocket closing handshake is started, the user - agent must queue a task to change the readyState attribute's value + agent must queue a task to change the readyState attribute's value to CLOSING (2). (If the close() method was called, the readyState @@ -1045,7 +1045,7 @@


      When the WebSocket connection is closed, possibly cleanly, the user agent must - queue a task to run the following substeps:

      + queue a task to run the following substeps:

      1. Change the readyState attribute's value to CLOSED @@ -1053,7 +1053,7 @@

      2. If the user agent was required to fail the websocket connection or the WebSocket connection is closed with prejudice, - fire a simple event named error + fire a simple event named error at the WebSocket object. [WSP]

      3. Create an event that uses the CloseEvent @@ -1064,10 +1064,10 @@ attribute is initialized to the WebSocket connection close code, and whose reason attribute is initialized to the WebSocket connection close reason - decoded as UTF-8, with error handling, and dispatch + decoded as UTF-8, with error handling, and dispatch the event at the WebSocket object. [WSP]

      4. -

      The task source for all tasks task source for all tasks queued in this section is the WebSocket task source.

      @@ -1098,7 +1098,7 @@ flag, or they fail.

      1. If the url string is not an - absolute URL, then fail this algorithm.

      2. + absolute URL, then fail this algorithm.
      3. @@ -1106,13 +1106,13 @@ UTF-8. [RFC3629]

        It doesn't matter what it is resolved relative to, - since we already know it is an absolute URL at this + since we already know it is an absolute URL at this point.

      4. If url does not have a <scheme> component whose value, - when converted to ASCII lowercase, is either "ws" or "wss", then fail this + when converted to ASCII lowercase, is either "ws" or "wss", then fail this algorithm.

      5. If url has a <fragment> component, then fail @@ -1123,8 +1123,8 @@ set secure to false; otherwise, the <scheme> component is "wss", set secure to true.

      6. -
      7. Let host be the value of the <host> component of url, converted to ASCII - lowercase.

      8. +
      9. Let host be the value of the <host> component of url, converted to ASCII + lowercase.

      10. If url has a <port> component, then let port be that component's value; otherwise, there is no explicit port.

      11. @@ -1150,13 +1150,13 @@

      8 Event definitions

      [Constructor(DOMString type, optional CloseEventInit eventInitDict)]
      -interface CloseEvent : Event {
      +interface CloseEvent : Event {
         readonly attribute boolean wasClean;
         readonly attribute unsigned short code;
         readonly attribute DOMString reason;
       };
       
      -dictionary CloseEventInit : EventInit {
      +dictionary CloseEventInit : EventInit {
         boolean wasClean;
         unsigned short code;
         DOMString reason;
      @@ -1185,19 +1185,19 @@
       
         

      A WebSocket object whose readyState attribute's value was set to CONNECTING - (0) as of the last time the event loop started + (0) as of the last time the event loop started executing a task must not be garbage collected if there are any event listeners registered for open events, message events, error events, or close events.

      A WebSocket object whose readyState attribute's value was set to OPEN (1) as of - the last time the event loop started executing a task must not be garbage collected if + the last time the event loop started executing a task must not be garbage collected if there are any event listeners registered for message events, error, or close events.

      A WebSocket object whose readyState attribute's value was set to CLOSING (2) as - of the last time the event loop started executing a + of the last time the event loop started executing a task must not be garbage collected if there are any event listeners registered for error or close events.