Will this work (assuming that myprotocol handler is implemented and
registered by my extension correctly)?
Overlay chrome://browser/content/browser.xul
myprotocol://extension/content/overlay.xul
PM-
> Is it possible to specify other protocol, in extension's chrome.manifest,
> then chrome to load overlay or stylesheet?
> I need to create some overlays dynamically. So I’m thinking to create my
> protocol handler that will do that for me.
>
> Will this work (assuming that myprotocol handler is implemented and
> registered by my extension correctly)?
> Overlay chrome://browser/content/browser.xul
> myprotocol://extension/content/overlay.xul
>
> As far as I can see, the only check is done for the URI being a "local
resource":
http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#234
236 <http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#236>
PRBool <http://mxr.mozilla.org/mozilla-central/ident?i=PRBool>
isLocalResource
<http://mxr.mozilla.org/mozilla-central/ident?i=isLocalResource> =
PR_FALSE <http://mxr.mozilla.org/mozilla-central/ident?i=PR_FALSE>;
237 <http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#237>
(void)NS_URIChainHasFlags
<http://mxr.mozilla.org/mozilla-central/ident?i=NS_URIChainHasFlags>(aResourceURI,
238 <http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#238>
nsIProtocolHandler
<http://mxr.mozilla.org/mozilla-central/ident?i=nsIProtocolHandler>::URI_IS_LOCAL_RESOURCE
<http://mxr.mozilla.org/mozilla-central/ident?i=URI_IS_LOCAL_RESOURCE>,
239 <http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#239>
&isLocalResource
<http://mxr.mozilla.org/mozilla-central/ident?i=isLocalResource>);
<http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#240>
Not sure what this means for custom protocol.
Looking for "IsChrome" in
http://mxr.mozilla.org/mozilla-central/source/content/xul/document/src/nsXULDocument.cppdoesn't
find anything important for non-chrome overlays (style overlays are
not applied to them and the fastload cache is not used).
So my guess is "might be possible", but you certainly would have to check.
Maybe start with a file:// overlay to see if at least that works.
Nickolay
PM-
> I tested file:// overlay and it works.
> So I'm going to write custom protocol handler.
Why not just define some resource:// URLs dynamically?
Phil
--
Philip Chee <phi...@aleytys.pc.my>, <phili...@gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
I'm not sure custom protocol handlers would load before that manifest gets
parsed, though, at least the first time after install, so that should be
something you take care with. Also, why not just use the loadOverlay function?
See: https://developer.mozilla.org/en/document.loadOverlay
~ Gijs
Well,
I tried it but there is a problem with toolbar customization.
<toolbarpalette> is at the startup transformed into javascript object
palette.
I added toolbar button to main toolbar from customization dialog. Then I
restarted ffox/tbird and button wasn't there however in customization
toolbar was present.
If I do this via chrome.manifest then customization works fine. But
problem is that I have to generate toolbarbutton for toolbarpalette
dynamically.
PM-
PM-