mozilla / qbrt

CLI to a Gecko desktop app runtime
Apache License 2.0
390 stars 31 forks source link

Cryptic error when XUL path is wrong #154

Open 1j01 opened 6 years ago

1j01 commented 6 years ago

Instead of something like file not found: C:/Users/Isaiah/Projects/98.js-vr/shell.xul, I got:

JavaScript error: jar:file:///C:/Users/Isaiah/Projects/98.js-vr/node_modules/qbrt/dist/win32/runtime/omni.ja!/components/nsPrompter.js, line 340: NS_ERROR_NOT_AVAILABLE: Cannot call openModalWindow on a hidden window

(after copying the shell example code over but with a different name for the xul file)

I fixed it pretty quickly, but not from any information in that error message!

1j01 commented 6 years ago

Oh, looks like there's already a lil todo for it in the example code: https://github.com/mozilla/qbrt/blob/76a2960c59d9914ffe91b14a5b358cec7211abb1/shell/main.js#L40-L41

mykmelez commented 6 years ago

Indeed, this is a terrible error message, very unclear. Unfortunately, Services.ww.openWindow() doesn't throw when the URL isn't found, which makes this complicated to fix. We might try parsing the URL first to confirm that it corresponds to a known location on the local filesystem (or is a remote URL) before calling Services.ww.openWindow().