DioxusLabs / DioxusLabs/blitz

Panic parsing Google 4th of July homepage

Open
#490 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.1k
Forks
203
Avg merge
8h 58m
Merged PRs (30d)
112

Description

Using blitz 0.2.1, `blitz_html` panics when attempting to parse the Google homepage with the message:

```
thread 'main' (179535) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/blitz-dom-0.2.4/src/document.rs:550:13:
to be able to resolve /web/20260703180215cs_/https://www.google.com/xjs/_/ss/k=xjs.hd.jILEt-ueYLk.L.B1.O/am=AAAEQAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAQAAgEABAIAMAAAAAAAIAACgBhEAgAAAAAAAAIQHAAAMAAAAAAAAAIAAAAAAAIAAAIAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAEAAigAAIAABQAAAAAAgAAAAAAAAAAAAAICAAAAAAAAAAAAgAAAAAAAAAAYAMEAIAAAAAAgDAAAAAAAAAAAAAAAAAAAAAAAiARAAAAEAAAAAAABAAAAAAABAIQQBAABCiAAAAAAAACABQAAAAAdQAAEBAAAAAAAAAACAEEgBBAAAAAgAAAABAABAAEAAQEARtAAACQqEAAAogMAAAAIAAAAAIAAAAAAAAAAAAAAQAQAAAAAAACwAABDQCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAE/d=1/ed=1/rs=ACT90oHwnyY8rZ_swysHVUPbUAsB_rKaAw/m=cdos,hsm,jsa,mb4ZUb,cEt90b,SNUn3,qddgKe,sTsDMc,dtl0hd,eHDfl,YV5bee,d,csi?cb=121509378 with the base_url: Url { scheme: "data", cannot_be_a_base: true, username: "", password: None, host: None, port: None, path: "text/css;charset=utf-8;base64,", query: None, fragment: None }
```

It also produces the same panic on the [archive.org snapshot](https://web.archive.org/web/20260703180215/https://www.google.com/). I've included the code I used to produce this panic below.

```rust
use blitz::dom::net::Resource;
use blitz::dom::DocumentConfig;
use blitz::html::HtmlDocument;
use blitz::shell::{create_default_event_loop, BlitzShellEvent, BlitzShellNetCallback};
use blitz::traits::net::Request;
use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<(), Box> {
tracing_subscriber::fmt::init();

let event_loop = create_default_event_loop::();
let net_provider = create_net_provider(&event_loop);
let (_, bytes) = net_provider
.fetch_async(Request::get(url::Url::parse("https://www.google.com")?))
.await
.unwrap();
let html = std::str::from_utf8(&bytes)?;

let doc = HtmlDocument::from_html(html, DocumentConfig::default());

Ok(())
}

type EnabledNetProvider = blitz::net::Provider;

fn create_net_provider(
event_loop: &blitz::shell::EventLoop,
) -> Arc {
let proxy = event_loop.create_proxy();
let callback = BlitzShellNetCallback::shared(proxy);
Arc::new(blitz::net::Provider::new(callback))
}
```

This seems to be due to the parser attempting to use a `data:` URL as a base and failing.

Side note: Is there a setting I've missed that disables blitz attempting to resolve URLs during parsing? This seems like something that should either be configurable or not part of the parser.

Contributor guide

Open the contributing guide

Research direction

Start at blitz-dom-0.2.4/src/document.rs:550 and trace the HtmlDocument::from_html path shown in the report, especially how the data: URL becomes a base URL. Reproduce with the supplied Rust program against Google or its archive snapshot, then verify that parsing completes without the reported panic and that URL resolution still behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.