Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
Fix waitForText not found double callback error
Browse files Browse the repository at this point in the history
  • Loading branch information
msokk committed Jan 26, 2017
1 parent 67d68c4 commit 2859def
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ exports.renderWorker = function renderWorker(window, task, done) {
webContents.on('found-in-page', function foundInPage(event, result) {
if (result.matches === 0) {
const isRetrying = waitOperation.retry(new Error('not ready to render'));
if (!isRetrying) done(new RendererError('TEXT_NOT_FOUND', `Failed to find text: ${task.waitForText}`, 404));
return;
}

if (result.finalUpdate) {
if (!isRetrying) {
done(new RendererError('TEXT_NOT_FOUND', `Failed to find text: ${task.waitForText}`, 404));
webContents.removeListener('found-in-page', foundInPage);
}
} else if (result.finalUpdate) {
webContents.stopFindInPage('clearSelection');
webContents.removeListener('found-in-page', foundInPage);
renderIt();
Expand Down

0 comments on commit 2859def

Please sign in to comment.