Closed
Bug 943704
Opened 11 years ago
Closed 8 years ago
importScripts() in child worker fails on B2G
Categories
(Core :: DOM: Workers, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: nsm, Unassigned)
Details
Attachments
(1 file)
4.77 KB,
patch
|
Details | Diff | Splinter Review |
I was able to track down the importScripts() error in a child worker from Bug 925437 to HttpChannelChild::AsyncOpen. On B2G, it fails on the MissingRequiredTabChild() check [1].
Attached test case passes on Firefox desktop (Linux), but fails on B2G emulator running with Gecko compiled from mozilla-central.
[1]: http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/HttpChannelChild.cpp#1059
Reporter | ||
Comment 1•11 years ago
|
||
Test case.
Reporter | ||
Updated•11 years ago
|
Assignee: nobody → nsm.nikhil
Reporter | ||
Comment 2•11 years ago
|
||
Comment on attachment 8338979 [details] [diff] [review]
Test case
Can be applied to m-c
Attachment #8338979 -
Attachment description: importScripts() in child worker fails on B2G. → Test case
This is going to need Necko help. Adding some folks, please add others?
Reporter | ||
Comment 4•11 years ago
|
||
This presumably occurs because ChannelFromScriptURL() in dom/workers/ScriptLoader.cpp passes callbacks=nullptr to NS_NewChannel().
Comment 5•11 years ago
|
||
We should also be delegating to the loadgroup's callbacks if no callbacks are present. Are we associating a non-null document with this load?
Reporter | ||
Comment 6•11 years ago
|
||
(In reply to Josh Matthews [:jdm] from comment #5)
> We should also be delegating to the loadgroup's callbacks if no callbacks
> are present. Are we associating a non-null document with this load?
I'll trace this and update.
Reporter | ||
Comment 7•11 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (use needinfo?) from comment #6)
> (In reply to Josh Matthews [:jdm] from comment #5)
> > We should also be delegating to the loadgroup's callbacks if no callbacks
> > are present. Are we associating a non-null document with this load?
>
> I'll trace this and update.
Yes, ChannelFromScriptURLWorkerThread() uses a main thread runnable to get a 'good' channel even for child workers. Since this works on desktop, I'm inclined to think the problem may be with HttpChannelChild doing something different than HttpChannel?
Comment 8•11 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (use needinfo?) from comment #7)
> (In reply to Nikhil Marathe [:nsm] (use needinfo?) from comment #6)
> > (In reply to Josh Matthews [:jdm] from comment #5)
> > > We should also be delegating to the loadgroup's callbacks if no callbacks
> > > are present. Are we associating a non-null document with this load?
> >
> > I'll trace this and update.
>
> Yes, ChannelFromScriptURLWorkerThread() uses a main thread runnable to get a
> 'good' channel even for child workers. Since this works on desktop, I'm
> inclined to think the problem may be with HttpChannelChild doing something
> different than HttpChannel?
I don't really understand this comment. The important information here is whether there is a loadgroup present for the channel that is created by ScriptLoader. Comparing whether it works on desktop or not doesn't really make sense (assuming that OOP is disabled on desktop), since the tab child missing check only occurs when OOP is enabled.
Reporter | ||
Comment 9•11 years ago
|
||
<nsm> ok, so here's what is going wrong - could you bring up http://mxr.mozilla.org/mozilla-central/source/dom/workers/ScriptLoader.cpp#307
<nsm> jdm: ^
<nsm> the key is line 346, call to ForgetWorkerChannel()
<nsm> in the case of a toplevel worker, the worker holds a reference to a document. so when importScripts() is called, although the worker has forgotten its channel, it can use the doc and loadgroup to construct a valid channel that has that MissingRequiredTab check succeed
<nsm> in the case of a child worker, there is no reference to a document. the worker forgets it when its own script is loaded. When importScripts() is called, it has no channel, no parent doc, no load group. So the resulting channel isn't satisfying the check
Reporter | ||
Comment 10•11 years ago
|
||
Ben, the ForgetWorkerChannel() was introduced in the SharedWorker patch. Is there a reason that the channel should be forgotten. In that case child workers should have an associated document in GetLoadInfo(), but there are currently main thread assertions preventing parts of it, and I'm not sure how good it would be to just set loadInfo.mWindow = aParent->GetWindow().
Flags: needinfo?(bent.mozilla)
Reporter | ||
Updated•11 years ago
|
Flags: needinfo?(bent.mozilla)
Reporter | ||
Comment 11•11 years ago
|
||
jduell, anything Necko could tell us?
Flags: needinfo?(jduell.mcbugs)
Reporter | ||
Comment 12•11 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #10)
> Ben, the ForgetWorkerChannel() was introduced in the SharedWorker patch. Is
> there a reason that the channel should be forgotten. In that case child
> workers should have an associated document in GetLoadInfo(), but there are
> currently main thread assertions preventing parts of it, and I'm not sure
> how good it would be to just set loadInfo.mWindow = aParent->GetWindow().
It is fine to foget the channel, since the channel is only used to load the worker script.
Reporter | ||
Updated•11 years ago
|
Assignee: nsm.nikhil → nobody
Comment 13•11 years ago
|
||
It looks like the issue here isn't necko per se, but that necko isn't being given the info it needs to do security checks (LoadInfo, from either channel or loadgroup callbacks).
Flags: needinfo?(jduell.mcbugs)
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•