Auto merge of #13574 - creativcoder:job-iface, r=jdm

Implement job queue for ServiceWorkerRegistration

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

Fixes #13424
As of now this PR (Work in Progress), will try to implement (partially) on algorithms namely : [Schedule_Job](https://w3c.github.io/ServiceWorker/#schedule-job-algorithm), [Run_Job](https://w3c.github.io/ServiceWorker/#run-job-algorithm), [Register_Job](https://w3c.github.io/ServiceWorker/#register-algorithm).

 An issue that needs to be addressed:
Resolving the promise value after queueing it as a `dom_manipulation_task` by wrapping it in a runnable `RunJobHandler` (which holds a `TrustedPromise`) and trying to call `resolve_native` results in a crash. [stack trace](http://paste.ofcode.org/zdjJ9npBgX6JsyWQkJjnYk)

@jdm I am not sure what's causing the crash ?

---

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/13574)

<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-21 14:52:02 -06:00 committed by GitHub
commit 0ea0ade71d
11 changed files with 462 additions and 68 deletions

View file

@ -14,6 +14,12 @@ test(function (){
assert_true('serviceWorker' in navigator);
}, "Test: Asserts ServiceWorkerContainer in Navigator");
promise_test(function() {
return register_sw('resources/sw.js').then(function(sw_reg) {
assert_equals(sw_reg.active.scriptURL, location.href.replace("service-worker-registration.html", "resources/sw.js"));
});
}, "Test: Active Service Worker ScriptURL property");
promise_test(function() {
return register_sw('sw.js').then(function(sw_reg) {
assert_class_string(sw_reg, "ServiceWorkerRegistration");
@ -43,10 +49,4 @@ promise_test(function (p) {
return promise_rejects(p, new TypeError(), register_sw('sw.js', './mal%5fformed/sco%5Cpe/'));
}, "Test: Throws Error when Invalid Scope");
promise_test(function() {
return register_sw('resources/sw.js').then(function(sw_reg) {
assert_equals(sw_reg.active.scriptURL, location.href.replace("service-worker-registration.html", "resources/sw.js"));
});
}, "Test: Active Service Worker ScriptURL property");
</script>