Open Bug 1888058 Opened 11 months ago

[wpt-sync] Sync PR 45344 - permissions policy: Avoid resolving promise too early in test_feature_availability()

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(Not tracked)

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 45344 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/45344
Details from upstream follow.

Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> wrote:

permissions policy: Avoid resolving promise too early in test_feature_availability()

This is a follow-up to https://crrev.com/c/4219093, which an
is_promise_test code path to test_feature_availability().

The promise returned by the function resolved too early though: any
"message" event would cause it to resolve, which is a problem when an
iframe calls test_driver.set_test_context() and sends commands to the
main frame, or any unwanted message arrives from somewhere else.

Make expectFeatureAvailable() return a boolean depending on whether it
has processed a message it was waiting for or not, and only resolve the
promise when it has.

Bug: 331320405
Change-Id: I3aa248202ca5cde72f25067c31d42e5523f324fb
Reviewed-on: https://chromium-review.googlesource.com/5396177
WPT-Export-Revision: 408d68e6434abb02cd1c39f81ba7dcebbd443d8d

You need to log in before you can comment on or make changes to this bug.