From 7c6312a4cc4bc07e62db8d1d626c7bcb8ef4f5ca Mon Sep 17 00:00:00 2001 From: shivanigithub Date: Mon, 27 Apr 2020 07:00:23 -0400 Subject: [PATCH] Redo top-level origin and add top-level creation URL An environment's top-level origin is null during the initial navigation (before the response arrived) and otherwise represents the origin of the top-level document. It is currently implementation-defined for non-dedicated workers, but hopefully that can be sorted soon. An environment's top-level creation URL is the URL of the top-level document. It is null for workers as they do not need the concept. Needed for https://github.com/whatwg/fetch/pull/943 and #5558. --- source | 245 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 145 insertions(+), 100 deletions(-) diff --git a/source b/source index 2d7a9a5c5e0..d93017910c2 100644 --- a/source +++ b/source @@ -76539,10 +76539,11 @@ popup4.close();
  • Let topLevelOrigin be origin if embedder is null; otherwise embedder's relevant settings object's top-level origin.

  • +
  • Let settingsObject be the result of setting up a window environment settings object given realm - execution context and topLevelOrigin.

  • + settings object">setting up a window environment settings object with realm execution + context and null.

  • Let document be a new Document, marked as an HTML document in quirks mode, whose BarProp {

    Script settings for Window objects

    -

    When the user agent is required to set up a window environment settings object, - given a JavaScript execution context execution context, a - top-level origin top-level origin, and an optional - environment reserved environment, it must run the following steps:

    +

    To set up a window environment settings object, given a JavaScript execution + context execution context and null or an environment + reservedEnvironment, run these steps:

    1. Let realm be the value of execution context's Realm @@ -78669,11 +78669,6 @@ interface BarProp { data-x="concept-document-window">associated Document.

      -
      The top-level origin
      -
      -

      Return top-level origin.

      -
      -
      The HTTPS state

      Return the HTTPS state of @@ -78701,23 +78696,20 @@ interface BarProp {

    2. -

      If reserved environment is given, then:

      +

      If reservedEnvironment is non-null, then:

      1. Set settings object's id to - reserved environment's id, - settings object's creation - URL to reserved environment's creation URL, settings object's - target browsing context to - reserved environment's reservedEnvironment's id, settings + object's target browsing + context to reservedEnvironment's target browsing context, and settings object's active - service worker to reserved environment's to reservedEnvironment's active service worker.

      2. -

        Set reserved environment's id to +

        Set reservedEnvironment's id to the empty string.

        The identity of the reserved environment is considered to be fully @@ -78736,6 +78728,17 @@ interface BarProp { settings object's active service worker to null.

      3. +
      4. +

        Set settings object's creation + URL to url, settings object's top-level creation URL + to url, and settings object's top-level origin to + window's associated + Document's origin.

        + +

        The latter two are overridden by create a new nested browsing + context.

        +
      5. +
      6. Set realm's [[HostDefined]] field to settings object.

      7. Return settings object.

      8. @@ -81641,8 +81644,8 @@ interface Location { // but see also response

        Run process a navigate response with null, resource, navigationType, the source browsing context, - browsingContext, sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin.

        + browsingContext, sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and null.

        If resource is a request whose url's scheme @@ -81660,7 +81663,7 @@ interface Location { // but see also So for example a

        +
      9. Set reservedEnvironment's top-level creation URL to + currentURL and reservedEnvironment's top-level origin to + null.

      10. + +
      11. +

        If browsingContext is not a top-level browsing context, then:

        + +
          +
        1. Let topLevelEnvironment be browsingContext's top-level + browsing context's active document's relevant settings + object.

        2. + +
        3. Set reservedEnvironment's top-level creation URL to + topLevelEnvironment's top-level creation URL and + reservedEnvironment's top-level origin to + topLevelEnvironment's top-level origin. +

        +
      12. +
      13. Set request's reserved client to reservedEnvironment.

      14. @@ -81917,7 +81939,7 @@ interface Location { // but see also
        browsing contexts source and browsingContext, a sandboxing flag set sandboxFlags, two origins incumbentNavigationOrigin and - activeDocumentNavigationOrigin, and an optional environment + activeDocumentNavigationOrigin, and null or an environment reservedEnvironment, run these steps:

          @@ -81972,15 +81994,17 @@ interface Location { // but see also HTML document section providing browsingContext, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. Once the steps have completed, return. + sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and reservedEnvironment. Once the steps + have completed, return.
          an XML MIME type that is not an explicitly supported XML MIME type
          Follow the steps given in the XML document section providing browsingContext, type, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. Once the steps have completed, return.
          + sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and reservedEnvironment. Once the steps + have completed, return.
          a JavaScript MIME type
          a JSON MIME type that is not an explicitly supported JSON MIME @@ -81991,28 +82015,32 @@ interface Location { // but see also text/vtt"
          Follow the steps given in the plain text file section providing browsingContext, type, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. Once the steps have completed, return.
          + sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and reservedEnvironment. Once the steps + have completed, return.
          "multipart/x-mixed-replace"
          Follow the steps given in the multipart/x-mixed-replace section providing browsingContext, type, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. Once the steps have completed, return.
          + sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and reservedEnvironment. Once the steps + have completed, return.
          A supported image, video, or audio type
          Follow the steps given in the media section providing browsingContext, type, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. Once the steps have completed, return.
          + sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and reservedEnvironment. Once the steps + have completed, return.
          A type that will use an external application to render the content in browsingContext
          Follow the steps given in the plugin section providing browsingContext, type, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. Once the steps have completed, return.
          + sandboxFlags, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, and reservedEnvironment. Once the steps + have completed, return.

          An explicitly supported XML MIME type is an XML MIME type for which @@ -82185,7 +82213,7 @@ interface Location { // but see also response response, a browsing context browsingContext, a sandboxing flag set sandboxFlags, two origins - incumbentNavigationOrigin, activeDocumentNavigationOrigin, and an optional + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and null or an environment reservedEnvironment:

            @@ -82244,14 +82272,8 @@ interface Location { // but see also Page load processing model for HTML files -

            When an HTML document is to be loaded in a browsing - context, provided browsingContext, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin, the user agent must queue a task on the - networking task source to:

            +

            When an HTML document is to be loaded, given a + browsingContext, request, response, sandboxFlags, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment, the user agent must queue a task on the networking task + source to:

            1. Let document be the result of creating and initializing a Document object providing "html", "text/html", request, response, browsingContext, sandboxFlags, - incumbentNavigationOrigin, and activeDocumentNavigationOrigin.

            2. + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment.

            3. Create an HTML parser and associate it with the document. Each @@ -82509,14 +82532,15 @@ new PaymentRequest(…); // Allowed to use

              When faced with displaying an XML file inline, provided browsingContext, request, response, sandboxFlags, - incumbentNavigationOrigin, and activeDocumentNavigationOrigin, user agents - must follow the requirements defined in XML and Namespaces in XML, - XML Media Types, DOM, and other relevant specifications to create and initialize a Document object - providing "xml", type, request, response, - browsingContext, sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. It must also create and a corresponding XML - parser.

              + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment, user agents must follow the requirements defined in XML and + Namespaces in XML, XML Media Types, DOM, and other relevant + specifications to create and initialize a + Document object providing "xml", type, + request, response, browsingContext, sandboxFlags, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment. It must also create and a corresponding XML parser.

              At the time of writing, the XML specification community had not actually yet specified how XML and the DOM interact.

              @@ -82560,17 +82584,19 @@ new PaymentRequest(…); // Allowed to use

              Page load processing model for text files

              -

              When a plain text document is to be loaded in a browsing context, provided - browsingContext, request, response, sandboxFlags, - incumbentNavigationOrigin, and activeDocumentNavigationOrigin, the user - agent must queue a task on the networking task source to: +

              When a plain text document is to be loaded, provided a browsingContext, + request, response, sandboxFlags, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment, the user agent must queue a task on the networking task + source to:

              1. Let document be the result of creating and initialize a Document object providing "html", type, request, response, browsingContext, sandboxFlags, - incumbentNavigationOrigin, and activeDocumentNavigationOrigin.

              2. + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment.

              3. Create an HTML parser and associate it with the document. Act as if the tokenizer had emitted a start tag token with the tag name "pre" followed by a single @@ -82637,17 +82663,18 @@ new PaymentRequest(…); // Allowed to use

                Page load processing model for media

                -

                When an image, video, or audio resource is to be loaded in a browsing context, - provided browsingContext, request, response, - sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin, the user agent should: +

                When an image, video, or audio resource is to be loaded, provided a browsingContext, + request, response, sandboxFlags, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment, the user agent should:

                1. Let document be the result of creating and initialize a Document object providing "html", type, request, response, browsingContext, sandboxFlags, - incumbentNavigationOrigin, and activeDocumentNavigationOrigin.

                2. + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment.

                3. Append an html element to document.

                4. @@ -82703,17 +82730,18 @@ new PaymentRequest(…); // Allowed to use

                  Page load processing model for content that uses plugins

                  -

                  When a resource that requires an external resource to be rendered is to be loaded in a - browsing context, provided browsingContext, request, - response, sandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin, the user agent should: +

                  When a resource that requires an external resource to be rendered is to be loaded, provided a + browsingContext, request, response, sandboxFlags, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment, the user agent should:

                  1. Let document be the result of creating and initialize a Document object providing "html", type, request, response, browsingContext, sandboxFlags, - incumbentNavigationOrigin, and activeDocumentNavigationOrigin.

                  2. + incumbentNavigationOrigin, activeDocumentNavigationOrigin, and + environment.

                  3. Mark document as being a plugin document

                  4. @@ -82758,13 +82786,13 @@ new PaymentRequest(…); // Allowed to use

                    Page load processing model for inline content that doesn't have a DOM

                    -

                    When the user agent is to display a user agent page inline in a browsing context, - the user agent should create and initialize a - Document object providing "html", "text/html", null, null, browsingContext, an empty set, null, and null, - and then either associate that Document with a custom rendering that is not rendered - using the normal Document rendering rules, or mutate that Document until - it represents the content the user agent wants to render.

                    +

                    When the user agent is to display a user agent page inline, the user agent should create and initialize a Document object + providing "html", "text/html", null, null, + browsingContext, an empty set, null, null, and null, and then either associate that + Document with a custom rendering that is not rendered using the normal + Document rendering rules, or mutate that Document until it represents + the content the user agent wants to render.

                    @@ -86117,12 +86145,12 @@ interface ApplicationCache : EventTarget {
                    An id
                    -

                    An opaque string that uniquely identifies the environment.

                    +

                    An opaque string that uniquely identifies this environment.

                    A creation URL
                    -

                    A URL record that represents the location of the resource with which the +

                    A URL record that represents the location of the resource with which this environment is associated.

                    In the case of an environment settings object, this URL might be @@ -86131,6 +86159,27 @@ interface ApplicationCache : EventTarget { history.pushState().

                    +
                    A top-level creation URL
                    +

                    Null or a URL record that represents the location of the top-level resource + either with which this environment is directly associated or is associated with a + descendant thereof. It is null for workers and worklets.

                    + +
                    A top-level origin
                    +
                    +

                    An implementation-defined value (for non-dedicated workers), null, or an + origin. For a top-level navigation + request, it is null. Otherwise it is the origin of the target browsing context's + top-level browsing context's active document at the time this + environment was set up.

                    + +

                    This is distinct from the top-level creation URL's origin when sandboxing, workers, and worklets are + involved.

                    +
                    +
                    A target browsing context

                    Null or a target browsing context for a ApplicationCache : EventTarget {

                    An origin used in security checks.

                    -
                    A top-level origin
                    - -
                    -

                    The origin of the top-level browsing context at the time - this settings object was set up.

                    -
                    -
                    An HTTPS state

                    An HTTPS state value representing the security properties of the network @@ -98361,16 +98403,6 @@ interface SharedWorkerGlobalScope : WorkerGlobalScope { origin otherwise.

                    -
                    The top-level origin
                    -
                    -

                    Return outside settings's top-level origin for a dedicated - worker.

                    - -

                    For shared and service workers this is still undefined and is being worked on, - since such workers could be associated with multiple top-level browsing contexts.

                    -
                    -
                    The HTTPS state

                    Return worker global scope's SharedWorkerGlobalScope : WorkerGlobalScope {

                  5. Set settings object's id to a new unique opaque string, settings object's creation URL to worker global - scope's url, settings object's 's url, settings object's top-level creation URL + to null, settings object's target browsing context to null, and settings object's active service worker to null.

                  6. +
                  7. If worker global scope is a DedicatedWorkerGlobalScope object, + then set settings object's top-level origin to outside + settings's top-level origin.

                  8. + +
                  9. +

                    Otherwise, set settings object's top-level origin to an + implementation-defined value.

                    + +

                    See Client-Side + Storage Partitioning for the latest on properly defining this.

                    +
                  10. +
                  11. Set realm's [[HostDefined]] field to settings object.

                  12. Return settings object.