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

Make ServiceWorkerContainer::register return a Promise #13409

Closed
jdm opened this issue Sep 24, 2016 · 9 comments
Closed

Make ServiceWorkerContainer::register return a Promise #13409

jdm opened this issue Sep 24, 2016 · 9 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Sep 24, 2016

Specification: https://w3c.github.io/ServiceWorker/#service-worker-container and https://w3c.github.io/ServiceWorker/#service-worker-container-register-method
Code: components/script/dom/webidls/ServiceWorkerContainer.webidl, components/script/dom/serviceworkercontainer.rs

The implementation of ServiceWorkerContainer::Register was written before #12830, which added support for Promise values in DOM APIs. We can rewrite the code to remain synchronous but return a resolved Promise so that our implementation becomes compatible with existing tests.

@highfive
Copy link

@highfive highfive commented Sep 24, 2016

Please make a comment here if you intend to work on this issue. Thank you!

@jdm
Copy link
Member Author

@jdm jdm commented Sep 24, 2016

Use ./mach run tests/html/service-worker/index.html to verify the changes (the test will require updating to use Promises appropriately).

@Coder206
Copy link
Contributor

@Coder206 Coder206 commented Sep 24, 2016

@jdm May I?

@jdm
Copy link
Member Author

@jdm jdm commented Sep 24, 2016

@Coder206 Sure, go ahead.

@jdm jdm added the C-assigned label Sep 24, 2016
@Coder206
Copy link
Contributor

@Coder206 Coder206 commented Sep 25, 2016

@jdm I apologize for the delay, I am having trouble building Servo on all my instances.

I noticed there are steps in the code (components/script/dom/serviceworkercontainer.rs). However, some steps are missing, do you want me to add them based on https://w3c.github.io/ServiceWorker/#service-worker-container-register-method?

@KiChjang
Copy link
Member

@KiChjang KiChjang commented Sep 26, 2016

@Coder206 The issue here is sufficiently scoped to only modifying ServiceWorkerContainer::register. All other functions that are not relevant to the issue should not be touched.

@KiChjang
Copy link
Member

@KiChjang KiChjang commented Sep 26, 2016

After reading the new spec, it looks like the majority of the function body of register needs to be rewritten, and extracted into a new method called start_register.

@Coder206 Coder206 mentioned this issue Sep 26, 2016
3 of 4 tasks complete
@jdm
Copy link
Member Author

@jdm jdm commented Sep 26, 2016

I disagree. I don't think it's worth changing the goal posts here to adjust to the new specification changes; the goal of this issue to to change the implementation of Register to return a Promise<ServiceWorker> value instead of Fallible<Root<ServiceWorker>>.

bors-servo added a commit that referenced this issue Oct 14, 2016
ServiceWorkerContainer::Promise

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13409  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13419)
<!-- Reviewable:end -->
@jdm jdm added the C-has open PR label Oct 18, 2016
bors-servo added a commit that referenced this issue Oct 27, 2016
ServiceWorkerContainer::Promise

<!-- Please describe your changes on the following line: -->
The purpose of the code changes is to enable the use of promises in the Service Worker container. I also modified the Service Worker test in order to support the promises.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13409  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13419)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Oct 31, 2016
ServiceWorkerContainer::Promise

<!-- Please describe your changes on the following line: -->

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13409  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13419)

<!-- Reviewable:end -->
@Coder206
Copy link
Contributor

@Coder206 Coder206 commented Oct 31, 2016

@jdm Thanks for all your time, patience and help for this issue! I learnt lots! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.