Allow passing strings or arrays as postData parameters to dactyl.open.

This commit is contained in:
Kris Maglione committed 2012-03-13 17:52:22 -04:00
1 parent cab8f93eef
commit 7479e92d39
2 files changed
+13

No files matched your search

+12
View File
@@ -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) {