Skip to content
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

Skip requests on SVG and CSS resources #1588

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,6 @@ async function teardownBrowser() {
* done loading), and that does not work with a file cache approach either.
* These requests get intercepted.
*
* A couple of additional notes:
* - Requests to CSS stylesheets are not intercepted because Respec dynamically
* loads a few CSS resources, and intercepting them could perhaps impact the
* rest of the generation.
* - SVG images are not intercepted because a couple of specs have a PNG
* fallback mechanism that, when interception is on, make the browser spin
* forever, see discussion in: https://github.com/w3c/accelerometer/pull/55
*
* Strictly speaking, intercepting request is only needed to be able to use the
* "networkidle0" option. The whole interception logic could be dropped (and
* "networkidle2" could be used instead) if it proves too unstable.
Expand Down Expand Up @@ -345,7 +337,7 @@ async function processSpecification(spec, processFunction, args, options) {
return async function ({ requestId, request }) {
try {
// Abort network requests to common image formats
if (/\.(gif|ico|jpg|jpeg|png|ttf|woff)$/i.test(request.url)) {
if (/\.(gif|ico|jpg|jpeg|png|ttf|woff|svg|css)$/i.test(request.url)) {
await cdp.send('Fetch.failRequest', { requestId, errorReason: 'Failed' });
return;
}
Expand Down
Loading