我在 http-on-examine-response 上定义了一个观察者
httpRequestObserver = {
observe: function(request, aTopic, aData){
if (aTopic == "http-on-examine-response") {
request.QueryInterface(Ci.nsIHttpChannel);
var newListener = new TracingListener();
request.QueryInterface(Ci.nsITraceableChannel);
newListener.originalListener = request.setNewListener(newListener);
}
},
QueryInterface: function(aIID){
if (typeof Cc == "undefined") {
var Cc = components.classes;
}
if (typeof Ci == "undefined") {
var Ci = components.interfaces;
}
if (aIID.equals(Ci.nsIObserver) ||
aIID.equals(Ci.nsISupports)) {
return this;
}
throw components.results.NS_NOINTERFACE;
},
};
我只想在响应的响应代码为 200 的情况下添加侦听器。基本上我想要完成的是避免 3xx 响应。但我无法从标题中读取 ResponseCode。如何在此处获取响应代码.
在此先感谢您的帮助...