Mendeley import: Clear cookies when closing OAuth window

This commit is contained in:
Dan Stillman 2021-04-30 07:10:33 -04:00
parent 911e1637f2
commit 3877563abe

View file

@ -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;
}