Skip to content

Commit

Permalink
Fix q tool has no scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fgervasi committed Dec 20, 2022
1 parent 3766544 commit fc643b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions plugins/screenshot/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@ async function getFinishedPage(
});

const scriptContent = await getConcatenatedAssets(scripts, userAgent);
await page.mainFrame().addScriptTag({
content: scriptContent,
});

if(scriptContent) {
await page.mainFrame().addScriptTag({
content: scriptContent,
});
}

// wait for the next idle callback (to have most probably finished all work)
await page.evaluate(`() => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/screenshot/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function getScreenshotResponse(server, h, params, item) {

const renderingInfo = JSON.parse(response.payload);

if (typeof renderingInfo === "object" && !!renderingInfo.scripts.content) {
if (typeof renderingInfo === "object") {
throw new Boom.Boom(
`Failed to get valid renderingInfo content in headless chrome for screenshot for ${item.tool} and ${params.target} with the error: ${response.statusMessage}`,
{
Expand Down

0 comments on commit fc643b3

Please sign in to comment.