diff --git a/extension/chrome/content/firephp/FirePHP.js b/extension/chrome/content/firephp/FirePHP.js
index 0c596f4..6ace942 100755
--- a/extension/chrome/content/firephp/FirePHP.js
+++ b/extension/chrome/content/firephp/FirePHP.js
@@ -37,9 +37,12 @@ const nsIWebProgressListener = (FB_NEW)?Ci.nsIWebProgressListener:CI("nsIWebProg
const nsISupportsWeakReference = (FB_NEW)?Ci.nsISupportsWeakReference:CI("nsISupportsWeakReference");
const nsISupports = (FB_NEW)?Ci.nsISupport:CI("nsISupports");
-const ioService = CCSV("@mozilla.org/network/io-service;1", "nsIIOService");
+//const ioService = CCSV("@mozilla.org/network/io-service;1", "nsIIOService");
+const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
-const observerService = CCSV("@mozilla.org/observer-service;1", "nsIObserverService");
+//const observerService = CCSV("@mozilla.org/observer-service;1", "nsIObserverService");
+const observerService = Cc["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+
const STATE_TRANSFERRING = nsIWebProgressListener.STATE_TRANSFERRING;
const STATE_IS_DOCUMENT = nsIWebProgressListener.STATE_IS_DOCUMENT;
diff --git a/extension/chrome/content/firephp/RequestProcessor.js b/extension/chrome/content/firephp/RequestProcessor.js
index f28fcdc..9e3a414 100755
--- a/extension/chrome/content/firephp/RequestProcessor.js
+++ b/extension/chrome/content/firephp/RequestProcessor.js
@@ -445,7 +445,15 @@ FirePHPProcessor.ProcessRequest = function(Wildfire,URL,Data) {
try {
if(Wildfire.hasMessages()) {
-
+
+
+ Wildfire.addListenerOnMessageIsReady('http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
+ function(message) {
+ var item = json_parse(message);
+ this.processMessage(item[0].Type, item[1], item[0]);
+ }, this);
+
+
var messages = Wildfire.getMessages('http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
if(messages && messages.length>0) {
@@ -467,6 +475,12 @@ FirePHPProcessor.ProcessRequest = function(Wildfire,URL,Data) {
}
+ Wildfire.addListenerOnMessageIsReady('http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1',
+ function(message) {
+ var item = json_parse(messages[index]);
+ this.processMessage("dump", item, {"Label": "Dump"});
+ }, this);
+
messages = Wildfire.getMessages('http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
if(messages && messages.length>0) {
diff --git a/extension/chrome/content/firephp/Wildfire/Channel/HttpHeaders.js b/extension/chrome/content/firephp/Wildfire/Channel/HttpHeaders.js
index b90011f..6049943 100755
--- a/extension/chrome/content/firephp/Wildfire/Channel/HttpHeaders.js
+++ b/extension/chrome/content/firephp/Wildfire/Channel/HttpHeaders.js
@@ -7,6 +7,8 @@ Wildfire.Channel.HttpHeaders = function() {
this.protocol_ids = new Array();
+ this.options = new Array();
+
this.messages = new Array();
this.messageReceived = function(Key, Value)
@@ -22,7 +24,13 @@ Wildfire.Channel.HttpHeaders = function() {
this.protocol_ids[id] = Value;
- } else {
+ }
+ else if(Key.substr(this.headerPrefix.length,7)=='option-') {
+ var id = Key.substr(this.headerPrefix.length+7);
+
+ this.options[id] = Value == 'true' || Value == '1' || Value == 1;
+ }
+ else {
var parsed_key = this.parseKey(Key);
@@ -65,6 +73,10 @@ Wildfire.Channel.HttpHeaders = function() {
}
};
+ this.getOption = function(option) {
+ return(this.options[option]);
+ };
+
this.getProtocol = function(URI) {
if(!this.protocols[URI]) {
var protocol = this.initProtocol(URI);
diff --git a/extension/chrome/content/firephp/Wildfire/Plugin/FirePHP.js b/extension/chrome/content/firephp/Wildfire/Plugin/FirePHP.js
index 9918d27..eef63cf 100755
--- a/extension/chrome/content/firephp/Wildfire/Plugin/FirePHP.js
+++ b/extension/chrome/content/firephp/Wildfire/Plugin/FirePHP.js
@@ -20,6 +20,8 @@ Wildfire.Plugin.FirePHP = function() {
this.channel = new Wildfire.Channel.HttpHeaders;
this.messages = new Array();
+
+ this.callbackMessageIsReady = {};
this.init = function() {
@@ -77,13 +79,88 @@ Wildfire.Plugin.FirePHP = function() {
var messages = new Array();
+ var message_tmp;
+
for( var index in this.messages ) {
if(this.messages[index][1]==StructureURI) {
- messages.push(this.messages[index][2]);
+ message_tmp = this.messages[index][2];
+ if(this.channel.getOption('gzip')) {
+ //use callback onMessageIsReady
+ this._gzip_decode(StructureURI, message_tmp);
+ } else {
+ messages.push(message_tmp);
+ }
}
}
return messages;
};
-}
+ this.addListenerOnMessageIsReady = function(StructureURI, listener, context) {
+ this.callbackMessageIsReady[StructureURI] = [listener, context];
+ };
+
+ this._gzip_decode = function (StructureURI, s) { // Decompress an LZW-encoded string
+ var StreamListener = function(callback, context) {
+ this.data = [];
+ this.callbackOnReady = callback;
+ this.callbackContext = context;
+ };
+
+ StreamListener.prototype = {
+ onDataAvailable : function(request, context, inputStream, offset, count)
+ {
+ var scriptable = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
+ scriptable.init(inputStream);
+ this.data.push(scriptable.read(inputStream.available()));
+ },
+
+ onStartRequest : function(request, context)
+ {
+ this.data = [];
+ },
+
+ onStopRequest : function(request, context)
+ {
+ this.callbackOnReady.call(this.callbackContext, this.getData());
+ },
+
+ getData : function() {
+ return(this.data.join(''));
+ },
+
+ };
+
+ //listener for the converted data
+ var listener;
+ if(this.callbackMessageIsReady[StructureURI] && typeof(this.callbackMessageIsReady[StructureURI][0]) == 'function') {
+ listener = new StreamListener(this.callbackMessageIsReady[StructureURI][0], this.callbackMessageIsReady[StructureURI][1]);
+ } else {
+ listener = new StreamListener(function() {}, this);
+ }
+
+
+ var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+
+ var uri = ioService.newURI("data:gzip;base64," + s, null, null);
+
+ var chan = ioService.newChannelFromURI(uri);
+
+ var request = chan.QueryInterface(Components.interfaces.nsIRequest);
+
+ // Attempt to gunzip
+
+ var converterService = Components.classes["@mozilla.org/streamConverters;1"]
+ .getService(Components.interfaces.nsIStreamConverterService);
+
+ // Instantiate our gzip decompresser converter
+ var converterStreamListener = converterService.asyncConvertData("gzip",
+ "uncompressed", listener, null);
+
+
+ chan.asyncOpen(converterStreamListener, this);
+
+ };
+
+}
\ No newline at end of file
diff --git a/extension/install.rdf b/extension/install.rdf
index aacd2b6..3cc2f2e 100755
--- a/extension/install.rdf
+++ b/extension/install.rdf
@@ -8,7 +8,7 @@
FirePHPExtension-Build@firephp.org
FirePHP
- 0.6.2
+ 0.7
2
Christoph Dorn