diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 1fa8f216..1ccc1bda 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -952,6 +952,18 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { loc = { url: loc[0], postData: loc[1] }; else if (isString(loc)) loc = { url: loc }; + else + loc = Object.create(loc); + + if (isString(loc.postData)) + loc.postData = ["application/x-www-form-urlencoded", loc.postData]; + + if (isArray(loc.postData)) { + let stream = services.MIMEStream(services.StringStream(loc.postData[1])); + stream.addHeader("Content-Type", loc.postData[0]); + stream.addContentLength = true; + loc.postData = stream; + } // decide where to load the first url switch (where) { diff --git a/common/modules/services.jsm b/common/modules/services.jsm index d47da247..bf8db8c2 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -92,6 +92,7 @@ var Services = Module("Services", { this.addClass("HtmlEncoder", "@mozilla.org/layout/htmlCopyEncoder;1", "nsIDocumentEncoder"); this.addClass("InterfacePointer", "@mozilla.org/supports-interface-pointer;1", "nsISupportsInterfacePointer", "data"); this.addClass("InputStream", "@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream", "init"); + this.addClass("MIMEStream", "@mozilla.org/network/mime-input-stream;1", "nsIMIMEInputStream", "setData"); this.addClass("Persist", "@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist"); this.addClass("Pipe", "@mozilla.org/pipe;1", "nsIPipe", "init"); this.addClass("Process", "@mozilla.org/process/util;1", "nsIProcess", "init");