Scaffold: Improve cookie handling

- Use cookies from browser pane when running detectWeb or doWeb
- Use cookies from document when running or updating tests

This should fix various cases where translators can't be properly
developed or tested in Scaffold (e.g., [1]).

[1] https://github.com/zotero/translators/pull/2296#issuecomment-739116620
This commit is contained in:
Dan Stillman 2020-12-06 03:09:13 -05:00
parent 01646f1f8f
commit 558ad20ce6
2 changed files with 18 additions and 0 deletions

View file

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