puppeteer-sharp icon indicating copy to clipboard operation
puppeteer-sharp copied to clipboard

Fix Invalid referrerPolicy error in latest versions of Chromium

Open Manny651 opened this issue 5 months ago • 3 comments

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](Task1 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

Manny651 avatar Jun 18 '25 17:06 Manny651

Thank you!

kblok avatar Jun 18 '25 17:06 kblok

@Manny651 Don't you think we should implement this https://github.com/puppeteer/puppeteer/pull/13954/files ?

kblok avatar Jun 18 '25 17:06 kblok

@kblok Yes, I added that same logic.

Manny651 avatar Jun 18 '25 20:06 Manny651

Seeing this issue on Chrome 139 -- has this fix been deployed to a version yet or does 139 re-introduce this?

joelgriffith avatar Jul 15 '25 20:07 joelgriffith

@joelgriffith I just shipped it. Did you try v20.2.1?

kblok avatar Jul 15 '25 20:07 kblok

Not yet, will give it a shot and report back -- thanks!

joelgriffith avatar Jul 15 '25 21:07 joelgriffith

Thank you @Manny651

carkcib1 avatar Aug 18 '25 18:08 carkcib1