Review for Pan by 龍門渕透華
Rated 5 out of 5 stars
比如说我正在使用的X-notifier插件, 上次回答说有可能是协议有关, 我特意去看了这个插件的gmail收信script, 里面主要用到getHtml, 而对应的网址就只有两个, "https://accounts.google.com"和"https://mail.google.com/mail/"
但按您上次回复的extensions.pan.proxyScheme的默认值["http","https","ftp","wss"]
那么https是有的,但是gmail收信就是超时,我把pan设成全局就能收到.
getHtml的大概是这样的
Handler.prototype.getHtml = function(aURL,aPostData,aHeaders,aMethod) {
if(aURL instanceof Array){
aPostData=aURL[1];
aHeaders=aURL[2];
aMethod=aURL[3];
aURL=aURL[0];
}
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var uri = ioService.newURI(aURL, null, null);
var channel = ioService.newChannelFromURI(uri);
var httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
if (aPostData||aPostData=="") {
var uploadStream = Components.classes["@mozilla.org/io/string-input-stream;1"]
.createInstance(Ci.nsIStringInputStream);
uploadStream.setData(aPostData, aPostData.length);
var uploadChannel = channel.QueryInterface(Ci.nsIUploadChannel);
uploadChannel.setUploadStream(uploadStream, "application/x-www-form-urlencoded", -1);
httpChannel.requestMethod = "POST";
}
//if(this.userAgent)httpChannel.setRequestHeader("User-Agent",this.userAgent,false);
if(aHeaders){
for(var t in aHeaders){
httpChannel.setRequestHeader(t,aHeaders[t],false);
}
}
if(aMethod)httpChannel.requestMethod=aMethod;
this.channel=channel;
channel.notificationCallbacks = this;
channel.asyncOpen(this,httpChannel);
}
To create your own collections, you must have a Mozilla Add-ons account.