mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 19:07:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
20
dom/html/test/file_cookiemanager.js
Normal file
20
dom/html/test/file_cookiemanager.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
let { classes: Cc, interfaces: Ci } = Components;
|
||||
addMessageListener("getCookieFromManager", ({ host, path }) => {
|
||||
let cm = Cc["@mozilla.org/cookiemanager;1"]
|
||||
.getService(Ci.nsICookieManager);
|
||||
let values = [];
|
||||
path = path.substring(0, path.lastIndexOf("/") + 1);
|
||||
let e = cm.enumerator;
|
||||
while (e.hasMoreElements()) {
|
||||
let cookie = e.getNext().QueryInterface(Ci.nsICookie);
|
||||
if (!cookie) {
|
||||
break;
|
||||
}
|
||||
if (host != cookie.host || path != cookie.path) {
|
||||
continue;
|
||||
}
|
||||
values.push(cookie.name + "=" + cookie.value);
|
||||
}
|
||||
|
||||
sendAsyncMessage("getCookieFromManager:return", { cookie: values.join("; ") });
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue