IRC Log Viewer » #firebreath » 2012-05-18

IRC Nick Time (GMT-7) Message
iAmJohn 04:05 is it possible to overcome this( in chrome?
mpater 05:05 Hi
HattCzech 08:05 anyone around at this hour?
HattCzech 08:05 when someone is around: i'm wondering how (or from where) i access functions in NpapiBrowserHost (such as InvokeDefault)?
hello taxilian
taxilian 08:05 HattCzech: you generally call InvokeDefault by calling Invoke("", (params)) on a JSObjectPtr
HattCzech 08:05 i'm converting an NPAPI plugin from a different project into a FireBreath project, and the file in question referenced a NPN_InvokeDefault function
which was essentially the same as the NpapiBrowserHost::InvokeDefault function, so i was trying to replace it with that
taxilian 08:05 won't work
don't try to do that
HattCzech 08:05 but with no references to NpapiBrowserHost or NpapiPluginModule, that doesn't work :)
taxilian 08:05 you should never be accessing NPAPI specific code from your plugin
as a general rule
HattCzech 08:05 okay
taxilian 08:05 until you understand the framework well enough to know when you should break the rule, of course ;-)
as in all things
HattCzech 08:05 heheh, fair enough
and i definitely am not at that level yet
taxilian 08:05 Generally speaking, an NPObject from the page becomes a JSObjectPtr (well, technically a JSObject, but wrapped in a JSObjectPtr)
and a NPObject going to the page becomes a JSAPI object wrapped in a JSAPIPtr
HattCzech 08:05 okay
taxilian 08:05 if you're calling NPN_InvokeDefault you're most likely actually trying to call something in the page, so you'll want to use the JSObjectPtr and call ->Invoke with an emptystring for the function name
HattCzech 08:05 oh, and the other fun part is i didn't write the original plugin, i'm trying to learn both of these things and get them to work in FireBreath
taxilian 08:05 naturally =]
HattCzech 08:05 okay, i'll have to play around with that
what about other functions like NPN_ReleaseVariantValue or NPN_PluginThreadAsyncCall or NPN_ReleaseObject
i saw something on the site about the Async one
taxilian 08:05 PluginThreadAsyncCall you probably won't need
but if you do you can use CallOnMainThread or ScheduleOnMainThread
!wiki CallOnMainThread
FireBreathBot 08:05 3 results found. Note: Results limited to 8
"class FB BrowserHost CallOnMainThread":
"Frequently Asked Questions":
"Version History":
taxilian 08:05 !wiki ScheduleOnMainThread
FireBreathBot 08:05 3 results found. Note: Results limited to 8
"class FB BrowserHost ScheduleOnMainThread":
"Frequently Asked Questions":
"Version History":
taxilian 08:05 generally, though, that call is used to set something to call into the page on the main thread when called from another thread, and FireBreath does that for you
HattCzech 08:05 okay
taxilian 09:05 and FireBreath also takes care of memory management (generally) for you so you don't need to worry about htose either
HattCzech 09:05 that's a plus
i've been playing with JS for the past couple years, so getting back into C is different :)
taxilian 09:05 well, FireBreath was created when I got sick of using C interfaces from Javascript and I wanted to make it possible to do a good interface in the plugin
so it'll take a bit of getting used to, but it's pretty slick I think
at least skim the getting started pages on the website; it'll help a lot
HattCzech 09:05 i read over them a couple times, the problem is trying to fit this square peg in a round hole
plug-n-play doesn't work well for code most of the time
taxilian 09:05 yeah
the resulting plugin will be a lot simpler
but the more complicated the npapi plugin the trickier the port, particularly if you don't already know both NPAPI and FireBreath
HattCzech 09:05 <- like this guy
knowing neither makes it tricky
i'd much prefer my jsxpcom implementation of this plugin :)
taxilian 09:05 hehe. you'll get it =]
HattCzech 09:05 well, i guess that's only for the wrapping, but i used jsctypes for the binary implementation
taxilian 09:05 when you get used to JSAPI you'll love it
reichi 09:05 who did invent the word "porting" ;)
i figured it's almost always a total rewrite ;)
no matter what
HattCzech 09:05 reichi: you are correct
i guess the difference is that "porting" means you have something to base it off of
reichi 09:05 well or
"it looks the same when you're done"
HattCzech 09:05 hehehe, sometimes
taxilian 09:05 which makes it really fun to explain to management: "Yes, I'm done! I just spent three weeks of grueling work and it's now Beautiful!" "It looks the same. Why are we paying you for those two weeks?"
reichi 09:05 :D
HattCzech 09:05 so this plugin i'm "porting" is for chrome... it uses a BrowserUtils file (created by google) for GetPageSecurityOrigin... is there something similar in FireBreath?
taxilian 09:05 I have no idea what you're even talking about
are you sure it's not a chrome extension with a npapi plugin to provide part of the functionality?
HattCzech 09:05 that's exactly what it is
and since FireBreath is plugin only, this could be the unrelated part
taxilian 09:05 this would be the unrelated part, I'm pretty sure
HattCzech 09:05 hmmm, this is interesting
it's part of the plugin... but it accesses the browser part, so i'm not if it will work with FireBreath
not sure*
taxilian 09:05 does it access it using NPN_ methods?
HattCzech 09:05 yeah
taxilian 09:05 then you can do it with FireBreath
HattCzech 09:05 okay
good to know :)
well, that part doesn't... :/ but i think i can pull it over