Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File URL To Chrome/Resource URL

40 views
Skip to first unread message

Edmond Begumisa

unread,
Dec 29, 2011, 10:06:16 AM12/29/11
to dev-apps-j...@lists.mozilla.org, dev-pl...@lists.mozilla.org
Hello all,

I'm working on an extension to link Venkman to Komodo with the aim of
providing local and remote debugging of XULRunner applications. Small
question...

nsIChromeRegistry::convertChromeURL and nsIResProtocolHandler::resolveURI
provide a convenient way of getting a local file path from chrome:* and
registry:* URIs. Anyone know of an equally easy way of doing the opposite?

That is, finding the first chrome: or resource: URI resolving to a
particular local file: URI?

I'm currently painfully walking through the ChromeML directory service,
reading manifests from disk, parsing them, then doing regex trickery to
construct a dictionary of file URIs to compare to but I'm sure someone
must have already found an easier way deep in the Mozilla code.

Thanks in advance.

- Edmond -

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Benjamin Smedberg

unread,
Dec 29, 2011, 10:41:31 AM12/29/11
to ebeg...@hysteria-tech.com, dev-pl...@lists.mozilla.org, dev-apps-j...@lists.mozilla.org, Edmond Begumisa
On 12/29/2011 10:06 AM, Edmond Begumisa wrote:
>
> nsIChromeRegistry::convertChromeURL and
> nsIResProtocolHandler::resolveURI provide a convenient way of getting
> a local file path from chrome:* and registry:* URIs. Anyone know of an
> equally easy way of doing the opposite?
>
> That is, finding the first chrome: or resource: URI resolving to a
> particular local file: URI?
The chrome registry does not expose a list of chrome packages, so no,
there is currently no builtin way to do this. I'd accept a patch which
hands back a list of the current set of chrome package mappings.

The resource registry is even more "interesting" because there are cases
where resource mappings are looked up dynamically (from the directory
service) and so we don't even know the list of resource mappings until
somebody tries to load from them.

--BDS

Edmond Begumisa

unread,
Dec 29, 2011, 11:16:13 AM12/29/11
to Benjamin Smedberg, dev-pl...@lists.mozilla.org, dev-apps-j...@lists.mozilla.org
On Fri, 30 Dec 2011 02:41:31 +1100, Benjamin Smedberg
<benj...@smedbergs.us> wrote:

> On 12/29/2011 10:06 AM, Edmond Begumisa wrote:
>>
>> nsIChromeRegistry::convertChromeURL and
>> nsIResProtocolHandler::resolveURI provide a convenient way of getting a
>> local file path from chrome:* and registry:* URIs. Anyone know of an
>> equally easy way of doing the opposite?
>>
>> That is, finding the first chrome: or resource: URI resolving to a
>> particular local file: URI?
> The chrome registry does not expose a list of chrome packages, so no,
> there is currently no builtin way to do this.

Too bad.

> I'd accept a patch which hands back a list of the current set ofchrome
> package mappings.
>

What I have is all JavaScript in form of a Venkman plugin + Komodo
Extension :(

I'll see if I can find the time to port the registry part when it's all
done.

> The resource registry is even more "interesting" because there are cases
> where resource mappings are looked up dynamically (from the directory
> service) and so we don't even know the list of resource mappings until
> somebody tries to load from them.

Ahh, I see, and there's also nsIResProtocolHandler::setSubstitution to
deal with.

Luckily this is not a problem for my case because the reverse resolving is
only needed on the editor side not the debugger/XULRunner side. I figure
if the editor has the manifests in it's registry, resolves currently open
local files, then sends the resource URI to Venkman, Venkman should be
able to set breakpoints etc in 95% of the cases.

Thanks.

- Edmond -



>
> --BDS
0 new messages