boa icon indicating copy to clipboard operation
boa copied to clipboard

Failed to run Postlight Parser (mercury)

Open jangernert opened this issue 1 year ago • 2 comments

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 :)

jangernert avatar Dec 11 '22 14:12 jangernert