Closed Bug 1550218 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 16414 - [generic-sensor] Avoid unhandled promise rejection

Categories

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

defect

Tracking

(firefox69 fixed)

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Mike Pennisi <mike@mikepennisi.com> wrote:

[generic-sensor] Avoid unhandled promise rejection

By testing for a global binding via an unqualified IdentifierReference,
the Generic Sensor utility file produces a rejected promise which is not
handled. If testharness.js has not yet determined that testing is
complete, this unhandled rejection will cause a harness-level error.
Such errors will occur based on relative timing of asynchronous
operations, and this has been observed to be unstable in Apple Safari as
hosted on Azure Pipelines.

Update the feature detection logic to avoid generating an unhandled
rejection by instead referencing a property of the global object.


I have not been able to reproduce the harness error locally, but the issue is clear from the results collected via Azure Pipelines and uploaded to wpt.fyi. The most recent results for
ambient-light/AmbientLightSensor_insecure_context.html
demonstrate the problem

ERROR message: Can't find variable: MojoInterfaceInterceptor

The "history" feature on that page shows that this is intermittent in that environment. The same problem affects all tests which do not use the sensor_test function, that is: all of the _insecure_context.html tests.

In addition to promoting determinism in those specific tests, this change improves failure messages for all tests in browsers which don't define the Mojo interface. Currently, the tests fail with the message: "ReferenceError: MojoInterfaceInterceptor is not defined". With this patch applied, they instead fail with the message, "assert_true: Mojo testing interface is not available. expected true got false"

Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/edd048a3034d
[wpt PR 16414] - [generic-sensor] Avoid unhandled promise rejection, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.