diff options
author | Jesús <heckyel@hyperbola.info> | 2019-08-11 19:58:26 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-08-11 19:58:26 -0500 |
commit | 9ec39f09621c9975582a2b6d9a6fa0313b308086 (patch) | |
tree | 918786fdf371606f80bc9cdfbc2966909703e9bf /js/vapi-cookies.js | |
parent | 144581a54b8bb1808e23a3ea5c81e619e36a459f (diff) | |
download | ematrix-9ec39f09621c9975582a2b6d9a6fa0313b308086.tar.lz ematrix-9ec39f09621c9975582a2b6d9a6fa0313b308086.tar.xz ematrix-9ec39f09621c9975582a2b6d9a6fa0313b308086.zip |
remove tabs in javascript files
Diffstat (limited to 'js/vapi-cookies.js')
-rw-r--r-- | js/vapi-cookies.js | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/js/vapi-cookies.js b/js/vapi-cookies.js index 569205c..b1e2fb3 100644 --- a/js/vapi-cookies.js +++ b/js/vapi-cookies.js @@ -29,90 +29,90 @@ vAPI.cookies = {}; vAPI.cookies.CookieEntry = function (ffCookie) { - this.domain = ffCookie.host; - this.name = ffCookie.name; - this.path = ffCookie.path; - this.secure = ffCookie.isSecure === true; - this.session = ffCookie.expires === 0; - this.value = ffCookie.value; + this.domain = ffCookie.host; + this.name = ffCookie.name; + this.path = ffCookie.path; + this.secure = ffCookie.isSecure === true; + this.session = ffCookie.expires === 0; + this.value = ffCookie.value; }; vAPI.cookies.start = function () { - Services.obs.addObserver(this, 'cookie-changed', false); - Services.obs.addObserver(this, 'private-cookie-changed', false); - vAPI.addCleanUpTask(this.stop.bind(this)); + Services.obs.addObserver(this, 'cookie-changed', false); + Services.obs.addObserver(this, 'private-cookie-changed', false); + vAPI.addCleanUpTask(this.stop.bind(this)); }; vAPI.cookies.stop = function () { - Services.obs.removeObserver(this, 'cookie-changed'); - Services.obs.removeObserver(this, 'private-cookie-changed'); + Services.obs.removeObserver(this, 'cookie-changed'); + Services.obs.removeObserver(this, 'private-cookie-changed'); }; vAPI.cookies.observe = function (subject, topic, reason) { - //if ( topic !== 'cookie-changed' && topic !== 'private-cookie-changed' ) { - // return; - //} - // - if (reason === 'cleared' && typeof this.onAllRemoved === 'function') { + //if ( topic !== 'cookie-changed' && topic !== 'private-cookie-changed' ) { + // return; + //} + // + if (reason === 'cleared' && typeof this.onAllRemoved === 'function') { this.onAllRemoved(); return; - } - if (subject === null) { + } + if (subject === null) { return; - } - if (subject instanceof Ci.nsICookie2 === false) { + } + if (subject instanceof Ci.nsICookie2 === false) { try { - subject = subject.QueryInterface(Ci.nsICookie2); + subject = subject.QueryInterface(Ci.nsICookie2); } catch (ex) { - return; + return; } - } - if (reason === 'deleted') { + } + if (reason === 'deleted') { if (typeof this.onRemoved === 'function') { - this.onRemoved(new this.CookieEntry(subject)); + this.onRemoved(new this.CookieEntry(subject)); } return; - } - if (typeof this.onChanged === 'function') { + } + if (typeof this.onChanged === 'function') { this.onChanged(new this.CookieEntry(subject)); - } + } }; vAPI.cookies.getAll = function(callback) { - // Meant and expected to be asynchronous. - if (typeof callback !== 'function') { + // Meant and expected to be asynchronous. + if (typeof callback !== 'function') { return; - } - - let onAsync = function () { + } + + let onAsync = function () { let out = []; let enumerator = Services.cookies.enumerator; let ffcookie; while (enumerator.hasMoreElements()) { - ffcookie = enumerator.getNext(); - if (ffcookie instanceof Ci.nsICookie) { + ffcookie = enumerator.getNext(); + if (ffcookie instanceof Ci.nsICookie) { out.push(new this.CookieEntry(ffcookie)); - } + } } - + callback(out); - }; - - vAPI.setTimeout(onAsync.bind(this), 0); + }; + + vAPI.setTimeout(onAsync.bind(this), 0); }; vAPI.cookies.remove = function (details, callback) { - let uri = Services.io.newURI(details.url, null, null); - let cookies = Services.cookies; - cookies.remove(uri.asciiHost, details.name, uri.path, false, {}); - cookies.remove( '.' + uri.asciiHost, details.name, uri.path, false, {}); - - if (typeof callback === 'function') { + let uri = Services.io.newURI(details.url, null, null); + let cookies = Services.cookies; + cookies.remove(uri.asciiHost, details.name, uri.path, false, {}); + cookies.remove( '.' + uri.asciiHost, details.name, uri.path, false, {}); + + if (typeof callback === 'function') { callback({ - domain: uri.asciiHost, - name: details.name, - path: uri.path + domain: uri.asciiHost, + name: details.name, + path: uri.path }); - } + } }; })(); |