IRC Log Viewer » #firebreath » 2012-03-15

IRC Nick Time (GMT-7) Message
wrigll25 17:03 Hey Tax. Not using Firebreath for this project as it's supposed to be really small and lightweight, but I do have a general NPAPI question. I'm calling NPN_GetUrlNotify with a target of NULL to feed my plugin a stream, but it always fails and NPP_UrlNotify returns with the NPReason code of 1 (Network error). However there is no network error, because when I do the same things but with a target of _self or _new, it loads the data
Just wondering if you had encountered this before and what the fix would be/what am I doing wrong
Thanks
taxilian 17:03 I haven't done much with the browser streams stuff; if I were you I'd look at FireBreath's code for the streams and see what you're doing differently
dsmith 18:03 Heh. firebreath. Anyone remember the spinner on unix/linux netscape after "about:mozilla" ?
taxilian 18:03 nope
dougma 18:03 please, remind us.
dsmith 19:03 There is the curve of the earth with a big N behind it,
And then slowly
a large godzilla like head rises up.
taxilian 19:03 heh. that's awesome
dsmith 19:03 When it's up all the way it blasts out a big fire from it's mouth.
taxilian 19:03 heh. well, the name didn't come from that...
but that's still awesome =]
dougma 19:03 oh yeah, i remember that now... back when spinners were interesting.
now they just spin
dsmith 19:03 So. There is an extension I want to do for chrome, and I'm pretty sure it requires a NPAPI plugin. I want to browse for http using mdns, well actually for LXI devices specifically, but http is the same.
mdns is either apple bonjour or avahi.
Now, these interfaces are extremely asyncronous.
dougma 19:03 I think it was IE4 or 5(?) which made the spinner spin faster and the whole browser felt snappier!
dsmith 19:03 Lots of callbacks.
heh
SO,
Is it possble, using plugins to call back into javascript asyncronously?
taxilian 19:03 yes
check the tips and tricks page, there is a link to an article about it
dsmith 19:03 That gives me hope.
THis perhaps? http://colonelpanic.net/2010/12/firebreath-tips-asynchronous-javascript-calls/
taxilian 19:03 yep
that one
dsmith 19:03 Can the callback be called multiple times?
Or is maybe some kind of event interface more appropriate?
taxilian 19:03 yes
however FireBreath also has an event mechanism
dsmith 19:03 (I'm new to this javascript and browser stuff. I'm usually down in firmware, kernel drivers and embedded systems)
taxilian 19:03 well, at least you probably know C++ reasonably well, then
dougma 19:03 dsmith: what's an LXI device?
taxilian 19:03 though I suspect C is more common in that area
dsmith 19:03 LXI is a spec for ethernet based test&measurement equipment.
http://lxistandard.org
dougma 19:03 interesting!
dsmith 19:03 I've knows *of* c++ since about 1986 or so, but I've never really used it much. I do know C. (My natural language)
taxilian 19:03 there will be a few oddities in FireBreath for you, then
dsmith 19:03 Yeah, I'm an Old Guy
wrigll26 19:03 I was not alive =(
taxilian 19:03 because we make pretty heavy use of templates to do some magical (read: slightly frightening but very convenient) things
dsmith 19:03 So callbacks or events. WIth mdns, you initiate a Browse request, and then as machines come online and go away, your callback will be called. You typically hook some things into your apps event loop. So you dynamically add and remove menu items or whatever as devices go up/down, change names, etc.
THe point is, the callback is called many many times.
dougma 19:03 no problem
dsmith 19:03 ok
taxilian 19:03 dsmith: the main thing that you'll have to figure out is that you can't use the main event loopo
dougma 19:03 well... how many callbacks per second?
taxilian 19:03 you'll have to create your own thread
dsmith 19:03 Oh, not that often.
dougma 19:03 ok, no problem. :)
taxilian 19:03 and make sure you shut it down in time
dsmith 19:03 Well maybe a lot if you have a power failure and every turns on at once or something.
dougma 19:03 it'll survive... but might lag the browser for a second
dsmith 19:03 The protocol (mdns) is meant to be very light on network usage.
So an announce when it powers up and then a revoke when it goes back off.
Running in a thread is no problem.
Ahh, boost.
When the long running thread calls back into JS, it is really notifying the main thread and then *it* does the actual callback?
taxilian 19:03 correct
dsmith 19:03 ok
Thanks. Reading.....
btw, that mozilla spinner: http://256.com/gray/docs/netscape/mozilla/images.html
taxilian 20:03 I do seem to remember that now...
wrigll26 20:03 that is awesome
taxilian 20:03 spinners are definitely no longer "cool" in web browsers these days
*sigh*