From 3877563abeadc0edd97e698ae116ca7282a49123 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 30 Apr 2021 07:10:33 -0400 Subject: [PATCH] Mendeley import: Clear cookies when closing OAuth window --- chrome/content/zotero/fileInterface.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 31751fd2aa..36162745c6 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -867,6 +867,22 @@ var Zotero_File_Interface = new function() { if (matchResult) { const mendeleyAccessToken = matchResult[1]; Zotero.getMainWindow().setTimeout(() => this.showImportWizard({ mendeleyAccessToken }), 0); + + // Clear all cookies to remove access + // + // This includes unrelated cookies in the central cookie store, but that's fine for + // the moment, since we're not purposely using cookies for anything else. + // + // TODO: Switch to removeAllSince() once >Fx60 + try { + Cc["@mozilla.org/cookiemanager;1"] + .getService(Ci.nsICookieManager) + .removeAll(); + } + catch (e) { + Zotero.logError(e); + } + win.close(); return; }