From 318a7b792a8525ef18647993081c850e9fdef87c Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 15 Mar 2021 18:21:03 -0400 Subject: [PATCH] Compute "allowed to download" synchronously in navigation Helps with #1130 by removing a deep-in-the-algorithm-tree usage of source browsing context. Does not take care of #5597, but fixes the actual problems posed by the current architecture. --- source | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/source b/source index 4f65de00e0d..d4d0542dd8b 100644 --- a/source +++ b/source @@ -84617,6 +84617,10 @@ interface Location { // but see also container.

+
  • Let allowedToDownload be the result of running the allowed to + download algorithm given the source browsing context and + browsingContext.

  • +
  • Return to whatever algorithm invoked the navigation steps and continue running these steps in parallel.

  • @@ -84670,8 +84674,8 @@ interface Location { // but see also
    history handling is historyHandling.

    -
  • Run process a navigate response with navigationType, the - source browsing context, and navigationParams.

  • +
  • Run process a navigate response with navigationType, + allowedToDownload, and navigationParams.

  • @@ -84721,8 +84725,8 @@ interface Location { // but see also
    history handling is historyHandling.

    -
  • Run process a navigate response with navigationType, the - source browsing context, and navigationParams.

  • +
  • Run process a navigate response with navigationType, + allowedToDownload, and navigationParams.

  • So for example a fetch scheme

    Run process a navigate fetch given resource, the source browsing context, browsingContext, navigationType, - sandboxFlags, incumbentNavigationOrigin, + sandboxFlags, allowedToDownload, incumbentNavigationOrigin, activeDocumentNavigationOrigin, and historyHandling.

    Otherwise, resource is a request whose @@ -84757,10 +84761,10 @@ interface Location { // but see also request request, two browsing contexts sourceBrowsingContext and browsingContext, - a string navigationType, a sandboxing flag set sandboxFlags, - two origins incumbentNavigationOrigin and - activeDocumentNavigationOrigin, and a history handling behavior - historyHandling:

    + a string navigationType, a sandboxing flag set sandboxFlags, a + boolean allowedToDownload, two origins + incumbentNavigationOrigin and activeDocumentNavigationOrigin, and a + history handling behavior historyHandling:

    1. Let response be null.

    2. @@ -84993,7 +84997,7 @@ interface Location { // but see also
      request whose url is locationURL, sourceBrowsingContext, browsingContext, navigationType, - sandboxFlags, incumbentNavigationOrigin, + allowedToDownload, sandboxFlags, incumbentNavigationOrigin, activeDocumentNavigationOrigin, and historyHandling, and return.
    3. Otherwise, if locationURL is a URL, run the process a @@ -85015,12 +85019,12 @@ interface Location { // but see also history handling is historyHandling.

    4. -
    5. Run process a navigate response with navigationType, the - source browsing context, and navigationParams.

    6. +
    7. Run process a navigate response with navigationType, + allowedToDownload, and navigationParams.

    To process a navigate response, given a string navigationType, a - browsing context source, and a navigation params + boolean allowedToDownload, and a navigation params navigationParams:

      @@ -85087,8 +85091,7 @@ interface Location { // but see also attachment disposition type, then:

        -
      1. If the result of running the allowed to download given source - and browsingContext is true, then handle response as a +

      2. If allowedToDownload is true, then handle response as a download.

      3. Return.