IRC Log Viewer » #firebreath » 2011-02-08

IRC Nick Time (GMT-7) Message
taxilian 00:02 <- FireBreath 1.4 beta 4 is released
FB_GitHubBot 00:02 FireBreath: firebreath-1.4 Richard Bateman * f1d5d4b (1 files in 1 dirs): Removed version string from version file that has to be manually updated -- causes more problems than fixes -
FireBreath: master Richard Bateman * f1d5d4b (1 files in 1 dirs): Removed version string from version file that has to be manually updated -- causes more problems than fixes -
FireBreath: master Richard Bateman * 93116ac (274 files in 47 dirs): Attempt to fix CRLF issues -
FireBreath: firebreath-1.4 Richard Bateman * 93116ac (274 files in 47 dirs): Attempt to fix CRLF issues -
Markemark 02:02 Hi, I've just started using FireBreath. All was going well until I tried to mix Direct3D and Firefox. I have discovered that OpenGL is OK, and seen as I have the choice of rendering engine I thought I would sidestep the issue by using OpenGL on FF. OK, so now to the question, does anyone know how to detect the browser from within FireBreath?
Vikas 02:02 hi
I need information on Fire breath
Nils_ 03:02 u
prem_ 05:02 i'm using visual studio 2008, i followed the video tutorials and the npPlugin.dll was correctly generated. Can you tell me how to generate the activeX control?
i'm new to cmake
_vizZ 05:02 knock, knock? ;p
could you give me some hints on where to learn cmake or get some samples?
iaincollins 06:02 gah, always the come when no-one is here :)
_vizZ I was sure there were notes on using cmake on the Wiki, beyound just the the "Using CMake With FireBreath" article, not sure where it went
would love to help more but I have not read up on cmake yet (though am not going to be able to put that off much longer)
_vizZ 06:02 yeah, well, i just need some directions coz i need to adapt some old projects to cmake and i thought you guyz would be pretty much THE ones to ask for ;p
iaincollins 07:02 oh the page I was thinking of on the wiki was regarding how to configure cmake to use libraries with cmake
NoAntzWk 08:02 hi
Is there someone who is fluent in cmake?
taxilian 08:02 Yep
hong 08:02 hi there
taxilian 08:02 morning
NoAntzWk: what are you trying to do with cmake?
hong: welcome =]
NoAntzWk 08:02 hi...
I added a new post names "CMake and REGEX REPLACE question" in FB group
I have troubles usin string(REGEX REPLACE...)
taxilian 08:02 on the mailing list?
NoAntzWk 08:02 yes.!topic/firebreath-dev/oWS0yrVFmu8
taxilian 08:02 oh, there it is
just came through =]
ahh, what you want to do is probably more complex than anyone else on the list but me has even tried… unfortunately, even to me it's still a little bit black magic
I'll try, though
NoAntzWk 08:02 ok.... and yes, it's rare because only the first lines matches.... :-? and documentation says: "REGEX REPLACE will match the regular expression as many times as possible and substitute the replacement expression for the match in the output. The replace expression may refer to paren-delimited subexpressions of the match using \1, \2, ..., \9. Note that two backslashes (\\1) are required in CMake code to get a backslash through arg
taxilian 08:02 yeah; that is kinda weird. What I ended up doing in my process_template function is make it do it one line at a time instead of reading the lines as a single block of text
cmake string processing involves a lot of weirdness
NoAntzWk 08:02 Where I can found process_template function?
taxilian 08:02 working on it; hang on
it's in the repo
sorry, trying to do three things at once
taxilian 09:02 it still baffles me when people come in and ask "okay, I got the npapi version working. How do I build the activex version?" How can I be any more clear on the website that it's all combined?
you have one, you have it all?
iaincollins 09:02 yeah sorry I missed that, could have actually dealt with that
taxilian 09:02 sokay; that's how I feel every time I sign in and there is such a simple question
and you think "You know, that person may be giving up on FireBreath because they can't figure out how to do this, but all they have to do is actually read the docs..."
and you feel bad you couldn't talk to them, but there is just only so much you can do
iaincollins 09:02 I guess I should add that one to the FAQ
taxilian 09:02 and everyone has an occasional brain fart
that's not a bad idea; do you mind doing that?
I gotta head to school
iaincollins 09:02 np
taxilian 09:02 first day back to these classes in 2 weeks :-P
iaincollins 09:02 eep
how's that going?
taxilian 09:02 make sure you note that even though the dll starts with np (has to to work on firefox) it works on all
actually not bad… most of the classes are geared toward people with a tad less experience than I have
so I'm only actually behind in one class
iaincollins 09:02 I'll bet :-)
taxilian 09:02 it's the hardest class, but half of the rest of the class is also behind, so I think I'll be okay
it wouldn't be a problem, except I leave tomorrow morning for Facebook offices to build a demo for the plugin I'm working on for them....
you saw beta 4 is out?
iaincollins 09:02 If you don't mind me asking, am curious any particular reason for going for formal education?
yeah I did :D
taxilian 09:02 heh. I've known too many developers who didn't and eventually it bit them. formal CS degree doesn't mean your'e a good developer, but it does mean you were willing to put up with a lot of crap and play by someone else's rules, and sometimes that says a lot when a company needs someone solid
also at this point I'm so close it'd be stupid not to finish
iaincollins 09:02 hehe yes :)
taxilian 09:02 it probably won't make a big difference immediately, but my hope / assumption is that someday it will help
and I've actually learned more than I anticipated; the compiler class is really kinda interesting
as is the OS class
it's helped to understand some of the more foundational things that you don't really need to know in practice, but still helps if you do
iaincollins 09:02 Haha, I am 31 now, I'm getting better with the putting up with other people' crap. I'm not perfect, but I don't give people a hard time as much as I used to when they are willfully lame.
Yeah, my biggest weakness is some more foundational things.
taxilian 09:02 heh. at the end of the day, your boss doesn't want someone who is unspeakably brilliant… he/she wants someone who will get done what they want you to do in a timely manner :-P
but I'm sure by the time I reach the ripe old age of 31 I'll bet better at that too ;-) (since I turn 28 this month :-P)
must be hard to be so old :-P
iaincollins 09:02 Congrats :)
Oh it is! It is!
taxilian 09:02 heh. it's a funny world. anyway, off to school
iaincollins 09:02 later!
taxilian 09:02 find bugs in 1.4!
iaincollins 09:02 oooh yes need to hunt down that MSIE issue and test against latest build.
Very true what you just said about what bosses want. I feel like I've had to kind of wait out time till I am worn down to the stage where I am more useful because I'm just older and more worn out.
I figure by the time I'm about 35 I'll be baked.
Then about 10 years after that before they put me out to pasture in some home for old developers, who'll look at C# & PHP like we look at the old Pascal and Voice Switch guys ;-)
* more worn out = more accurately: less hyperactive
nitrogenycs 09:02 hah, I am stupid enough to quit university now that I completed all lectures required for my degree, but without doing the final tests :)
and writing my thesis
iaincollins 09:02 lol, doh
nitrogenycs 09:02 but I am still young compared to you grannies ;)
iaincollins 09:02 haha, ouch!
nitrogenycs 09:02 writing my first job application as we're speaking
nah, I'll turn 27 this year, so I'm not that far off
iaincollins 09:02 am 32 this year
I'm going to enjoy it!
It's the next power of 2 till I'll 64 (and frankly I'm not all that sure my hulk will last that long)
nitrogenycs 09:02 lol
32 is quite special indeed
27 is also special, it's the next power of 3 :)
iaincollins 09:02 Good if you are a fan of those Tritanium computers (where the bools are true, false & FileNotFound) #MemeReference
nitrogenycs 09:02 :) yeah. I think there was some russian computer once which explored ternary logic
well, the computer probably did not, but helped to research it :)
iaincollins 10:02 heh, cool
taxilian 10:02 FireBreath 1.4 actually has support for boost::tristatebool
you can return true, false, or indeterminate
taxilian 10:02 is there anyone here who is not using 1.4 yet? If so, may I ask why?
taxilian 10:02 I'm not sure why I find it so entertaining to be able to use for short URLs to firebreath pages… :-P
taxilian 11:02 battery dead, bbl =]
iaincollins 12:02 re: boost::tristatebool heh cool, yeah JS & PHP sprung to mind when thnking about tristates :)
nice one on npapi :)
right, home, laters!
neilg_ 12:02 We're not using Firebreath 1.4 yet, still on 1.3. But will be upgrading shortly.
We haven't upgraded since 1.3 worked for us - but since I'm about to start work on the Mac plugin it makes sense to upgrade
jshanab_wcw 12:02 I switched to 1.4 last week. the only issue I had is that I use avcodec and it has an include stdint.h. which caused multiple define errors with FB_stdint.h. My co worker is having the opposite issue, stuff that should be in FB_stdint.h are throwing "undefined" errors. Other than that easy migration
But i switched from 1.2
taxilian 15:02 neilg_: it makes sense to upgrade anyway, there are a lot of stability fixes in 1.4 =]
neilg_ 15:02 Yup, we're definitely going to do it. I say we - I mean me. :)
taxilian 15:02 besides, you're the one who wanted the multi-mimetype support, aren't you?
neilg_ 15:02 Yep, that's definitely something we used to have but lost switching to FB 1.3. It'll be nice to get that back so I can have one project again!
I'm looking forward to the upgrade
taxilian 15:02 you better be! *glares* ;-)
Radicand 15:02 ok, i may have a question at this stage ;)
taxilian 15:02 ooh, ooh, question!
go for it
Radicand 15:02 attempting to do the wix installer
i just need it to include one extra dll
that's prebuilt
taxilian 15:02 something like this?
Radicand 15:02 should be, initially it failed; let me try something
do i need to add it to set (WIX_LINK_FLAGS ${WIX_LINK_FLAGS} -dBuild=${CMAKE_CFG_INTDIR})
taxilian 15:02 depends on how you want to do it
Radicand 15:02 just want it sitting in the same dir as the npplugin
taxilian 15:02 the -dBuild= gives you $(var.Build)
${YOUR_OWN_PATH_VARIABLE} can be a cmake variable
Radicand 15:02 what does $(var.Build) eval to
taxilian 15:02 well, if -dBuild=${CMAKE_CFG_INTDIR} then it evaluates to probably Debug, Release, MinSizeRel, etc
depending on the build config
Radicand 15:02 1>C:\Users\npappas\Desktop\FireBreath\build\projects\SpotmeNFCReader\SpotmeNFCReaderInstaller.wxs(21): error LGHT0204: ICE38: Component LibNFCdll installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.
taxilian 15:02 hmm. I've seen that error before...
Radicand 15:02 <!-- Put Additional files here: -->
<Component Id="LibNFCdll" Guid="{2C13B796-D8D5-48A6-B23D-EFE9F2C3859E}">
<File Id="myStuff.dll" Source="c:\libnfc.dll" />
i'm sure i did it wrong, just tried to eliminate causes of variables
taxilian 15:02 try adding KeyPath="yes" in File
<File Id="FILE_InstallMeTXT"
KeyPath="yes" /
Radicand 15:02 no dice
taxilian 15:02 hmm. wix is still not my strongest point, I'm afraid :-/
there should be resources on the internet to help with it, though
Radicand 15:02 yeah, i'll keep hammering at it
taxilian 15:02 let me know when you figure it out
so I can help the next poor soul to get stuck by it =]
Radicand 15:02 ;)
adding <Component Id="LibNFCdll" Guid="{2C13B796-D8D5-48A6-B23D-EFE9F2C3859E}">
<File Id="libnfcdll0" Source="c:\libnfc.dll" />
made it build
<RegistryValue Root="HKCU" Key="SOFTWARE\${COMPANY_NAME}\libNFC" Name="Uninstall" Type="string" Value="1.0.0" KeyPath="yes" />
taxilian 15:02 huh
Radicand 15:02 but...does it install
wow. it does
taxilian 15:02 that's helpful =]
Radicand 16:02 updated wiki
taxilian 16:02 awesome, thanks!
taxilian 16:02 Radicand: you know, the chat room has been less and less busy of late, while the traffic on the website shows more visitors than ever; I guess most people must be like you these days and able to pretty much figure it all out of their own
Radicand 16:02 probably a good sign
taxilian 16:02 that's a really good thing, but it's less motivating for me because I don't see as many people using it :-P
so thanks for dropping in
Radicand 16:02 heh
my boss was supremely impressed that it even ran on IE
taxilian 16:02 lol. well, contributions from parties using it commercially are encouraged ;-)
Radicand 16:02 ;)
taxilian 16:02 but yeah, that's really the main bit of "magic" that FireBreath adds. NPAPI plugins are tricky, but not insurmountable; it's making it work on IE as well that really justified making the framework
of course, *I* wouldn't want to write a raw NPAPI plugin when I could use FireBreath even if I didn't need it to work on IE, so...
taxilian 17:02 and now back to class
taxilian 17:02 and back. I'm sure everyone missed me terribly
prem 20:02 hai
mital 21:02 hi... can I throw an exception to javascript space... I have tried throwing std::exception ... it crashes my plugin
taxilian 21:02 mital: yes, throw FB::script_error
mital 21:02 taxilian: oh ok... nice... let me checkout
taxilian 21:02 we don't catch normal exceptions by default because if your code has exceptions I don't want it to be accidently handled by FireBreath(and missed by you)
mital 21:02 taxilian: yeah ... thats perfectly right ... basically i have my set of exceptions which derive from std::exception so here i need to derive it from FB::script_error
taxilian 21:02 only if they should fire into javascript
also note that exception handling in Chrome and Safari (the browser, not FireBreath's handling of them) is broken, so you won't get your messages in those browsers
we've filed a bug, but hasn't been fixed yet in WebKit
mital 21:02 taxilian: oh ok. ... 1) i wanted to fire them in javascript only.. 2) so in latest chrome i cant test this .. :( ...
taxilian 21:02 well, you can test it… just don't be surprised if it just gives you some crap about "exception calling NPObject"
mital 21:02 ok
firebreath seems really good platform... I am ready with a small sample plugin within no time. :)
taxilian 22:02 good! =] we've tried hard to make it that way
mital 22:02 taxilian: I can clearly say its a real hard work you guys have done..
Hrishikesh 22:02 taxilian: hi
one small problem
taxilian 22:02 hey
Hrishikesh 22:02 i tried to install the plugin using regsvr32
taxilian 22:02 whats up?
Hrishikesh 22:02 finally i'm done with the sqlite plugin
but not able to install it
taxilian 22:02 what happens?
Hrishikesh 22:02 its giving me error module failed to load npTestPlugin.dll
taxilian 22:02 most likely you need a sqlite.dll or something
Hrishikesh 22:02 no i;ve used lib file
taxilian 22:02 a .lib file often sets up a dynamic link to a .dll
Hrishikesh 22:02 so first i have to install sqlite?
taxilian 22:02 depending on whether it's a static or dynamic loaded module that the .lib describes
use Dependency Walker ( to verify, but it probably needs a .dll that isn't there
you'd want to find the .dll file and put it in the same dir as the plugin
Hrishikesh 22:02 ok
taxilian 22:02 or find a way to statically link instead of dynamically
Hrishikesh 22:02 let me check
yes sqlite.dll is missing
its also asking me for the IESHIMS.DLL
what is that file?
taxilian 22:02 that one is normal for it to complain about
not certain why
Hrishikesh 22:02 ok
taxilian 22:02 but you shouldn't need to worry about it
I think it's a lazy load
Hrishikesh 22:02 ok
taxilian 22:02 so you need to find the sqlite.dll that you linked against
Hrishikesh 22:02 how to write installer for the plugin?
taxilian 22:02 use WiX
search for WiX on
Hrishikesh 22:02 ok
taxilian 22:02 but test it first =]
don't matter if it don't install if it don't work =]
Hrishikesh 22:02 ok
yay working
taxilian 22:02 heh =] well done
Hrishikesh 22:02 do i have to restart the chrome?
because its not showing it in chrome
i think i need to restart it
taxilian 22:02 shouldn't
but worth a try
Hrishikesh 22:02 yes its working without a restart
i think it take some time after installation
i installed and immediately opend the test page
thanks man for such wonderful framework
taxilian 22:02 please feel free to contribute back in any way you can =]
but you're welcome
Hrishikesh 22:02 yes
i'll write a tutorial for all the problems i faced
even if you have some idea about tool then tell me we will impliment it
taxilian 22:02 a tutorial sounds fantastic
one thing that would be really cool would be to see a simple sqlite example plugin
open sourced
if you're looking for ideas =]
just something that lets you use basic sqlite features
Hrishikesh 22:02 ok
is there any tutorial for making the plugin downloadable in firefox?
or in chrome
taxilian 22:02 you mean installing it as an extension?
Hrishikesh 22:02 i mean user should be able to download it right from the browser
taxilian 22:02 not at present, no
Hrishikesh 22:02 ok
taxilian 22:02 I just use javascript to detect if the plugin is installed or not
and then display a link to the .msi
Hrishikesh 22:02 ok
firefox allows you to download missing plugin
not sure about chrome
need to check for the chrome
taxilian 22:02 technically
firefox actually only allows you to download a missing extension
which may contain a plugin
the reason it's important is that it doesn't install it for the whole machine, just for that profile and only firefox
if you want to do that, you need to make an XPI
you can also install an NPAPI plugin as a Chrome Extension (CRX)
but I don't know how to do either; I welcome tutorials or contributions to make that easier, as many firebreath users like to do it that way
I prefer not myself because I like having only one install method for all browsers
Hrishikesh 22:02 yes
you are right
regsvr32 method is good
i like it
it will work for all the browsers
taxilian 22:02 msi method is better
it uses regsvr32 to decide what should be registered, but then lets the install system deal with uninstall
so you don't have issues with things not getting cleaned up right if the plugin gets updated
Hrishikesh 22:02 ok
for demo purpose i'll go with regsvr32 method
taxilian 22:02 oh, certainly
that's why it's there =]
Hrishikesh 22:02 :)
mital 22:02 taxilian: hey i am using boost library.. for sockets, and filesystem access.. I figured out that we are using subset of boost library ... does that include removing functionalities from various modules like filesystem or just using full modules described in the txt file ?
taxilian 22:02 should be the full modules described in the txt file
I haven't tried to cripple it
I just didn't want to include 40 meg of stuff that doesn't get used by us much
you can always use your own system boost if need be
mital 22:02 ok ...
yeh thats right
taxilian 22:02 however, asio and filesystem should all be there
FireBreath even has an undocumented embedded web server that uses boost::asio if you enable it =]
some day I may even document it
mital 22:02 yeah.. i just added one liner in my project add_boost_library() and it started compiling threads
taxilian 22:02 actually threads is already there
because FireBreath itself uses it
mital 22:02 asio etc are header only libs ... mostly i dont need to link against anything
taxilian 22:02 but other things that's how it works
mital 22:02 ok
taxilian 22:02 asio does depend on a few things, though
but yeah
mital 22:02 i needed it for system library
it depends on datetime and systems
taxilian 22:02 yeah
you'll need to add_boost_library for that
mital 22:02 i added systems ... it worked
taxilian 22:02 I thought it was a decent compromise between heavy boost usage and no boost usage
mital 22:02 however how can i add any other dependency ?
taxilian 22:02 what do you need?
boost or just in general?
mital 22:02 general...
taxilian 22:02 it needs some help, but most of the info you'll want is here:
just a question of understanding how to link things with cmake
mital 22:02 ok
for every new compile and replacement of my plugin ..i need to restart the browser for test... is there any way to avoid it ?
taxilian 22:02 darn peer resetting your connections again?
mital: well, there kinda is
if you put the new version in as a different filename in the Internet Plugins dir each time it should work
you can rotate between two filenames, actually
as long as it sees one disappear and a new one show up
but you're usually better off just restarted during debugging
mital 22:02 hmm its painful while we are testing stuffs.. and actively modifying the backend code
taxilian 22:02 yeah
I know
those are your options, though
mital 22:02 btw i liked the function signature directly replicated and handled by firebreath... i have tried working with JavaScriptCore/Webkit.. its really painful to validate the arguments every time for each function.. how do u achieve it ??
am i correct ?
taxilian: I got "Error: Error calling method on NPObject." while throwing exception from my method.
in chrome
but yeah.. my plugin did not crash this time... thanks :)
taxilian 23:02 mital: yeah, that's a webkit bug :-(
mital: it's a combination of boost::bind and polymorphism
if you want to look at it go find make_method
you'll see that there are overloads for up to 10 methods
mital 23:02 oh nice :)
taxilian 23:02 uses some advanced template metaprogramming tricks
to do the autoconversion using FB::variant
mital 23:02 yeah I really loved it
taxilian 23:02 primarily that's Georg's work
it's definitely slick
mital 23:02 its brilliant :)
taxilian 23:02 agreed =]
FireBreath is really the perfect open source framework
it benefits everyone to open source improvements to it
perfect candidate for an open source project, I mean
helps everyone and allows them to contribute without giving up any core advantage
mital 23:02 hey what would be the scope of the objects created and given to javascript ... is it as long as its referenced by any javascript var ? is it gets collected by GC ?
taxilian 23:02 1.4?
mital 23:02 I am currently on 1.3... but have no problem moving 1.4
taxilian 23:02 if you care about that, you want to move to 1.4
in 1.4 you can control it
by default the reference is held by the BrowserHost until plugin shutdown
so all objects stay around until plugin shutdown and are then freed
mital 23:02 oh until plugin shutdown
that would consume lot of memory right
taxilian 23:02 however, if you return a weak_ptr instead of a shared_ptr then it will stay around until *you* let go of the last shared_ptr
depends on how many you create
most plugins don't make many
so it doesn't matter
however you can tell it to release all held JSAPI objects by calling this function:
what you really want to do, then
is only return weak_ptr references from your JSAPI methods
then you retain the object as long as it makes sense to
and when you're done with it you just release your shared_ptr to it
which invalidates all of the weak_ptrs
there is still the possibility of memory leak / buildup simply by nature of the way the browser works, but as long as the JS garbage collection is able to work (you aren't holding references to defunct objects in JS) you should be okay
and if you're not, it aint our fault :-P
mital 23:02 taxilian: so ideal thing is to return weak_ptr.. the object would get freed when the JS GC runs and releases the shared_ptr held by it .... am i correct >?
taxilian 23:02 JS GC has nothign to do with the shared_ptr
you have to track that yourself
basically the browser has no real say at that point in how long it sticks around
it will keep an object for as long as it likes, but that object will only work as long as you have a shared_ptr reference to it
are you familiar with boost::shared_ptr and boost::weak_ptr?
mital 23:02 i am familiar with shred_ptr... it keeps reference of the object till anybody is referring it ... as soon as reference count goes 0 ... it deletes it..
taxilian 23:02 right
mital 23:02 not much about weak_ptr..
taxilian 23:02 weak_ptr works similarly
except that it only keeps a reference to the data block with the refcount
so if the shared_ptr goes away, the weak_ptr can no longer access it
to use a weak_ptr you have to lock it, which creates a shared_ptr from the weak_ptr so that the object doesn't go away until you're done with it
following me so far?
mital 23:02 hmm so i assign same weak_ptr to shared_ptr.. the reference count would be 2...
taxilian 23:02 not quite
you start with a shared_ptr
assign it to a weak_ptr
reference count is 1
weak count is 1
reset the shared_ptr, reference count is 0, object is freed
weak count is still 1 — there is still a weak_ptr
but when you try to lock the weak_ptr, it sees that the shared_ptr is gone so it returns NULL
and you know it's useless
mital 23:02 oh it cannot access the memory even if its referencing it...
taxilian 23:02 you start with a shared_ptr, reference count is 1
mital 23:02 oh nice :) i understood it perfectly now :)
taxilian 23:02 you then assign to a weak_ptr; refcount 1 weak count 1
then you do shared_ptr<type> = weakptr.lock()
and now you have 2 shared_ptrs, so refcount is 2
until that goes out of scope
so it gives you a safe way to hold a "weak" pointer to an object and then safely use it if it's around, but know that it's gone if not
mital 23:02 they are two different counts maintained ... and u can access object from each of them...
taxilian 23:02 right
but you can only actually access the object iwth a shared_ptr
which you get by locking a weak_ptr
so when your last shared_ptr goes out of scope, the browser only has a weak_ptr
so your object will be destroyed
and all calls to the browser's copy will just throw an exception that the object is invalid now
make sense?
the reason for that is that the browser doesn't always give you much control on when it will release something
and we often need to be able to be sure that something will go away before plugin shutdown
mital 23:02 yeah it makes sense.. but u said the shared_ptr is referenced from within firebreath for every object ?
taxilian 23:02 yes, if you return a shared_ptr from your function the browserhost will hold it for you
so that it doesn't just get invalidated immediately
however, if you return a weak_ptr it will not
and the returned object will only be good as long as you don't destroy it by releasing the shared_ptr you have to it
mital 23:02 oh so deletion of my object is either with firebreath - end of plugin lifetime or with my own code.
taxilian 23:02 right
or never, if you're foolish enough to create a circular reference… =] or lose a shared_ptr somehow without it being destroyed. so be careful =]
but that's given in c++
mital 23:02 I worked on Javascriptcore / webkit.. it calls finalize callback when an object is not anymore referenced by any javascript .. is there anything we get from npapi ?
taxilian 23:02 well, yes and no
it does eventually release the NPObject we create
the problem is that different browsers do that at a different time
and it's not reliable
sometimes never, sometimes only after our plugin is destroyed
I have toyed with the idea of making a method for completely giving control to javascript, but usually that is not ideal
I'm open to suggestions on how it could be improved in 1.5, though
to find more of a happy medium
mital 23:02 oh... with JSC i am getting the callback as soon as i derefernce it .. atleast it should be working properly with webkit
and all webkit based browsers
not really * sorry ... browsers using JSC
taxilian 23:02 probably works most of the time
but it's the other part of the time that will kill you =]
mital 23:02 we should atleast call some callback to our FB class saying that its not being refered any more by any javascript. there is no point of keeping objects around for the entire lifetime of the plugin / periodic cleanup provided we can do spot cleanup of the unused memory. what say ?
taxilian 23:02 i'm open to the idea, but I don't know of a way to do it
hmm. let me think on it
might be possible to use a weak_ptr to the browserhost
hmm. that might actually work
I will think on it, but can't do anything with it tonight; could you file an issue?
mital 23:02 I have not done that with npobjects but with JSC I do it every time... i am working on titanium_desktop ... there we do this cleanup everytime when our finalize_callback gets called
taxilian 23:02 so I don't forget?
mital 23:02 yeah sure...
taxilian 23:02 so the trick is that we have to get safely back from the NPObject to the browserhost and tell it that it can let go of the JSAPIPtr now
keeping in mind that there is no guarantee that the browser will destroy the NPObject before it destroys the BrowserHost
which means that the BrowserHost may or may not be there
however, the BrowserHost is also a shared_ptr, so we could potentially use a weak_ptr there as well
mital 23:02 yeah exactly... and the callback must be coming properly for most of the time..
taxilian 23:02 hmm. I like the idea; it's a good solution that solves both issues
makes it so our objects can be released at shutdown even if the browser hasn't released them yet
but also gives us the browser's reference counting
best of both worlds at the cost of a little bit of complexity
need to make sure I've thought it through all the way, but I think it'll work
mital 23:02 yeah.. I can see lot more complex things like make_method done in this project...
taxilian 23:02 heh. that's complex, but it's not error prone
it's very localized
and easy to test
mital 23:02 yeah... this is not easy to test things .. but life is always full of challenges :)
taxilian 23:02 if our lifecycles get screwed up we're all in trouble =]
I think it's doable
just not tonight
I have to finish a school assignment and be on a plane in 6 hours :-/
mital 23:02 yeah.. let me know if I could help you out ... though I do not know much about the code of firebreath.
taxilian 23:02 I appreciate it
mital 23:02 i m filing a bug
taxilian 23:02 you'll find it's not bad
there are two objects that would need to change; three, since BrowserHost will probably need a little tweaking
COMJavascriptObject on IE, NPJavascriptObject on firefox, and BrowserHost
mital 23:02 hmm