I took a look at the test case test_controller.html. https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/test/controller/index.html#54 might be the reason for Unregister() twice. I confirmed that the principal and scope for Unregister() [in controller/index.html](https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/test/controller/index.html#54) and [in test_controller.html](https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/test/test_controller.html#31) are the same
Bug 1757724 Comment 4 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I took a look at the test case test_controller.html. https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/test/controller/index.html#54 might be the reason for Unregister() twice. I confirmed that the principal and scope for Unregister() [in controller/index.html](https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/test/controller/index.html#54) and [in test_controller.html](https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/test/test_controller.html#31) are the same And it seems we reuse the existing ServiceWorkerRegistrationInfo while Register(). https://searchfox.org/mozilla-central/rev/840881e1232f664a58b39caaae6284c7bcf121df/dom/serviceworkers/ServiceWorkerRegisterJob.cpp#30-42