Thank you very much. That really helped.
Now, I've got a question relating to the content type.
I have installed the wmlbrowser extension to my firefox and now try to
change the content type in the source code.
They define a content type for wml:
const WMLSTREAM_CONVERT_CONVERSION = "?from=text/vnd.wap.wml&to=*/*";
If I try to change it to one of the following versions nothing happens:
"?from=text/xml&to=text/html";
"?from=text/xml&to=*/*";
"?from=text/html&to=*/*";
The StreamConverter is not invoked. I wanted to react to wsdl documents
which are (in my case) of the content type text/xml.
The last (html) version is not invoked either when trying to obtain an
HTML site like google.com.
registerSelf contains the following code:
const WMLSTREAM_CONVERT_CONVERSION = "?from=text/xml&to=text/html";
//"?from=text/vnd.wap.wml&to=*/*";
const WMLSTREAM_CONVERTER_CONTRACTID =
"@mozilla.org/streamconv;1" + WMLSTREAM_CONVERT_CONVERSION;
const WMLSTREAM_CONVERTER_CID =
Components.ID("{51427b76-8626-4a72-bd5f-2ac0ce5d101a}");
WMLBrowserModule.registerSelf =
function (compMgr, fileSpec, location, type)
{
dump("registerSelf\n");
var compMgr =
compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
compMgr.registerFactoryLocation(WMLSTREAM_CONVERTER_CID,
"WML Stream Converter",
WMLSTREAM_CONVERTER_CONTRACTID,
fileSpec,
location,
type);
var catman = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
catman.addCategoryEntry("@mozilla.org/streamconv;1",
WMLSTREAM_CONVERT_CONVERSION,
"WML to HTML stream converter",
true, true);
};
Thanks again,
Steffen
Christian Biesinger wrote:
> Steffen Heinzl wrote:
>> My main question is: How can I modify the data, so the modified web site
>> is displayed in the browser?
>
> It's probably easiest if you change the contentType property of the
> channel and register a stream converter to convert from that to */*. The
> stream converter can then do whatever it wants with the data.
>
>> Another question is why I cannot use subject.asyncOpen. Instead I have
>> to open a new channel to the URI's address, and then call asyncOpen().
>
> Because the channel got already opened by the code that wanted the
> data... You can't open a channel twice. Note that your approach of
> opening a new channel (probably) causes another connection to the server
>
> BTW, looking at your code:
> var scriptableStream =
> Components.classes["@mozilla.org/scriptableinputstream;1"].getService(Components.interfaces.nsIScriptableInputStream);
>
>
> You shouldn't use getService for streams; use createInstance (your code
> does that correct in another place)
>
> -christian
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network