Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generic-sensor] Avoid unhandled promise rejection #16414

Merged
merged 1 commit into from
Apr 19, 2019

Conversation

jugglinmike
Copy link
Contributor

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"

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. Update
the subsquent assertion to provide a more clear explanation of the
failure which occurs in non-supporting browsers.
Copy link
Contributor

@Honry Honry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catching! LGTM, thanks!

@Honry Honry merged commit 4131304 into web-platform-tests:master Apr 19, 2019
@jugglinmike
Copy link
Contributor Author

My pleasure :)

@jugglinmike
Copy link
Contributor Author

marcoscaceres pushed a commit that referenced this pull request Jul 23, 2019
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. Update
the subsquent assertion to provide a more clear explanation of the
failure which occurs in non-supporting browsers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants