/usr/lib/xul-ext/webaccounts/content/browser.js is in xul-ext-webaccounts 0.5-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | (function() {
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const kObserverTopic = "webapps-login";
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
function collectCookies(msg) {
var cookies = Services.cookies.getCookiesFromHost(msg.domain);
dump("Collecting cookies\n");
var cookieDict = {}
while (cookies.hasMoreElements()){
var cookie = cookies.getNext().QueryInterface(Ci.nsICookie);
var hostCookies = ""
if (cookie.host in cookieDict) {
hostCookies = cookieDict[cookie.host];
hostCookies += ";" + cookie.name + "=" + cookie.value;
} else {
hostCookies = cookie.name + "=" + cookie.value;
}
cookieDict[cookie.host] = hostCookies;
}
if (typeof this.libWebAccounts == "undefined") {
this.libWebAccounts = ctypes.open("/usr/lib/x86_64-linux-gnu/webaccounts-browser-extension/libwebaccounts.so");
}
var setLoginInfo = this.libWebAccounts.declare("webaccounts_login_handler_set_json",
ctypes.default_abi,
ctypes.void_t,
ctypes.char.ptr);
setLoginInfo(JSON.stringify({
login: msg.login,
domain: msg.domain,
cookies: cookieDict
}));
}
window.addEventListener("load", function() {
window.removeEventListener("load", arguments.callee, false);
var WebAccountsObserver = {
observe: function(subject, topic, login) {
if (topic != 'webapps-login' || login == "") return;
dump("Login: " + login + "\n");
var loginObj = JSON.parse(login);
if (loginObj.login) {
collectCookies(loginObj);
}
}
};
Services.obs.addObserver(WebAccountsObserver, kObserverTopic, false);
window.addEventListener("unload", function() {
window.removeEventListener("unload", arguments.callee, false);
Services.obs.removeObserver(WebAccountsObserver, kObserverTopic);
dump("Webaccounts extension unloaded\n");
}, false);
dump("Webaccounts extension loaded\n");
}, false);
})();
|