1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 15:45:46 +01:00

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

This commit is contained in:
Kris Maglione
2012-03-13 17:52:22 -04:00
parent cab8f93eef
commit 7479e92d39
2 changed files with 13 additions and 0 deletions

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) {