Merge pull request #12476 from Snuffleupagus/worker-rm-handler-scope
Remove the `scope` parameter from the "GetOperatorList" handler in `src/core/worker.js` (PR 11110 follow-up)
This commit is contained in:
commit
0700a3de36
@ -599,61 +599,56 @@ class WorkerMessageHandler {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.on(
|
handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
|
||||||
"GetOperatorList",
|
var pageIndex = data.pageIndex;
|
||||||
function wphSetupRenderPage(data, sink) {
|
pdfManager.getPage(pageIndex).then(function (page) {
|
||||||
var pageIndex = data.pageIndex;
|
var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
|
||||||
pdfManager.getPage(pageIndex).then(function (page) {
|
startWorkerTask(task);
|
||||||
var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
|
|
||||||
startWorkerTask(task);
|
|
||||||
|
|
||||||
// NOTE: Keep this condition in sync with the `info` helper function.
|
// NOTE: Keep this condition in sync with the `info` helper function.
|
||||||
const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
|
const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
|
||||||
|
|
||||||
// Pre compile the pdf page and fetch the fonts/images.
|
// Pre compile the pdf page and fetch the fonts/images.
|
||||||
page
|
page
|
||||||
.getOperatorList({
|
.getOperatorList({
|
||||||
handler,
|
handler,
|
||||||
sink,
|
sink,
|
||||||
task,
|
task,
|
||||||
intent: data.intent,
|
intent: data.intent,
|
||||||
renderInteractiveForms: data.renderInteractiveForms,
|
renderInteractiveForms: data.renderInteractiveForms,
|
||||||
annotationStorage: data.annotationStorage,
|
annotationStorage: data.annotationStorage,
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
function (operatorListInfo) {
|
function (operatorListInfo) {
|
||||||
finishWorkerTask(task);
|
finishWorkerTask(task);
|
||||||
|
|
||||||
if (start) {
|
if (start) {
|
||||||
info(
|
info(
|
||||||
`page=${pageIndex + 1} - getOperatorList: time=` +
|
`page=${pageIndex + 1} - getOperatorList: time=` +
|
||||||
`${Date.now() - start}ms, len=${operatorListInfo.length}`
|
`${Date.now() - start}ms, len=${operatorListInfo.length}`
|
||||||
);
|
);
|
||||||
}
|
|
||||||
sink.close();
|
|
||||||
},
|
|
||||||
function (reason) {
|
|
||||||
finishWorkerTask(task);
|
|
||||||
if (task.terminated) {
|
|
||||||
return; // ignoring errors from the terminated thread
|
|
||||||
}
|
|
||||||
// For compatibility with older behavior, generating unknown
|
|
||||||
// unsupported feature notification on errors.
|
|
||||||
handler.send("UnsupportedFeature", {
|
|
||||||
featureId: UNSUPPORTED_FEATURES.errorOperatorList,
|
|
||||||
});
|
|
||||||
|
|
||||||
sink.error(reason);
|
|
||||||
|
|
||||||
// TODO: Should `reason` be re-thrown here (currently that
|
|
||||||
// casues "Uncaught exception: ..." messages in the
|
|
||||||
// console)?
|
|
||||||
}
|
}
|
||||||
);
|
sink.close();
|
||||||
});
|
},
|
||||||
},
|
function (reason) {
|
||||||
this
|
finishWorkerTask(task);
|
||||||
);
|
if (task.terminated) {
|
||||||
|
return; // ignoring errors from the terminated thread
|
||||||
|
}
|
||||||
|
// For compatibility with older behavior, generating unknown
|
||||||
|
// unsupported feature notification on errors.
|
||||||
|
handler.send("UnsupportedFeature", {
|
||||||
|
featureId: UNSUPPORTED_FEATURES.errorOperatorList,
|
||||||
|
});
|
||||||
|
|
||||||
|
sink.error(reason);
|
||||||
|
|
||||||
|
// TODO: Should `reason` be re-thrown here (currently that casues
|
||||||
|
// "Uncaught exception: ..." messages in the console)?
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
handler.on("GetTextContent", function wphExtractText(data, sink) {
|
handler.on("GetTextContent", function wphExtractText(data, sink) {
|
||||||
var pageIndex = data.pageIndex;
|
var pageIndex = data.pageIndex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user