Resource Blocking + Unified Network Pipeline — PageNetworkManager als Single Entry Point #113
Labels
No labels
bug
docs
feature
housekeeping
html-spec
performance
react-compat
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
glow-all/true-headless-browser#113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🔍 Korrigierte Problem-Analyse
Issue #113 wurde nach Code-Review aktualisiert. Die ursprüngliche Annahme „Bilder/CSS/Fonts laden ungefiltert" ist falsch — diese sind bereits via DOM-Level-Fakes geblockt.
Tatsächlicher Ist-Zustand
<img src>src/fakes/media.ts→ sofortonload<link href=.css>onload<style>/ FontFaceFontFace.loaded = Promise.resolve()<video>/<audio>readyState=4, play() resolved sofort<script src>fetch(url)inscript-loader.ts:346— Bun globales fetch, bypassed gesamte Pipelinefetch(/api)via page JScreateFetch()→skipResources(aber redundant — trifft nur image/css/media URLs)Das echte Problem
Script-Loading umgeht die gesamte Network-Pipeline:
Konsequenzen:
fetch(/video.mp4)) werden nicht gefakedLösung
1.
shouldBlockRequestCallback in PageNetworkManager2.
blockResourceTypesin PageOptions3. ScriptLoader → PageNetworkManager Integration
fetchContent()ruftthis.network.request(url, GET)stattfetch(url):4. RequestManager Resource-Type Detection
Via URL + Kontext:
.js→script.css→stylesheet.jpg/.png/.webp→image.woff/.woff2/.ttf→font.mp4/.webm→media.html(via XHR) →xhrother5. Default Block-List (Konservativ)
API-Änderungen
RequestManager (neu)
Page (neu)
Akzeptanzkriterien
blockResourceTypesin PageOptions (Default:[image, font, media, stylesheet])shouldBlockRequest(req) → booleanCallback (höchste Priorität)shouldBlock(url, type, method) → booleanblockedCount,metricsPropertyfetch())networkReference via Constructor oder Setterscriptfür Script-Requestsnew Response(, { status: 200 })ohne Netzwerkpage.metrics().blockedRequestszählt korrektBetroffene Dateien
src/network/request-manager.tsshouldBlock(),blockResourceTypes,shouldBlockRequestcallback,metrics,blockedCountsrc/network/network-manager.tsPageNetworkManager.request()ruftshouldBlock()aufsrc/js/script-loader.tsnetworkReference,fetchContent()viathis.network.request()src/pages/page.tsPageOptions.blockResourceTypes,shouldBlockRequest,networkMetrics(),blockedRequestsgettersrc/runtime-isolation.tsContextOptions.blockResourceTypes,shouldBlockRequestdurchreichentests/unit/resource-blocking.test.tsPerformance Impact (korrigiert)
→ Das issue ist primär Pipeline-Integration, nicht Bandbreiten-Ersparnis — die 80% sind schon da.
Testplan (20 Tests)
Risks
fetch(url)im CatchResource Blocking — Image/Font/Media Requests skipen (80% Bandbreite sparen)to Resource Blocking + Unified Network Pipeline — PageNetworkManager als Single Entry Point