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

Failed to run Postlight Parser (mercury) #2479

Open
jangernert opened this issue Dec 11, 2022 · 2 comments
Open

Failed to run Postlight Parser (mercury) #2479

jangernert opened this issue Dec 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@jangernert
Copy link

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

@HalidOdat
Copy link
Member

#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?

bors bot pushed a commit that referenced this issue Apr 23, 2023
This Pull Request fixes/closes #2717 and related to #2479

This was caused by an incorrect to digit conversion.

Here are two examples that always cause a panic. They have been added as a test in `number/test.rs`
```js
(0.1600057092765239).toString(36)
(0.23046743672210102).toString(36)
```
@jedel1043
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

3 participants