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 translate = new Zotero.Translate[tyname]();
|
||||||
let browser;
|
|
||||||
if (translatorType == "web") {
|
if (translatorType == "web") {
|
||||||
browser = Zotero.Browser.createHiddenBrowser();
|
let doc = Zotero.HTTP.wrapDocument(new DOMParser().parseFromString('<html></html>', 'text/html'),
|
||||||
translate.setDocument(browser.contentDocument);
|
`http://localhost/`);
|
||||||
|
translate.setDocument(doc);
|
||||||
} else if (translatorType == "import") {
|
} else if (translatorType == "import") {
|
||||||
translate.setString("");
|
translate.setString("");
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,7 @@ function saveItemsThroughTranslator(translatorType, items) {
|
||||||
" item.complete();\n"+
|
" item.complete();\n"+
|
||||||
" }\n"+
|
" }\n"+
|
||||||
"}"));
|
"}"));
|
||||||
return translate.translate().then(function(items) {
|
return translate.translate();
|
||||||
if (browser) Zotero.Browser.deleteHiddenBrowser(browser);
|
|
||||||
return items;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue