Closed Bug 1169210 Opened 10 years ago Closed 10 years ago

Can't call content service worker from chrome

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: ochameau, Assigned: jaoo)

References

Details

Attachments

(1 file, 2 obsolete files)

Bug 1153407 is hitting this exception while writing tests, mochitest browser, used for testing devtools. We have to test the devtools by using chrome, but then we can't easily call the content service worker. We are not trying to use chrome service worker but hit this exception just because the caller is chrome. http://mxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerManager.cpp#1052 Couldn't we just prevent exposing navigator.serviceWorker on chrome? Or only hit this assertion when accessing navigator.serviceWorker on a chrome document? Ideally we shouldn't prevent service worker to work when the *caller* is chrome, but only when the *document* is chrome! Or we could just make it work on chrome docs as weel if that's any easier ;)
Nikhil, what could we do here please? Thanks!
Flags: needinfo?(nsm.nikhil)
(In reply to Alexandre Poirot [:ochameau] from comment #0) > Bug 1153407 is hitting this exception while writing tests, mochitest > browser, used for testing devtools. We have to test the devtools by using > chrome, but then we can't easily call the content service worker. > We are not trying to use chrome service worker but hit this exception just > because the caller is chrome. > http://mxr.mozilla.org/mozilla-central/source/dom/workers/ > ServiceWorkerManager.cpp#1052 > > Couldn't we just prevent exposing navigator.serviceWorker on chrome? > Or only hit this assertion when accessing navigator.serviceWorker on a > chrome document? > Ideally we shouldn't prevent service worker to work when the *caller* is > chrome, but only when the *document* is chrome! > Or we could just make it work on chrome docs as weel if that's any easier ;) Please remove that assert and add an assert that the window's document's principal is not the system principal.
Flags: needinfo?(nsm.nikhil)
Assignee: nobody → jaoo
Status: NEW → ASSIGNED
Attached patch WIP (obsolete) — Splinter Review
> Please remove that assert and add an assert that the window's document's > principal is not the system principal. Still not tested, but Is that what you meant please? Thanks!
Attachment #8612838 - Flags: feedback?(nsm.nikhil)
Attached patch WIP (obsolete) — Splinter Review
This is the correct patch. Sorry.
Attachment #8612838 - Attachment is obsolete: true
Attachment #8612838 - Flags: feedback?(nsm.nikhil)
Attachment #8612839 - Flags: feedback?(nsm.nikhil)
Comment on attachment 8612839 [details] [diff] [review] WIP Review of attachment 8612839 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/workers/ServiceWorkerManager.cpp @@ +1208,5 @@ > + nsCOMPtr<nsIPrincipal> documentPrincipal = doc->NodePrincipal(); > + MOZ_ASSERT(documentPrincipal); > + > + PrincipalInfo info; > + nsresult rv = PrincipalToPrincipalInfo(documentPrincipal, &info); I think you just want: MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(doc->NodePrincipal()));
Comment on attachment 8612839 [details] [diff] [review] WIP (In reply to Ben Kelly [:bkelly] from comment #5) > Comment on attachment 8612839 [details] [diff] [review] > WIP > > Review of attachment 8612839 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/workers/ServiceWorkerManager.cpp > @@ +1208,5 @@ > > + nsCOMPtr<nsIPrincipal> documentPrincipal = doc->NodePrincipal(); > > + MOZ_ASSERT(documentPrincipal); > > + > > + PrincipalInfo info; > > + nsresult rv = PrincipalToPrincipalInfo(documentPrincipal, &info); > > I think you just want: > > MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(doc->NodePrincipal())); Thanks Ben, much easier!
Attachment #8612839 - Attachment is obsolete: true
Attachment #8612839 - Flags: feedback?(nsm.nikhil)
Bug 1169210 - Can't call content service worker from chrome. r=nsm
Attachment #8612915 - Flags: review?(nsm.nikhil)
Attachment #8612915 - Flags: review?(nsm.nikhil)
Comment on attachment 8612915 [details] MozReview Request: Bug 1169210 - Can't call content service worker from chrome. r=nsm Bug 1169210 - Can't call content service worker from chrome. r=nsm
Attachment #8612915 - Flags: review?(nsm.nikhil)
Comment on attachment 8612915 [details] MozReview Request: Bug 1169210 - Can't call content service worker from chrome. r=nsm Bug 1169210 - Can't call content service worker from chrome. r=nsm
Comment on attachment 8612915 [details] MozReview Request: Bug 1169210 - Can't call content service worker from chrome. r=nsm https://reviewboard.mozilla.org/r/9669/#review8427 Ship It! ::: dom/workers/ServiceWorkerManager.cpp:1060 (Diff revision 2) > + // XXXnsm Don't allow service workers to register when the *document* is No longer XXXnsm ;)
Attachment #8612915 - Flags: review?(nsm.nikhil) → review+
Comment on attachment 8612915 [details] MozReview Request: Bug 1169210 - Can't call content service worker from chrome. r=nsm Bug 1169210 - Can't call content service worker from chrome. r=nsm
Attachment #8612915 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: