aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cookiemanager.js
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan@mozilla.com>2010-05-31 00:59:00 -0400
committerEhsan Akhgari <ehsan@mozilla.com>2010-05-31 00:59:00 -0400
commitced6558b039bd1369715f94fc4cf902076082389 (patch)
treef07760ba4f3fe6262167ec61a9301bf2ca6d6483 /lib/cookiemanager.js
parentb94aade3d4867c5a2a9aa3948ff54b671c31d570 (diff)
downloadbugzilla-triage-ced6558b039bd1369715f94fc4cf902076082389.tar.gz
Don't pass cookie XPCOM objects across package boundaries
Diffstat (limited to 'lib/cookiemanager.js')
-rw-r--r--lib/cookiemanager.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/cookiemanager.js b/lib/cookiemanager.js
index 5b9df5c..047b988 100644
--- a/lib/cookiemanager.js
+++ b/lib/cookiemanager.js
@@ -37,6 +37,18 @@
exports.getHostCookies = function getHostCookies(host) {
var cm = Cc["@mozilla.org/cookiemanager;1"].
getService(Ci.nsICookieManager2);
- return cm.getCookiesFromHost(host);
+ var e = cm.getCookiesFromHost(host);
+ var result = [];
+ while (e.hasMoreElements()) {
+ var cookie = e.getNext();
+ cookie.QueryInterface(Ci.nsICookie2);
+ if (cookie.rawHost == host) {
+ result.push({
+ name: cookie.name,
+ value: cookie.value,
+ });
+ }
+ }
+ return result;
}