From 738e9099c4dd72070e04c700147914060d5cab58 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 11 Mar 2025 11:03:56 -0700 Subject: [PATCH] Apply fix for WebGPU not loading in about:blank page but also rejecting HTML content overwrites in trusted chrome:// pages. Switch from complete overwrite of content to script injection. --- cli.js | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/cli.js b/cli.js index 62194ff..a6f0bc9 100755 --- a/cli.js +++ b/cli.js @@ -59,7 +59,12 @@ let start = performance.now(); ] }) const page = await browser.newPage() + await page.setBypassCSP(true) + await page.goto('chrome://newtab') page.on('console', async (msg) => { + console.log('start test') + console.log(msg.text()) + console.log('end test') const output = msg.text().split(' ') if (output[0] === 'cli') { if (output[1] === 'exit') { @@ -73,26 +78,26 @@ let start = performance.now(); } }) start = performance.now() - await page.setContent(` - - - - - - - - `) + await page.addScriptTag({ + type: 'module', + content: ` + window.trustedTypes?.createPolicy?.('default', { + createHTML: string => string, + createScriptURL: string => string, + createScript: string => string, + }) + ${NanoPow} + const hashes = ["${hashes.join('","')}"] + for (const hash of hashes) { + try { + console.log(\`cli \${hash}\`) + const work = await NanoPow.search(hash) + console.log(\`cli \${work}\`) + } catch (err) { + console.error(\`cli \${err}\`) + } + } + console.log('cli exit') + ` + }) })() -- 2.34.1