On Thu, Dec 19, 2013 at 5:49 PM, Yan Zhu <
y...@eff.org> wrote:
> Actually, I don't think we use content policy anymore since y'all have
> nsIHttpChannel.redirectTo. CC'ing Peter, who wrote that code to begin
> with.
>
> Sorry, there's probably a bunch of things in the codebase that should
> be deleted by now. :(
>
> So maybe porting to the new API wouldn't be so bad?
>
I agree that, AFAICT, you shouldn't need nsIContentPolicy. I looked at your
code on GitHub and it doesn't seem to be using content policy anyway. That
makes things simpler.
Bill: The main issue that seems to need to be resolved is this: From the
parent process, how can I get a definitive, consistent answer to the
question "what is the origin and/or URL of the top-level document in tab
X?" Right now, There are a lot of features, like the mixed content blocker,
HTTPS Everywhere, the SSL indicator UI, client certificate support, the
permission management UI, etc. that need to make security decisions based
on the answer to that question. But, AFAICT, we have to ask the child to
get that information, and that seems to be racy and also at odds with the
sandboxing work, since we're not supposed to trust the child to give us
security-critical information.
Besides being able to query the answer to the question above, most of these
features, including HTTPS Everywhere, need to be able to associate small
amounts of data with the docshell, but with that information living in the
parent process. If we can point people to the object that lives in the
parent process that controls navigation in the top-level docshell in the
child, and if we can provide a way to extend this object by associating
arbitary data with it, and we can describe how that is accessed from an
addon, then we'll have mostly solved the most difficult problems for HTTPS
Everywhere and the other features I've mentioned above.
Because HTTPS Everywhere is a feature for securing web content, it makes
more sense for its code to run in the parent process than in the child
process. (Other addons, that aren't trying to restrict or improve the
security of web content, proably are better off running as content scripts
in the content processes.) From briefly looking at the HTTPS Everywhere
addon code, and based on some intuition of what the addon does, I would
expect that it could run 100% in the parent process without loss of
functionality, given the type of mechanism I describe above. But, before we
create/document the mechanism I describe above, then features like HTTPS
everywhere and Mixed Content Blocker are likely going to need to be split
into content-process parts and and parent-process parts, and then (ideally)
rewritten again after the above-described mechanism is in place.
Consequently, the sooner we can implement that mechanism, the less work
we'll all have to do in the long run.
Note that, because the parent process needs the child process's top-level
docshell state to be consistent while these features are making decisions,
the parent process will need to be able to prevent the child from
navigating itself while code in the parent process is executing. AFAICT,
that means every navigation mechanism in the child process probably needs
to be redone such that the child asks the parent to do the navigation and
then waits for the parent to actually force the navigation to happen, when
the parent is in a consistent state.
Cheers,
Brian