Disable error reporting in Scaffold
This commit is contained in:
parent
ac7eb87632
commit
a37dd2462a
2 changed files with 21 additions and 13 deletions
|
@ -1000,7 +1000,7 @@ var Scaffold = new function () {
|
|||
let translate;
|
||||
let isRemoteWeb = false;
|
||||
if (functionToRun == "detectWeb" || functionToRun == "doWeb") {
|
||||
translate = new RemoteTranslate();
|
||||
translate = new RemoteTranslate({ disableErrorReporting: true });
|
||||
isRemoteWeb = true;
|
||||
if (!_testTargetRegex(input)) {
|
||||
_logOutput("Target did not match " + _getCurrentURI(input));
|
||||
|
@ -1703,7 +1703,7 @@ var Scaffold = new function () {
|
|||
let input = await _getInput(type);
|
||||
|
||||
if (type == "web") {
|
||||
let translate = new RemoteTranslate();
|
||||
let translate = new RemoteTranslate({ disableErrorReporting: true });
|
||||
try {
|
||||
await translate.setBrowser(_browser);
|
||||
await translate.setTranslatorProvider(_translatorProvider);
|
||||
|
@ -2074,7 +2074,7 @@ var Scaffold = new function () {
|
|||
_logOutput("Page URL differs from test. Will be updated. " + browser.currentURI.spec);
|
||||
}
|
||||
|
||||
let translate = new RemoteTranslate();
|
||||
let translate = new RemoteTranslate({ disableErrorReporting: true });
|
||||
try {
|
||||
await translate.setBrowser(browser);
|
||||
await translate.setTranslatorProvider(_translatorProvider);
|
||||
|
|
|
@ -52,7 +52,9 @@ class RemoteTranslate {
|
|||
|
||||
_wasSuccess = false;
|
||||
|
||||
constructor() {
|
||||
constructor({ disableErrorReporting = false } = {}) {
|
||||
this._disableErrorReporting = disableErrorReporting;
|
||||
|
||||
TranslationManager.add(this._id, this);
|
||||
TranslationManager.setHandler(this._id, 'done', (_, success) => this._wasSuccess = success);
|
||||
}
|
||||
|
@ -64,18 +66,24 @@ class RemoteTranslate {
|
|||
async setBrowser(browser) {
|
||||
this._browser = browser;
|
||||
let actor = this._browser.browsingContext.currentWindowGlobal.getActor("Translation");
|
||||
|
||||
// Make only relevant prefs available
|
||||
// https://github.com/zotero/zotero-connectors/blob/d5f025de9b4f513535cbf4639c6b59bf115d790d/src/common/zotero.js#L264-L265
|
||||
let prefs = this._getPrefs([
|
||||
'downloadAssociatedFiles',
|
||||
'automaticSnapshots',
|
||||
'reportTranslationFailure',
|
||||
'capitalizeTitles',
|
||||
'translators.',
|
||||
]);
|
||||
if (this._disableErrorReporting) {
|
||||
prefs.reportTranslationFailure = false;
|
||||
}
|
||||
|
||||
await actor.sendAsyncMessage("initTranslation", {
|
||||
schemaJSON: Zotero.File.getResource('resource://zotero/schema/global/schema.json'),
|
||||
dateFormatsJSON: Zotero.File.getResource('resource://zotero/schema/dateFormats.json'),
|
||||
// Make only relevant prefs available
|
||||
// https://github.com/zotero/zotero-connectors/blob/d5f025de9b4f513535cbf4639c6b59bf115d790d/src/common/zotero.js#L264-L265
|
||||
prefs: this._getPrefs([
|
||||
'downloadAssociatedFiles',
|
||||
'automaticSnapshots',
|
||||
'reportTranslationFailure',
|
||||
'capitalizeTitles',
|
||||
'translators.',
|
||||
]),
|
||||
prefs,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue