1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 02:34:11 +01:00

Make things not explode.

This commit is contained in:
Kris Maglione
2012-01-15 15:50:14 -05:00
parent 16ca1f4983
commit 53d6587fc7
4 changed files with 34 additions and 7 deletions

View File

@@ -710,6 +710,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* responseType: {string} Override the type of the "response"
* property.
*
* headers: {objects} Extra request headers.
*
* user: {string} The user name to send via HTTP Authentication.
* pass: {string} The password to send via HTTP Authentication.
*
@@ -749,12 +751,18 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
params.data = data;
}
if (params.mimeType)
xmlhttp.overrideMimeType(params.mimeType);
xmlhttp.open(params.method || "GET", url, async,
params.user, params.pass);
let args = [params.method || "GET", url, async];
if (params.user != null || params.pass != null)
args.push(params.user);
if (params.pass != null)
args.push(prams.pass);
xmlhttp.open.apply(xmlhttp, args);
for (let [header, val] in Iterator(params.headers || {}))
xmlhttp.setRequestHeader(header, val);
if (params.responseType)
xmlhttp.responseType = params.responseType;