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

Regarding HttpBaseChannel::Init

22 views
Skip to first unread message

Shuo Xiang

unread,
Aug 28, 2020, 2:44:47 PM8/28/20
to
Dear mozilla.dev.builds:

Recently I have been doing some experimentation with a private build of Firefox running on my Ubuntu 19.10. However I seem to have hit a bit of a stumbling block while I am trying to hack the Init method of the HttpBaseChannel class (mozilla-unified/netwerk/protocol/http).

The Init method is passed the parameter nsIURI* aURI, which is then assigned to both mURI and mOriginalURI. Consulting with the Mozilla interface documentation I've learned about nsIURI's "host" and "asciiHost" attributes. However, I do not seem to be able to modify these attributes as they seem to be read-only. I attempted to use "SetHost" or "SetAsciiHost" but these do not seem to exist. (The "GetAsciiHost" on the other hand does exist).

So I attempted to construct a new nsIURI object from right within the Init code, however, repeated attempts to construct a new nsIURI object are met with compiler errors about attempting to initialize an abstract class.

I am at my wit's end and so have come to this newsgroup for some help from you. If this is not the most appropriate newsgroup please let me know what would be an appropriate newsgroup for me to make this post.

Many thanks for all your help.

Alex

Nick Alexander

unread,
Aug 31, 2020, 1:06:52 AM8/31/20
to Shuo Xiang, dev-platform
Hi Alex,

On Fri, Aug 28, 2020 at 11:45 AM Shuo Xiang <shuo....@gmail.com> wrote:
Dear mozilla.dev.builds:

Recently I have been doing some experimentation with a private build of Firefox running on my Ubuntu 19.10. However I seem to have hit a bit of a stumbling block while I am trying to hack the Init method of the HttpBaseChannel class (mozilla-unified/netwerk/protocol/http).

The Init method is passed the parameter nsIURI* aURI, which is then assigned to both mURI and mOriginalURI. Consulting with the Mozilla interface documentation I've learned about nsIURI's "host" and "asciiHost" attributes. However, I do not seem to be able to modify these attributes as they seem to be read-only. I attempted to use "SetHost" or "SetAsciiHost" but these do not seem to exist. (The "GetAsciiHost" on the other hand does exist).

So I attempted to construct a new nsIURI object from right within the Init code, however, repeated attempts to construct a new nsIURI object are met with compiler errors about attempting to initialize an abstract class.

You can take your nsIURI and call `.mutate()` to get a mutator that can be then `.finalize()`-d into a concrete class: see https://searchfox.org/mozilla-central/rev/d54712b9644b49cec6cc90a9e0c325fdfab04e7c/netwerk/base/nsIURI.idl#312-318.

It's my understanding that this can be done safely on any thread now, whereas in the past this had to be done on the main thread.  Somebody correct me if I'm wrong!
 
I am at my wit's end and so have come to this newsgroup for some help from you. If this is not the most appropriate newsgroup please let me know what would be an appropriate newsgroup for me to make this post.

This is more appropriate for dev-platform, so I've CCed it there, and moved dev-builds to the BCC list.  In general you may get more help with these types of questions asking in #developers on Matrix: https://chat.mozilla.org/#/room/#developers:mozilla.org.

Nick
0 new messages