boa
boa copied to clipboard
Failed to run Postlight Parser (mercury)
Describe the bug
Trying to run the mercury.web.js
dist of postlight parser (aka mercury parser)
To Reproduce
- paste the
var Mercury=function() ...
dist code into a file - add the
var html_content = ...
of a page that can be parsed by mercury - call the mercury function
Mercury.parse("https://www.phoronix.com/news/Linux-6.2-Rust", {
html: html_content,
fetchAllPages: false
}).then(result => {
console.log(result);
})
.catch(err => {
console.log(err);
});
Expected behavior the code running and getting the parsed article
Actual behavior
cargo run -- test.js
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/boa test.js`
thread 'main' panicked at 'character was not a valid digit', boa_engine/src/builtins/number/mod.rs:611:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
but running with RUST_BACKTRACE
set to 1 or full yields a different error:
RUST_BACKTRACE=1 cargo run -- test.js
Finished dev [unoptimized + debuginfo] target(s) in 0.12s
Running `target/debug/boa test.js`
Uncaught TypeError: cannot convert 'null' or 'undefined' to object
Build environment:
- OS: Fedora Linux
- Version: 37
- Target triple: x86_64-unknown-linux-gnu
- Rustc version: 1.65.0 (897e37553 2022-11-02)
Additional context I currently abuse a webkitgtk webview to do the same thing. So I know it can work. I'm hoping boa will at some point be a better option for me :)
#2863 should fix the panic bug, but the TypeError
seems like a separate issue.
@jangernert can you confirm that the panic does not happen anymore on the #2863 branch?
The error thrown is probably a runtime issue, right? We don't define a window
object, since that's responsibility of the runtime, and it's the same thing for a lot of the web APIs that Postlight uses.