Closed jmercouris closed 8 months ago
I have changed my mind. I think this can belong in the core library. It is quite useful, doesn't need to be relegated just to the tests.
Should the user wish to implement their own way to create synchronous JavaScript, the callbacks are still available for them to use.
Synchronous JavaScript execution function will now signal an error whenever there is an error. Other JavaScript executions will function the same, and will simply return "ERROR"
to the callback.
IF there was more intelligent handling of the error we could do, I would implement it. Unfortunately there is not due to limitations in Electron.
As I've detailed in my commit, the following two issues reference the problem:
https://github.com/electron/electron/pull/18635 https://github.com/electron/electron/issues/9102
Regardless, the latest set of changes means that execute-javascript-synchronous
will not block on failure!
Overall, this addition is needed and it belongs to the library.
I have noticed an issue (see below) and I'm not sure how to fix.
> (electron::send-message-interface electron:*interface* "bogus") "ReferenceError: bogus is not defined" NIL
> (execute-javascript-synchronous (web-contents win) "bogus") => never returns
These are two very different things. One is running synchronous JavaScript within Electron (nodeJS) and one within the renderer.
Regardless, the latest set of changes means that
execute-javascript-synchronous
will not block on failure!
This is not correct. I've made minor changes to your changes, namely replacing error
by cerror
. Nonetheless, when the error is raised and it is ignored in the debugger, it is still a blocking action. To reproduce it, replace ""1 + 1"
with "bogus"
at demo-views.lisp
.
I've merged the subset of this PR that doesn't deal with errors. 14c6d2a and bbfaacb.
Rebased onto master.