rustwasm / console_error_panic_hook

A panic hook for wasm32-unknown-unknown that logs panics with console.error
Apache License 2.0
320 stars 24 forks source link

Doesn't work in Safari #7

Closed kzvi closed 5 years ago

kzvi commented 6 years ago

What I see in Firefox:

What I see in Safari:

Edit:

wasm-bindgen generates this code:

const __wbg_error_29632ca09755cc79_target = console.error;

let cachedDecoder = new TextDecoder('utf-8');

// ...

export function __wbg_error_29632ca09755cc79(arg0, arg1) {
    let varg0 = getStringFromWasm(arg0, arg1);
    __wbg_error_29632ca09755cc79_target(varg0);
}

If this line:

__wbg_error_29632ca09755cc79_target(varg0);

is manually changed to this:

__wbg_error_29632ca09755cc79_target(varg0 + " ");

then it works. It seems that the string literal has to have a space in it, an empty string literal doesn't work.

fitzgen commented 6 years ago

If you add a breakpoing before the __wbg_error_29632ca09755cc79_target call, is varg0 the exepcted error message string?

This is super funky behavior...

Unfortunately, I don't have an OSX machine on hand at the moment.

kzvi commented 6 years ago

If I inspect varg0 using the console:

fitzgen commented 6 years ago

It looks like this is a bug in Safari's developer console.

We can work around it by appending a space to the error message, I suppose...

fitzgen commented 5 years ago

Filed an upstream bug report to webkit's devtools: https://bugs.webkit.org/show_bug.cgi?id=189750

fitzgen commented 5 years ago

@kzvi, could you comment in the webkit bug with which safari version you are using? Alternatively, if you don't have an account for bugs.webkit.org and don't want one, you can leave a comment here and I can copy it over to the webkit bug. Thanks!

kzvi commented 5 years ago

@fitzgen Version 11.1.2 (13605.3.8)

thavlik commented 5 years ago

Still not working in Safari 12.0.3 (14606.4.5)