Closed Bug 930347 Opened 11 years ago Closed 11 years ago

ScriptLoader should set correct principal for ServiceWorker

Categories

(Core :: DOM: Workers, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: nsm, Assigned: nsm)

References

Details

ServiceWorkers don't have a active Document, http://mxr.mozilla.org/mozilla-central/source/dom/workers/ScriptLoader.cpp#535 resets a worker's principal to it's channel's principal (http://mxr.mozilla.org/mozilla-central/source/caps/src/nsScriptSecurityManager.cpp#323) where the channel principal is obtained from the document (http://mxr.mozilla.org/mozilla-central/source/caps/src/nsScriptSecurityManager.cpp#323) Need an alternative for ServiceWorker.
When the service worker is registered and fetched, we can associate a docshell with it (the one from the page that called registerServiceWorker()). From what I can see - http://mxr.mozilla.org/mozilla-central/source/caps/src/nsScriptSecurityManager.cpp#1901 - we could simply capture the docshell's appId and inBrowserElement and store it with the other meta-data we would store about ServiceWorkers. Then when ScriptLoader is invoked on subsequent runs, re-use these fields. Makes sense?
Flags: needinfo?(bent.mozilla)
I'm not sure what the problem is exactly. ServiceWorkers should hang onto their channel principal. Is the SSM just not handing out the correct principal if we don't have a docshell?
Flags: needinfo?(bent.mozilla)
Assignee: nobody → nsm.nikhil
Closing this bug as the ServiceWorker implementation has changed since then.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.