-
Notifications
You must be signed in to change notification settings - Fork 9k
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
[Bug]: (Debugger.enable): Script execution is prohibited #11138
Comments
This issue was not reproducible. Please check that your example runs locally and the following:
Once the above checks are satisfied, please edit your issue with the changes and we will |
Shorter repro:
|
The bug is in Chrome https://bugs.chromium.org/p/chromium/issues/detail?id=1492053 |
So disabling ProcessPerSiteUpToMainFrameThreshold would fix the issue but ultimately the session is probably wrong here. The page is bfcached and the session is created to the initial target. That target gets put into the bfcache after navigation and while Debugger.enable might work for it, it is probably not what you want. |
Just to clarify, is there something that needs to change in the script for this to work or is puppeteer using an invalid session somehow? |
@adamraine The main reason for the problem is that the heuristics used by ProcessPerSiteUpToMainFrameThreshold to disable Debugger get confused (and the fact that the feature disabled by default somehow got enabled in CfT builds). I think Puppeteer is using the right session here but I am not sure if bfcache implementation in Chrome re-targets the session correctly (I hope the crbug I filed clarifies this). At the same time I believe the same/similar issue might occur during a pre-rendering navigation, and in that case the client code needs to be changed. In this case, I think it would be more robust to create the session after the navigation (and I think this works around the problem too). In general, I think any code that deals with CDP sessions directly should account for the mparch changes in Chrome. |
In this instance, creating the session after the page nav doesn't fix the issue for me. I modified the script to look like this: import * as puppeteer from 'puppeteer';
const browser = await puppeteer.launch({
headless: false,
});
const page = await browser.newPage();
await page.setViewport({
width: 1903,
height: 963,
});
await page.goto("http://13.48.26.180/");
const result = await page.waitForSelector('li:nth-of-type(2) > a');
const navPromise = page.waitForNavigation({
waitUntil: ['load', 'networkidle0']
});
await result.click()
await navPromise;
const session = await page.target().createCDPSession();
// This command fails
await session.send('Debugger.enable');
await browser.close(); |
@adamraine interesting, I am pretty sure I saw a similar script pass for me but I cannot reproduce anymore. Maybe there are some situations where the page is evicted from bfcache? 🤔 |
The test site is not available anymore so I am closing the issue as it is not reproducible. The feature ProcessPerSiteUpToMainFrameThreshold is disabled by default now. |
Minimal, reproducible example
Error string
ProtocolError: Protocol error (Debugger.enable): Script execution is prohibited
Bug behavior
Background
Lighthouse issue: GoogleChrome/lighthouse#15525
The original script looks like it was made by the replay library, but I was able to minify the script and repro without much replay stuff.
Expectation
No errors are thrown
Reality
Error is thrown on the
Debugger.enable
commandPuppeteer configuration file (if used)
No response
Puppeteer version
21.3.8
Node version
18.17.0
Package manager
yarn
Package manager version
1.22.19
Operating system
macOS
The text was updated successfully, but these errors were encountered: