Replace hidden browser usage in translateTest with a DOMParser doc
This commit is contained in:
parent
2095f38ea5
commit
87c4eec3ef
1 changed files with 4 additions and 7 deletions
|
@ -17,10 +17,10 @@ function saveItemsThroughTranslator(translatorType, items) {
|
|||
}
|
||||
|
||||
let translate = new Zotero.Translate[tyname]();
|
||||
let browser;
|
||||
if (translatorType == "web") {
|
||||
browser = Zotero.Browser.createHiddenBrowser();
|
||||
translate.setDocument(browser.contentDocument);
|
||||
let doc = Zotero.HTTP.wrapDocument(new DOMParser().parseFromString('<html></html>', 'text/html'),
|
||||
`http://localhost/`);
|
||||
translate.setDocument(doc);
|
||||
} else if (translatorType == "import") {
|
||||
translate.setString("");
|
||||
}
|
||||
|
@ -35,10 +35,7 @@ function saveItemsThroughTranslator(translatorType, items) {
|
|||
" item.complete();\n"+
|
||||
" }\n"+
|
||||
"}"));
|
||||
return translate.translate().then(function(items) {
|
||||
if (browser) Zotero.Browser.deleteHiddenBrowser(browser);
|
||||
return items;
|
||||
});
|
||||
return translate.translate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue