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
Screen orientation: event firing and promise resolving #15729
Screen orientation: event firing and promise resolving #15729
Conversation
const pMustReject = screen.orientation.lock("landscape"); | ||
const pMustResolve = new Promise(r => { | ||
screen.orientation.onchange = async () => { | ||
screen.orientation.unlock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a spec bug 🙌 The spec doesn't seem to say what to do with the pMustReject
promise when .unlock()
is called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's true!
}); | ||
await promise_rejects(t, new TypeError(), pMustReject); | ||
await pMustResolve; | ||
}, "Event must fire before orientationPendingPromise resolves"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the tested assertion here is unique too... it should have something to do with .unlock() and orientationPendingPromise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to word both, not sure if I've captured it right though.
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script> | ||
import { getOppositeOrientation } from "/screen-orientation/resources/orientation-utils.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is supposed to throw an early SyntaxError, as static import
only works within <script type=module>
, so the rest of the <script>
is essentially ignored. This seems like a broken test? cc @LeszekSwirski
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed here #17547
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mathiasbynens! how weird... I thought we had these working but you are absolutely right that these would be syntax errors :/
Relates to w3c/screen-orientation#151