Hello all,
yesterday I spent some time discovering why some features of the Page
Worker involving the hidden window worked on Mac but not on Windows
(or Linux), and how to fix that, and here I'll write a hopefully short
summary for two reasons: 1, because I want more people to take a look
on the solution and see if it's indeed reliable, and 2, for future
reference, this might be useful.
The main problem is that the hidden window is different on the
platforms, but the difference is two-fold: on Mac it's a .xul file
from a chrome:// URL, and on Windows it's an .html file from a resource://
URL.. This makes it be more restricted on Windows.
By default, when we go by inserting a <xul:iframe type="content" />
element, and we try to access the contentWindow, we get the following
error on non-mac:
"Permission denied for file at resource://gre-modules/ to create
wrapper for UnnamedClass"
It looks like this is due to cross-doc checks, and a resource:// file
won't allow it. If it was a <html:iframe> this would be possible, but
we can't load untrusted content on it. The solution is to load a
trusted chrome:// URL inside an <html:iframe>, and then inside it we
have the <xul:iframe type="content"> which allows us to load any
content.
The final scheme looks like this:
-- hiddenWindow.html --
<html:iframe src="chrome://jetpack/page-worker-host.xul">
--- which is ---
<xul:iframe type="content" />
</html:iframe>
-- --
The only downside is that we would have to ship the chrome:// .xul
file... I've tried to find an existing blank .xul file in the browser
that we could reuse, but I didn't find any.
Finally, the root of the problem is that we're trying to use the
hiddenWindow much beyond its original purposes. I'm looking into how
we can make improvements on that on the platform, and hopefully make
this a 3.6-only workaround.
Felipe
--- if you're interested in more details, here are other things I
tried first, but didn't work ---
- using the host .xul file via a data url: doesn't work, it needs to
be chrome://
- elevating the page privileges via
netscape.security.PrivilegeManager: still gives permission denied
- running `iframe.contentWindow` on a sandbox with a system principal:
still gives permission denied
--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To post to this group, send email to
mozilla-la...@googlegroups.com.
To unsubscribe from this group, send email to
mozilla-labs-jet...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mozilla-labs-jetpack?hl=en.