From 0798b0f17c2aa028f4ced601d31fb5ec65347a96 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 25 May 2021 15:00:01 +0200 Subject: [PATCH] Editorial: make WebSocket use obtain a connection On closer inspection "obtain a WebSocket connection" does not appear to do anything that "obtain a connection" does not do, especially now the latter has a dedicated argument. This brings "obtain a connection" closer to the goal of covering all web platform connections and a being a policy-enforcement point for them. --- fetch.bs | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/fetch.bs b/fetch.bs index 709127dd4..55e0b8971 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1571,8 +1571,7 @@ to not have to set request's referrer.
This is a special mode used only when navigating between documents.
"websocket" -
This is a special mode used only when establishing - a WebSocket connection. +
This is a special mode used for the WebSocket API.

Even though the default request mode is "no-cors", @@ -5074,21 +5073,14 @@ optional boolean forceNewConnection (default false), run these steps:

  • Let networkPartitionKey be the result of determining the network partition key given request. -

  • -

    Switch on request's mode: - -

    -
    "websocket" -

    Let connection be the result of - obtaining a WebSocket connection, given - request's current URL. +

  • Let dedicatedConnection be true if request's mode + is "websocket"; otherwise false. -

    Otherwise -

    Let connection be the result of - obtaining a connection, given networkPartitionKey, - request's current URL's origin, - includeCredentials, and forceNewConnection. -

  • +
  • Let connection be the result of + obtaining a connection, given networkPartitionKey, + request's current URL's origin, + includeCredentials, forceNewConnection, and with + dedicated set to dedicatedConnection.

  • Set timingInfo's final connection timing info to the result of calling clamp and coarsen connection timing info with connection's @@ -7425,32 +7417,6 @@ fetch("https://www.example.com/") -

    Connections

    - -

    To obtain a WebSocket connection, given a -url, run these steps: - -

      -
    1. Let host be url's host. - -

    2. Let port be url's port. - -

    3. Let secure be false, if url's scheme is - "http", and true otherwise. - -

    4. Follow the requirements stated in step 2 to 5, inclusive, of the first set of steps in - section 4.1 of The WebSocket Protocol - to establish a WebSocket connection. - [[!WSP]] - -

    5. If that established a connection, return it, and return failure otherwise. -

    - -

    Although structured a little differently, carrying different properties, and -therefore not shareable, a WebSocket connection is very close to identical to an "ordinary" -connection. - -

    Opening handshake

    To establish a WebSocket connection, given a