Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
FYI the version with automatic secret per each JSONChannel instance is there. You can provide a secret from GJS for a global channel or accept any channel ... it's your call on security side, really. Regards On Wed, Nov 1, 2017 at 2:44 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote:

Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
OK, I've done some test and apparently `notify::title` is queue so even if you change title twice in a row in WebKit/JS land, GJS will receive all changes. This made me able to create a simple JSONChannel class: https://gist.github.com/WebReflection/7ab0addec037508cc8380a9c37d285f2 I have that cl

Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
I'd be OK if WebKitGTK could at least accept strings and pass them along ... wkjscore-result should be part of the core, IMO. On Wed, Nov 1, 2017 at 12:28 PM, Sam Jansen wrote: > > > On 1 November 2017 at 15:23, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> so ... it looks rea

Re: GJS WebKit2 Extension

2017-11-01 Thread Sam Jansen
On 1 November 2017 at 15:23, Andrea Giammarchi wrote: > so ... it looks really like the exposed API is completely useless as it is > > ```js > webkit.messageHandlers.gjs.postMessage('hello'); > ``` > > Returns a > > [boxed instance proxy GIName:WebKit2.JavascriptResult jsobj@0x7fa08c2e4160 > nati

Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
the GJS code, in case you are wondering ... the if is executed, the jsResult is useless with any kind of data I pass (string, boolean, array, object, number, null): if (wvUCM.register_script_message_handler('gjs')) { wvUCM.connect('script-message-received', (self, jsResult) => { print(jsResult);

Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
so ... it looks really like the exposed API is completely useless as it is ```js webkit.messageHandlers.gjs.postMessage('hello'); ``` Returns a [boxed instance proxy GIName:WebKit2.JavascriptResult jsobj@0x7fa08c2e4160 native@0x7fa052081d80] and if you try to get its value it goes bananas with

Re: GJS camelCase methods (at least)

2017-11-01 Thread Claudio André
2017-11-01 3:29 GMT-02:00 : > Hi Andrea, > > Don't forget to keep replies on the list — other people might read it and > get inspired :-) > I did it myself recently. > On Sun, Oct 15, 2017 at 6:26 AM Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> Hi Philips, >> as probably pr

Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
I've quickly provided a proof of concept but you could have a JSONChannel class singleton on the client side that queue each info and wait for the GJS side to receive one before sending another. I might try a real implementation though and see how it works. however, this is just a work around for

Re: GJS WebKit2 Extension

2017-11-01 Thread Sam Jansen
On 1 November 2017 at 11:55, Andrea Giammarchi wrote: > Actually the `notify::title` with a prefixed "secret-channel" and > serialized JSON looks like the best of them all, for the time being, as it > makes it straight forward for both client and server to communicate. > > ```js > // listen to ea

Re: GJS WebKit2 Extension

2017-11-01 Thread Andrea Giammarchi
Actually the `notify::title` with a prefixed "secret-channel" and serialized JSON looks like the best of them all, for the time being, as it makes it straight forward for both client and server to communicate. ```js // listen to each response new MutationObserver(m => { if (/^secret:response=/.t

Re: GJS WebKit2 Extension

2017-11-01 Thread Sam Jansen
On 1 November 2017 at 05:43, wrote: > On Thu, Oct 12, 2017 at 5:23 AM Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> FWIW I've used the location with a private channel as protocol to >> intercept calls to/from the page and GJS. >> >> https://github.com/WebReflection/jsgtk-twitter/

Re: GJS WebKit2 Extension

2017-11-01 Thread philip . chimento
On Thu, Oct 12, 2017 at 5:23 AM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > FWIW I've used the location with a private channel as protocol to > intercept calls to/from the page and GJS. > > https://github.com/WebReflection/jsgtk-twitter/blob/master/app#L162-L175 > > The channel is a

Re: GJS camelCase methods (at least)

2017-11-01 Thread philip . chimento
Hi Andrea, Don't forget to keep replies on the list — other people might read it and get inspired :-) On Sun, Oct 15, 2017 at 6:26 AM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Hi Philips, > as probably previously mentioned my strongest PL skills are on > JavaScript, not cpp, an

ByteArray / Uint8Array

2017-11-01 Thread philip . chimento
Hi list, I have some code in progress to revamp GJS's ByteArray to use a standard Javascript Uint8Array (part of modern Javascript's typed array family) instead of the custom GJS object. Read more about it here: https://gitlab.gnome.org/GNOME/gjs/issues/5 Does anyone have any thoughts on ByteArra