-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destroy workers when they are no longer needed in the unit tests #6904
Conversation
beebf36
to
81f40fb
Compare
expect(pageLabels[2]).toEqual([]); | ||
var promises = [loadingTask0.promise, loadingTask1.promise, | ||
loadingTask2.promise]; | ||
Promise.all(promises).then(function (documents) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't removing waitsForPromiseResolved
cause issues if one (or more) of the promises is rejected, since then the test will pass despite not actually testing anything?
You probably need to do something like this instead, to ensure that you catch every possible failure mode:
@@ -338,17 +338,20 @@ describe('api', function() {
it('gets page labels', function () {
// PageLabels with Roman/Arabic numerals.
var url0 = combineUrl(window.location.href, '../pdfs/bug793632.pdf');
- var promise0 = PDFJS.getDocument(url0).promise.then(function (pdfDoc) {
+ var loadingTask0 = PDFJS.getDocument(url0);
+ var promise0 = loadingTask0.promise.then(function (pdfDoc) {
return pdfDoc.getPageLabels();
});
// PageLabels with only a label prefix.
var url1 = combineUrl(window.location.href, '../pdfs/issue1453.pdf');
- var promise1 = PDFJS.getDocument(url1).promise.then(function (pdfDoc) {
+ var loadingTask1 = PDFJS.getDocument(url1);
+ var promise1 = loadingTask1.promise.then(function (pdfDoc) {
return pdfDoc.getPageLabels();
});
// PageLabels identical to standard page numbering.
var url2 = combineUrl(window.location.href, '../pdfs/rotation.pdf');
- var promise2 = PDFJS.getDocument(url2).promise.then(function (pdfDoc) {
+ var loadingTask2 = PDFJS.getDocument(url2);
+ var promise2 = loadingTask2.promise.then(function (pdfDoc) {
return pdfDoc.getPageLabels();
});
@@ -357,6 +360,10 @@ describe('api', function() {
expect(pageLabels[0]).toEqual(['i', 'ii', 'iii', '1']);
expect(pageLabels[1]).toEqual(['Front Page1']);
expect(pageLabels[2]).toEqual([]);
+
+ loadingTask0.destroy();
+ loadingTask1.destroy();
+ loadingTask2.destroy();
});
});
it('gets attachments', function() {
Note that this might be an issue elsewhere in the patch too, I've not looked through all of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the new commit.
81f40fb
to
e598082
Compare
Yes, this is actually a pre-existing issue, and I think that this should fix it: master...Snuffleupagus:oplist-destroy. |
626bf23
to
5bcf4c1
Compare
…ned the complete `OperatorList`, and prevent errors in `PDFPageProxy_destroy` for the 'oplist' rendering intent
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/705927c8c8255fb/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/705927c8c8255fb/output.txt Total script time: 0.80 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/09d74e2a81001a0/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/32e64e119a3cfe5/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/32e64e119a3cfe5/output.txt Total script time: 20.13 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/09d74e2a81001a0/output.txt Total script time: 21.40 mins
|
Thank you for the patch. |
Destroy workers when they are no longer needed in the unit tests
Fixes #6877.