From f6ebdcdb0304f415274b5b33b8bdf8441e678fe0 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 27 Oct 2022 17:03:21 -0400 Subject: [PATCH 1/9] Allow gUM prompt ahead of focus, and deterministic "visible" enumeration wo/focus. --- getusermedia.html | 53 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/getusermedia.html b/getusermedia.html index 8943a030..4fe989ec 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -2864,17 +2864,23 @@

Methods

  • Let p be a new promise.

  • +
  • +

    Let proceed be the result of + [=device enumeration can proceed=].

    +
  • +
  • +

    Let document be the [=relevant global object=]'s + [=associated `Document`=].

    +
  • Run the following steps in parallel:

    1. - -

      Let document be the [=relevant global object=]'s - [=associated `Document`=].

      -
    2. -
    3. -

      The [=User Agent=] MUST wait to proceed to the next step until - [=device enumeration can proceed=] is true.

      +

      If proceed is `false`, the [=User Agent=] + MUST wait to proceed to the next step until a task queued + to set proceed to the result of + [=device enumeration can proceed=], sets + proceed to `true`.

    4. Let resultList be the result of @@ -3467,6 +3473,13 @@

      Methods

      feature identified by the "camera" permission name, jump to the step labeled Permission Failure below.

    5. +
    6. +

      Let inForeground be the result of the following + in the foreground algorithm, which returns `true` if + the [=relevant global object=]'s [=associated `Document`=] is + [=Document/fully active=] and its [=Document/visibility state=] + is `"visible"`.

      +
    7. Let p be a new promise.

    8. @@ -3474,10 +3487,11 @@

      Methods

      Run the following steps in parallel:

      1. -

        The [=User Agent=] MUST wait to proceed to the next step until - the [=relevant global object=]'s [=associated `Document`=] is - [=Document/fully active=] and - has focus.

        +

        If inForeground is `false`, the [=User Agent=] + MUST wait to proceed to the next step until a task queued + to set inForeground to the result of the + [=in the foreground=] algorithm, sets + inForeground to `true`.

      2. Let finalSet be an (initially) empty @@ -3596,6 +3610,16 @@

        Methods

        MUST disclose whether permission will be granted only to the device chosen, or to all devices of that kind.

        +
      3. +
      4. +

        The [=User Agent=] MUST wait to proceed to the next + step until a task queued to set systemFocus + to `true` if the [=top-level browsing context=] has + system focus, + or `false` otherwise, sets systemFocus to + `true`.

        +
      5. +
      6. Let finalCandidate be the provided media, which MUST be precisely one candidate of type kind from finalSet. The decision of which candidate to @@ -4094,11 +4118,10 @@

        Implementation Suggestions

        continuing capture in situations that may surprise users.

      7. -

        A web page without focus +

        A web page not [=in the foreground=] re-enables a track when all tracks from that source are disabled, in order to delay - resumption of capture until the page - gains focus. + resumption of capture until the page is [=in the foreground=].

      8. @@ -4114,7 +4137,7 @@

        Implementation Suggestions

        user's awareness of the earlier capture session.

      9. -

        A web page gains focus and +

        A web page comes [=in the foreground|into the foreground=] and has one or more enabled tracks that are also [= muted =].

        From 1eac1828d81c9fb98a7c4c90e9620b2c1ade4fe7 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 27 Oct 2022 17:14:08 -0400 Subject: [PATCH 2/9] Move denied check ahead of system focus requirement. --- getusermedia.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/getusermedia.html b/getusermedia.html index 4fe989ec..501e69c6 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -3611,6 +3611,13 @@

        Methods

        the device chosen, or to all devices of that kind.

      10. +
      11. +

        If the user never responds, this algorithm stalls on this step.

        +
      12. +
      13. +

        If the result of the request is {{PermissionState/"denied"}}, + jump to the step labeled Permission Failure below.

        +
      14. The [=User Agent=] MUST wait to proceed to the next step until a task queued to set systemFocus @@ -3637,13 +3644,6 @@

        Methods

        MAY allow users to use any media source, including pre-recorded media files.

      15. -
      16. -

        If the user never responds, this algorithm stalls on this step.

        -
      17. -
      18. -

        If the result of the request is {{PermissionState/"denied"}}, - jump to the step labeled Permission Failure below.

        -
      19. The result of the request is {{PermissionState/"granted"}}. If a hardware error such as an OS/program/webpage lock prevents access, From 2a7c464017c3352327007e29fae84b0debe28a35 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 2 Nov 2022 12:29:27 -0400 Subject: [PATCH 3/9] s/If/While/ to better describe the situation --- getusermedia.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getusermedia.html b/getusermedia.html index 501e69c6..382a2c39 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -2876,7 +2876,7 @@

        Methods

        Run the following steps in parallel:

        1. -

          If proceed is `false`, the [=User Agent=] +

          While proceed is `false`, the [=User Agent=] MUST wait to proceed to the next step until a task queued to set proceed to the result of [=device enumeration can proceed=], sets @@ -3487,7 +3487,7 @@

          Methods

          Run the following steps in parallel:

          1. -

            If inForeground is `false`, the [=User Agent=] +

            While inForeground is `false`, the [=User Agent=] MUST wait to proceed to the next step until a task queued to set inForeground to the result of the [=in the foreground=] algorithm, sets From e24d63fe9b430cb78efef741d4fb88a629f0d82c Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 2 Nov 2022 13:08:42 -0400 Subject: [PATCH 4/9] s/in the foreground/is in view/ and break out algorithm. --- getusermedia.html | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/getusermedia.html b/getusermedia.html index 382a2c39..4bd3f7c4 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -3129,6 +3129,15 @@

            Device information exposure

            Return {{MediaDevices/[[canExposeMicrophoneInfo]]}}.

          +

          To perform an is in view check, run the following + steps:

          +
            +
          1. +

            If the [=relevant global object=]'s [=associated `Document`=] is + [=Document/fully active=] and its [=Document/visibility state=] + is `"visible"`, return `true`. Otherwise, return `false`.

            +
          2. +

          Set device information exposure

          @@ -3474,11 +3483,8 @@

          Methods

          jump to the step labeled Permission Failure below.

        2. -

          Let inForeground be the result of the following - in the foreground algorithm, which returns `true` if - the [=relevant global object=]'s [=associated `Document`=] is - [=Document/fully active=] and its [=Document/visibility state=] - is `"visible"`.

          +

          Let isInView be the result of the + is in view algorithm.

        3. Let p be a new promise.

          @@ -3487,11 +3493,11 @@

          Methods

          Run the following steps in parallel:

          1. -

            While inForeground is `false`, the [=User Agent=] +

            While isInView is `false`, the [=User Agent=] MUST wait to proceed to the next step until a task queued - to set inForeground to the result of the - [=in the foreground=] algorithm, sets - inForeground to `true`.

            + to set isInView to the result of the + [=is in view=] algorithm, would set + isInView to `true`.

          2. Let finalSet be an (initially) empty @@ -4118,10 +4124,10 @@

            Implementation Suggestions

            continuing capture in situations that may surprise users.

          3. -

            A web page not [=in the foreground=] +

            A web page not [=is in view|in view=] re-enables a track when all tracks from that source are disabled, in order to delay - resumption of capture until the page is [=in the foreground=]. + resumption of capture until the page [=is in view=].

          4. @@ -4137,7 +4143,7 @@

            Implementation Suggestions

            user's awareness of the earlier capture session.

          5. -

            A web page comes [=in the foreground|into the foreground=] and +

            A web page comes [=is in view|into view=] and has one or more enabled tracks that are also [= muted =].

            From 50b4647e3403de754f15cad31ba2c648d60cf72c Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 2 Nov 2022 15:11:30 -0400 Subject: [PATCH 5/9] Make "If the user never responds" into a note. --- getusermedia.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getusermedia.html b/getusermedia.html index 4bd3f7c4..ce1e311d 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -3616,9 +3616,9 @@

            Methods

            MUST disclose whether permission will be granted only to the device chosen, or to all devices of that kind.

            -
          6. -
          7. -

            If the user never responds, this algorithm stalls on this step.

            +
            +

            If the user never responds, this algorithm stalls on this step.

            +
          8. If the result of the request is {{PermissionState/"denied"}}, From 2cfa9a99ada74a9494b180c50dade42cbc4a8f8e Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 2 Nov 2022 15:27:04 -0400 Subject: [PATCH 6/9] Break out "has system focus" algorithm to simplify --- getusermedia.html | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/getusermedia.html b/getusermedia.html index ce1e311d..79618a24 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -3138,6 +3138,16 @@

            Device information exposure

            is `"visible"`, return `true`. Otherwise, return `false`.

          +

          To perform a has system focus check, run the following + steps:

          +
            +
          1. +

            If the [=relevant global object=]'s [=associated `Document`=]'s + [=top-level browsing context=] has + system focus, return + `true`. Otherwise, return `false`.

            +
          2. +

          Set device information exposure

          @@ -3625,11 +3635,14 @@

          Methods

          jump to the step labeled Permission Failure below.

        4. -

          The [=User Agent=] MUST wait to proceed to the next - step until a task queued to set systemFocus - to `true` if the [=top-level browsing context=] has - system focus, - or `false` otherwise, sets systemFocus to +

          Let hasSystemFocus be `false`.

          +
        5. +
        6. +

          While hasSystemFocus is `false`, the + [=User Agent=] MUST wait to proceed to the next step + until a task queued to set hasSystemFocus + to the result of the [=has system focus=] + algorithm, would set hasSystemFocus to `true`.

        7. From 59cf56a66bce75926d35e4154b663d0a527bef56 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 2 Nov 2022 15:35:39 -0400 Subject: [PATCH 7/9] fix minor bug in "has system focus" algorithm --- getusermedia.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getusermedia.html b/getusermedia.html index 79618a24..1885d427 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -3142,7 +3142,7 @@

          Device information exposure

          steps:

          1. -

            If the [=relevant global object=]'s [=associated `Document`=]'s +

            If the [=relevant global object=]'s [=browsing context=]'s [=top-level browsing context=] has system focus, return `true`. Otherwise, return `false`.

            From c5960424360e83f435e895a09611c581e5307b5b Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Mon, 14 Nov 2022 17:21:24 -0500 Subject: [PATCH 8/9] s/sets/would set/ --- getusermedia.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getusermedia.html b/getusermedia.html index 1885d427..f1006857 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -2879,7 +2879,7 @@

            Methods

            While proceed is `false`, the [=User Agent=] MUST wait to proceed to the next step until a task queued to set proceed to the result of - [=device enumeration can proceed=], sets + [=device enumeration can proceed=], would set proceed to `true`.

          2. From 944b94f7c6a5d3049dcc0792e404208f86e1acd5 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 15 Dec 2022 15:01:46 -0500 Subject: [PATCH 9/9] Fix respec error with s/nested browsing contexts/child navigables/ --- getusermedia.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getusermedia.html b/getusermedia.html index f1006857..8d015848 100644 --- a/getusermedia.html +++ b/getusermedia.html @@ -3230,7 +3230,7 @@

            Attributes

            uniquely identified by its identifier and its {{MediaDeviceInfo/kind}}.

            To to ensure stored identifiers are recognized, the identifier MUST be the same in documents of the same origin in [=top-level browsing contexts=]. - In [=nested browsing contexts=], + In [=child navigables=], the decision of whether or not the identifier is the same across documents, MUST follow the [=User Agent=]'s partitioning rules for storage (such as {{WindowLocalStorage/localStorage}}), if any,