Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I compile this extension for firefox?
    primarykey
    data
    text
    <p>How can I compile this into a firefox addon? I have tried to use firefox's addon builder located at <a href="https://builder.addons.mozilla.org" rel="nofollow">https://builder.addons.mozilla.org</a> but when I click test it says "XPI not built". Can anybody tell me how I may turn this code into a function firefox extension? Thank you. </p> <pre><code>//create an nsIObserver implementor var listener = { observe : function(aSubject, aTopic, aData) { var httpChannel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel); if (aTopic == "http-on-modify-request") { var channel= aSubject.QueryInterface(Components.interfaces.nsIHttpChannel); if(channel.requestMethod == "POST") { channel=channel.QueryInterface(Components.interfaces.nsIUploadChannel); channel = channel.uploadStream; channel.QueryInterface(Components.interfaces.nsISeekableStream) .seek(Components.interfaces.nsISeekableStream.NS_SEEK_SET, 0); var stream = Components.classes["@mozilla.org/binaryinputstream;1"] .createInstance(Components.interfaces.nsIBinaryInputStream); stream.setInputStream(channel); var postBytes = stream.readByteArray(stream.available()); poststr = String.fromCharCode.apply(null, postBytes); //change the poststr // poststr=poststr.replace(....); // ERROR HERE - stringStream is not defined stringStream.setData(poststr, poststr.length); //changing the postdata channel = channel.QueryInterface(Components.interfaces.nsIUploadChannel); channel = channel.uploadStream; channel = channel.QueryInterface(Components.interfaces.nsISeekableStream) .seek(Components.interfaces.nsISeekableStream.NS_SEEK_SET, 0); channel.uploadStream.QueryInterface(Components.interfaces.nsIMIMEInputStream); channel.uploadStream.setData(stringStream); channel.requestMethod = "POST"; } } }, QueryInterface : function(aIID) { if (aIID.equals(Components.interfaces.nsISupports) || aIID.equals(Components.interfaces.nsIObserver)) return this; throw Components.results.NS_NOINTERFACE; } }; var observerService = null; var Init = { addObserver : function(){ observerService = Components.classes["@mozilla.org/observer- service;1"].getService(Components.interfaces.nsIObserverService); observerService.addObserver(listener, "http-on-modify-request", false); }, removeObserver : function(){ observerService.removeObserver(listener, "http-on-modify-request"); } }; Init.addObserver(); </code></pre> <ul> <li>edit: I have read the official Firefox documents but it is confusing, it deals mainly with gui based addons and doesn't provide much example how I would create an extension for this. </li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload