mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #15398 from Snuffleupagus/more-optional-chaining
Use more optional chaining in the code-base
This commit is contained in:
commit
af6aacfc0e
15 changed files with 51 additions and 119 deletions
13
test/test.js
13
test/test.js
|
@ -854,9 +854,7 @@ function unitTestPostHandler(req, res) {
|
|||
var onCancel = null,
|
||||
ttxTimeout = 10000;
|
||||
var timeoutId = setTimeout(function () {
|
||||
if (onCancel) {
|
||||
onCancel("TTX timeout");
|
||||
}
|
||||
onCancel?.("TTX timeout");
|
||||
}, ttxTimeout);
|
||||
translateFont(
|
||||
body,
|
||||
|
@ -1002,9 +1000,7 @@ function startBrowsers(initSessionCallback, makeStartUrl = null) {
|
|||
session.browserPromise = startBrowser(browserName, startUrl)
|
||||
.then(function (browser) {
|
||||
session.browser = browser;
|
||||
if (initSessionCallback) {
|
||||
initSessionCallback(session);
|
||||
}
|
||||
initSessionCallback?.(session);
|
||||
})
|
||||
.catch(function (ex) {
|
||||
console.log(`Error while starting ${browserName}: ${ex.message}`);
|
||||
|
@ -1050,10 +1046,7 @@ async function closeSession(browser) {
|
|||
const rimraf = require("rimraf");
|
||||
rimraf.sync(tempDir);
|
||||
}
|
||||
|
||||
if (onAllSessionsClosed) {
|
||||
onAllSessionsClosed();
|
||||
}
|
||||
onAllSessionsClosed?.();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue