puppeteer-sharp
puppeteer-sharp copied to clipboard
Fix Invalid referrerPolicy error in latest versions of Chromium
Calling GoToAsync without specifying a ReferrerPolicy option now raises an exception when used with the latest Chromium builds for Linux:
PuppeteerSharp.MessageException: Protocol error (Page.navigate): Invalid referrerPolicy at Helpers.TaskHelper.WithTimeout[T](Task
1 task, TimeSpan timeout, Func2 exceptionFactory) in Helpers/TaskHelper.cs:line 188 at Cdp.CdpCDPSession.SendAsync(String method, Object args, Boolean waitForCallback, CommandOptions options) in Cdp/CdpCDPSession.cs:line 113 at PuppeteerSharp.CDPSession.SendAsync[T](String method, Object args, CommandOptions options) in PuppeteerSharp/CDPSession.cs:line 48 at PuppeteerSharp.Cdp.CdpFrame.<>c__DisplayClass15_0.<<GoToAsync>g__NavigateAsync|0>d.MoveNext() in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Cdp/CdpFrame.cs:line 113 at Cdp.CdpFrame.GoToAsync(String url, NavigationOptions options) in Cdp/CdpFrame.cs:line 95 at Cdp.CdpFrame.GoToAsync(String url, NavigationOptions options) in Cdp/CdpFrame.cs:line 106
After researching the Chromium codebase, my understanding is that CDP does not accept empty strings for the ReferrerPolicy parameter. This specific validation message seems to originate from https://github.com/chromium/chromium/commit/57103b9ce6ef77bc1fc31a16cad313a8e03d9b6c
Thank you!
@Manny651 Don't you think we should implement this https://github.com/puppeteer/puppeteer/pull/13954/files ?
@kblok Yes, I added that same logic.
Seeing this issue on Chrome 139 -- has this fix been deployed to a version yet or does 139 re-introduce this?
@joelgriffith I just shipped it. Did you try v20.2.1?
Not yet, will give it a shot and report back -- thanks!
Thank you @Manny651