GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.21k stars 9.35k forks source link

Move away from setBlockedUrls #3516

Open patrickhulce opened 6 years ago

patrickhulce commented 6 years ago

setBlockedUrls will be disappearing from the protocol and we should migrate to use request interception to do URL blocking instead

Blocked on https://crbug.com/764505

benschwarz commented 6 years ago

@patrickhulce request interception is (so far) only working with the --headless flag, but not without. Do you have any idea on when the fix for that will end up in stable?

brendankenny commented 6 years ago

will also help fix #2512

patrickhulce commented 6 years ago

@benschwarz my sources say that it's been fixed in canary, perhaps it'll go out with m63? I haven't checked

benschwarz commented 6 years ago

@patrickhulce I just tested https://github.com/benschwarz/chrome-request-interception on Canary (latest) mac.

Definitely want to see this change come through, but it seems like request interception is still not ready

patrickhulce commented 6 years ago

the --headless problem seems to be based on the order of your listeners, due to PlzNavigate, you must establish all your handlers/listeners before Page.navigate since it can frequently resolve after the page has already loaded, moving around the listeners gets the example to work for me on headless.

non-headless definitely still seems to be missing interception though still perhaps my source jumped the gun 😄

EDIT: it looks like this failure is the result of an open bug for the user data dir works if you start chrome with a pre-existing user data dir 😆 https://bugs.chromium.org/p/chromium/issues/detail?id=764505&q=interception%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified

FYI @benschwarz if you want to star that bug too :)

paulirish commented 6 years ago

Good repro for broken setblockedURL: Try running lighthouse against http://2015.cssconf.com.au

connorjclark commented 5 years ago

So, network interception is much better now, so we can probably do this now. Although I don't see where it says setBlockedUrls is going away. it's marked as experimental, but not deprecated afaict.

Also :) https://github.com/GoogleChrome/lighthouse/blob/cc8e2d913c39bdf75c277afb7ca9e783d14b0413/lighthouse-core/gather/driver.js#L1560

connorjclark commented 4 years ago

If we still want to do this, we'll want to use the Fetch domain. This PR has the necessary code: https://github.com/GoogleChrome/lighthouse/pull/9459/files#diff-20c9b77b021305db443ebff30875575a