lib/grover.rb in grover-0.7.1 vs lib/grover.rb in grover-0.7.2
- old
+ new
@@ -30,11 +30,11 @@
try {
let launchParams = #{launch_params};
// Configure puppeteer debugging options
const debug = options.debug; delete options.debug;
- if (debug != undefined) {
+ if (typeof debug === 'object' && !!debug) {
if (debug.headless != undefined) { launchParams.headless = debug.headless; }
if (debug.devtools != undefined) { launchParams.devtools = debug.devtools; }
}
// Launch the browser and create a page
@@ -76,11 +76,11 @@
const emulateMedia = options.emulateMedia; delete options.emulateMedia;
if (emulateMedia != undefined) {
await page.emulateMedia(emulateMedia);
}
- // If we're not running puppeteer in headless mode, return the converted PDF
- if (debug == undefined || debug.headless == undefined || debug.headless) {
+ // If we're running puppeteer in headless mode, return the converted PDF
+ if (debug == undefined || (typeof debug === 'object' && (debug.headless == undefined || debug.headless))) {
return await page.pdf(options);
}
} finally {
if (browser) {
await browser.close();