-
Notifications
You must be signed in to change notification settings - Fork 29
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
Resolving the promise after the change event is fired #147
Conversation
Looks good. I think the gh-pages branch itself needs a tidy tho. I see tidy changes that should be on the gh-pages branch. |
@kenchris how do propose we handle this on the Chrome side? This is a breaking change. I think it’s worth doing, but we will need to convince folks (hi @mounirlamouri! 🤗) |
Is there a recommended pattern by the TAG or commonly used one from other specifications? |
Let me talk with @slightlyoff |
Please have a look at https://www.w3.org/2001/tag/doc/promises-guide |
@mounirlamouri wrote
I was actually thinking of filing a bug on the TAG as this particular situation is not exactly covered by either the API Design Guide or the Promises Guide. Regardless, the "pending promise" effectively represents the screen having changed: const pendingPromise = new Promise(r => {
screen.orientation.addEventListener("change", ()=> r(), { once: true });
}); |
Yes, I noticed the same. Please file |
@kenchris, the closest I get in the Promises Guide is this section:
The above suggests that the event occurs, and, as a result the promise is resolved and rejected based on what the result is.
The above follows...
... and so on... Anyway, will file a bug :) |
@mounirlamouri, the TAG has kindly updated their API Design doc providing advice around this - thanks @kenchris for making that happen! Given the TAG's advice, would you be ok with changing the behavior? @Johanna-hub and I can update the implement on the Gecko side, and provide WPTests. |
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.
LGTM
We now have a test for this web-platform-tests/wpt#15267 I have also filed a bug on bugzilla https://bugzilla.mozilla.org/show_bug.cgi?id=1525582 |
LGTM. I don't know if and when I would update the implementation in Chromium. Though, @Johanna-hub if you want to send a patch, I would happily review :) |
@mounirlamouri, sure, we can probably do it. Being new the Blink code base, if you can quickly just point us to the right files, we can go from there. |
Actually, I realised that I had in my backlog removing all the Android Jelly Bean support from the screen orientation code. Will probably do both at the same time. |
@mounirlamouri, ok cool. We will make sure to have good web platform tests for you at least :) |
oh, before I forget, do you want us to file a bug for this specifically on the Chrome side? Or do you have a link to your refactor bug? |
I've updated the initial message with the bug number. I have a CL ready that seems to work. Should be in soon. |
This is following a spec change: w3c/screen-orientation#147 Bug: 930237 Change-Id: I75144357aa91d6fc24a7f7d935d321ae084f7c99 Reviewed-on: https://chromium-review.googlesource.com/c/1460427 Commit-Queue: Mounir Lamouri <[email protected]> Reviewed-by: Becca Hughes <[email protected]> Cr-Commit-Position: refs/heads/master@{#630970}
The change has landed in Blink. Hopefully it will stick. Subtle timing changes like this always worry me :) |
Ok, excellent. I’ll make sure the changes happen on the Mozilla side ASAP. Then our implementations can be in sync. |
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.
Ok, let's go with this. We need to fix this up to use task queues, however.
Working on the Gecko patch. |
Ok, landed the changes in Gecko too. Fingers crossed it doesn't get backed out. |
Closes #120
The following tasks have been completed:
Implementation commitment:
Preview | Diff