From 3b8e8bea33078ef03effeaf6fbd0a09b7901b9e1 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 25 Jun 2025 10:26:49 -0400 Subject: [PATCH] Register CookieSandbox observer at startup (#5357) --- chrome/content/zotero/xpcom/cookieSandbox.js | 8 ++++++-- chrome/content/zotero/xpcom/zotero.js | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/cookieSandbox.js b/chrome/content/zotero/xpcom/cookieSandbox.js index 6bd08128f6..4832b074b0 100755 --- a/chrome/content/zotero/xpcom/cookieSandbox.js +++ b/chrome/content/zotero/xpcom/cookieSandbox.js @@ -60,6 +60,10 @@ Zotero.CookieSandbox = function (browser, uri, cookieData, userAgent) { } }; +Zotero.CookieSandbox.init = function () { + Zotero.CookieSandbox.Observer.register(); +}; + /** * Normalizes the host string: lower-case, remove leading period, some more cleanup * @param {String} host; @@ -232,8 +236,8 @@ Zotero.CookieSandbox.prototype = { cookies = {}, found = false, secure = uri.scheme.toUpperCase() == 'HTTPS'; // Fetch cookies starting from the highest level domain - var cookieHost = '.' + hostParts[hostParts.length-1]; - for(var i=hostParts.length-2; i>=0; i--) { + var cookieHost = ''; + for(var i=hostParts.length-1; i>=0; i--) { cookieHost = '.' + hostParts[i] + cookieHost; if(this._cookies[cookieHost]) { found = this._getCookiesForPath(cookies, this._cookies[cookieHost], pathParts, secure, i==0) || found; diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index e4ba8eba70..3261f0d6d9 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -712,6 +712,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); Zotero.Streamer.init(); Zotero.MIMETypeHandler.init(); + Zotero.CookieSandbox.init(); yield Zotero.Proxies.init(); // Initialize keyboard shortcuts