diff --git a/chrome/content/scaffold/scaffold.js b/chrome/content/scaffold/scaffold.js index d10d04c95d..3c72e672e4 100644 --- a/chrome/content/scaffold/scaffold.js +++ b/chrome/content/scaffold/scaffold.js @@ -514,6 +514,13 @@ var Scaffold = new function() { return; } translate.setDocument(input); + + // Use cookies from browser pane + translate.setCookieSandbox(new Zotero.CookieSandbox( + null, + _getDocumentURL(input), + input.cookie + )); } else if (functionToRun == "detectImport" || functionToRun == "doImport") { var translate = new Zotero.Translate.Import(); translate.setString(input); diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 7520812640..54891bd5ec 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -425,6 +425,9 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function (test, testDone + " second(s) for page content to settle"); } setTimeout(() => { + // Use cookies from document in translator HTTP requests + this._cookieSandbox = new Zotero.CookieSandbox(null, test.url, doc.cookie); + this.runTest(test, doc, function (obj, test, status, message) { Zotero.Browser.deleteHiddenBrowser(browser); testDoneCallback(obj, test, status, message); @@ -639,6 +642,14 @@ Zotero_TranslatorTester.prototype.newTest = function(doc, testReadyCallback) { translate.setTranslatorProvider(this.translatorProvider); } translate.setDocument(doc); + // Use cookies from document + if (doc.cookie) { + translate.setCookieSandbox(new Zotero.CookieSandbox( + null, + doc.location.href, + doc.cookie + )); + } translate.setTranslator(this.translator); translate.setHandler("debug", this._debug); translate.setHandler("select", function(obj, items, callback) {