Re: Equivalent for XMLHttpRequest.overrideMimeType() in the world of nsIHttpChannel

2019-09-16 Thread john.bieling--- via dev-platform
Perfect! Having seen that, I also found the "contentType" attribute and its 
description here:

https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIChannel

which allows me to mimic the behaviour.

Thanks a lot for the pointer!


John
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Equivalent for XMLHttpRequest.overrideMimeType() in the world of nsIHttpChannel

2019-09-16 Thread Valentin Gosu
The implementation of  XMLHttpRequest.overrideMimeType() is here:
https://searchfox.org/mozilla-central/rev/d1e33e3e11f559952d7d80e722d26a6cf5dd80ac/dom/xhr/XMLHttpRequestMainThread.cpp#3086-3090

You probably want to do something like this:
https://searchfox.org/mozilla-central/rev/d1e33e3e11f559952d7d80e722d26a6cf5dd80ac/dom/xhr/XMLHttpRequestMainThread.cpp#1826-1828

Cheers!

On Sat, 14 Sep 2019 at 09:45, john.bieling--- via dev-platform <
dev-platform@lists.mozilla.org> wrote:

> I am working on a wrapper for nsIHttpChannel with the interface of
> MLHttpRequest. Mainly to be able to use the codeBbasePrincipal (or
> ContextPrincipal as it is called now I think) with XHR requests, but
> without authors having to rewrite their code.
>
> This is for Thunderbird Add-Ons, which still can access nsIHttpChannel.
>
> I am pretty far and it is working nicely.
>
> However, I was not able to find a place in the nsIHttpChannel
> specification, which I could map to
>
> XMLHttpRequest.overrideMimeType()
>
> Is there any option/requirement to manually overide the MimeType of
> responses received via a nsIStreamListener or a nsIStreamLoaderObserver.
>
> The wrapper is here, if you want to have a look:
>
> https://gitlab.com/jobisoft/CardBook/blob/Thunderbird67+/chrome/content/cardbookHttpRequest.js
>
> Thanks for any help,
> John
> ___
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Equivalent for XMLHttpRequest.overrideMimeType() in the world of nsIHttpChannel

2019-09-14 Thread john.bieling--- via dev-platform
I am working on a wrapper for nsIHttpChannel with the interface of 
MLHttpRequest. Mainly to be able to use the codeBbasePrincipal (or 
ContextPrincipal as it is called now I think) with XHR requests, but without 
authors having to rewrite their code.

This is for Thunderbird Add-Ons, which still can access nsIHttpChannel.

I am pretty far and it is working nicely.

However, I was not able to find a place in the nsIHttpChannel specification, 
which I could map to

XMLHttpRequest.overrideMimeType()

Is there any option/requirement to manually overide the MimeType of responses 
received via a nsIStreamListener or a nsIStreamLoaderObserver.

The wrapper is here, if you want to have a look:
https://gitlab.com/jobisoft/CardBook/blob/Thunderbird67+/chrome/content/cardbookHttpRequest.js

Thanks for any help,
John
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform