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

IRC Nick Time (GMT-7) Message
Johns_ 04:02 I'm a newbie to this. Could someone please share any links which explains the fundamentals of FireBreath. How can one installable handle all browsers, please?
zmichl 07:02 hello, how can I protect the FB plugin to be usable only from Firefox chrome, not from user's html page?
Nils0r 07:02 Hi
iaincollins 07:02 hi zmichl
(& Nils0r :)
zmichl 07:02 I just want to call it from my extension and deny any access from html pages ;)
iaincollins 07:02 Oh I see
(was about to ask what you meant!)
Hmm, well you can check the calling URL value
though I'm not sure what that would be in the case of an extension
for local HTML files, I think it's just the local path on disk
zmichl 07:02 I got this from one of Firefox developers: "You can write the plugin so that it can only be instantiated by chrome code using NPAPI and NPRuntime scripting, I believe."
iaincollins 07:02 I don't know this (I'm guessing, I'm just a user of FB) but sounds like that would require creating something specifically designed to do that, not sure how easy it would be to do that specifically with FB as it is
zmichl 07:02 ...but it doesn't tell much to me :)
iaincollins 07:02 hehe no
Hmm there must a way *ponders*
+be
So *maybe* m_host->getDOMWindow()->getLocation(); would help - e.g. std::string url = this->m_host->getDOMWindow()->getLocation();
... then checking to see if it points to local location ... although if there are security considerations that may not be appropriate.
I am not sure if you can tell how a plugin has been invoked, people have discussed invoking them from extentions before though
oh hmm
if you go to: http://logs.firebreath.org/
and search for "extensions" the second hit in particular might be helpful (maybe others too)
sorry no, I meant 3rd one down (damn, need to be able to link to them directly :)
kylehuff is on here quite a bit, other than taxilian, he'd probably be good to talk to about it
zmichl 07:02 thanks for the link. but it semms that tey are talking about google chrome
And there is possible to define "private" in the manifest file.
iaincollins 07:02 yeah, I wasn't sure if there were any similarites there or not, sorry (aware they are different, but not sure if any of it might be realted)
zmichl 07:02 yes, I know :)
iaincollins 07:02 would be good to have some FAQ entires about FF & Chrome Extentions
zmichl 07:02 in the firefox is nothing (AFAIK) like "public" or "private" for plugins, so plugin is visible everywhere
iaincollins 07:02 hmm I see
I am doing URL based restriction in mine (for security reasons, because of actions / information the plug-in exposes)
zmichl 07:02 however, your advice about calling url could be the right way :)
iaincollins 07:02 I am only suggesting it because it's the only hammer I have :-)
I guess if that would work depends on what the plug-in does
zmichl 07:02 :)
iaincollins 07:02 I'm trying to think of some way of authenticating with the plugin from the extention securely
no way of doing that that couldn't be emulated and circumvented springs to mind
taxilian 08:02 morning all
iaincollins 08:02 morning
taxilian 08:02 zmichl: AFAIK there is no way to make a plugin so that it can only be accessed from an extension, but you could probably use getLocation and securityZones to make it so that you can't do anything with it unless called from an extension
iaincollins 08:02 Oh I didn't know about SecurityZones.. will have to read up on that on the wiki
taxilian 08:02 err, umm...
yeah
SecurityZones on the wiki...
hmm
that would be good, I think
to have that on the wiki
pq_H 08:02 hello
Nils0r 08:02 Hi
taxilian
taxilian 08:02 howdy
Nils0r 08:02 nice to meet you
my first time in this channel
taxilian 08:02 and you
welcome
Nils0r 08:02 im student and doing by bachelor thesis currently
part of it is developing a plugin
and whenever i search the internet for a question that came up
i find a posting by you
taxilian 08:02 lol. I try =]
Nils0r 08:02 in like 10 different places
taxilian 08:02 I'm not the most knowledgable on the subject, but I seem to be the most vocal
Nils0r 08:02 so i just found out about this channel and joined
though im not developing my plugin with firebreath
taxilian 08:02 may I ask why not?
Nils0r 08:02 i dont know if i know about that myself yet
basically i just started with the plugin samples from the sdk and implemented quite a lot already
taxilian 08:02 well, let me put it this way; I know NPAPI reasonably well. If I were you, I'd use FireBreath
Nils0r 08:02 found out about fb very late and the 'sample' had a huuuge overhead so did want to try the normal plugin first
taxilian 08:02 but of course some consider me biased on the subject
Nils0r 08:02 i want to know how exactly the npapi and stuff is working
still in the learning process
taxilian 08:02 fair enough
Nils0r 08:02 maybe i use FB once i got my knowledge in the base
and FB will then help me to focus on the other aspects of my plugin code
taxilian 08:02 that's the main goal of FB; it takes care of the mundane details of npapi and activex so you can focus on what your plugin actually does
how is it going so far?
Nils0r 08:02 quite good
the samples documentations are like no existant
thats why i got my knowledge basically by trial/error and posts on the internet
taxilian 08:02 yes… you see why I have written so much about it. it was mainly striking back in frustration against the lack of anything useful
Nils0r 08:02 i got a question now!
currently im trying to work with properties and callbacks
like
plugin.prop = function() { alert ... }
And i found out already that i just had to save the reference to the NPObject and later call InvokeDefault on the object
My question is
Is there any way to find out about the arguments list by the function
taxilian 08:02 no
NPObjects either do or don't respond to InvokeDefault
and there is no way to know what the arguments should be
Nils0r 08:02 Okay
Thought so, thanks
pq_H 08:02 hi i got a question too today
taxilian 08:02 FireBreath kinda adds this on it's own NPObjects by doing type checking / type conversion and throwing an exception as needed
go for it
pq_H 08:02 on CMyPlugin.h there're two lines /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/
and /** END EVENTDEF -- DON'T CHANGE THIS LINE **/
what's the reason i can't change those lines?
taxilian 08:02 there isn't one
there was going to be
but we never wrote it
pq_H 08:02 oh
cool
taxilian 08:02 and don't plan to :-P
I just haven't removed it from the template yet
pq_H 08:02 some kind of preprocessor i thought
taxilian 08:02 it was going to be used to auto add code
zmichl 08:02 can I find any example how to use that securityZones?
taxilian 08:02 hmm. I can give you some examples
I haven't had time to write docs for it yet
zmichl 08:02 ok, thanks :)
taxilian 08:02 so there are two parts to it
the first is to set which zone new methods and properties are going in
and the second is to determine at runtime which zone a given JSAPI object is in
here is an example of how to change the zone temporarily while you register methods and properties: https://github.com/firebreath/FireBreath/blob/master/src/ScriptingCore/JSAPIAuto.cpp
then there are two ways to set which zone it lives in; the first is to pass it as a parameter to the JSAPIAuto constructor, the second is to call setDefaultZone on the JSAPI object after the fact
https://github.com/firebreath/FireBreath/blob/master/src/ScriptingCore/JSAPI.cpp#L47
the way I use it is I check the hostname and set a different zone depending on what it is
zmichl 09:02 great, thanks for the example ;)
amackera 10:02 taxilian: I am still crashing, this time whenever I try to call a function on the plugin object
taxilian 10:02 on FBTestPlugin?
platform(s)?
any function or a specific one?
amackera 10:02 Let me try on FBTestPlugin
it's on mac
firefox 3.6
iaincollins|away 10:02 Just FYI I'm also seeing 1.4 crash _only_in_IE_ (only tried with v8) if I try and access an undefined property (e.g. plugin().notARealProperty ), and then it doesn't crash till I reload / try and navigate away. But I am going to shut up about that until I have investigated & am able to report in more detail.
But if you are seeing funny crashes on page exits, food for thought (sumbled on it when trying to access a simple property from JS that I'd forgotten I renamed).
amackera 10:02 taxilian: well FBTestPlugin doesn't crash in the same way...
Must be a problem with my plugin
To be clear, FBTestPlugin doesn't crash at all :P
taxilian 11:02 iaincollins|away: is that the latest version?
I haven't seen that one
amackera 11:02 taxilian: I am getting a boost thread assertion failure
taxilian 12:02 where?
amackera 12:02 It looks like in scheduleAsyncCallback
taxilian 12:02 this is your plugin?
amackera 12:02 Yes
not reproducible on FBTestPlugin
taxilian 12:02 is it on the mutex?
amackera 12:02 yes
taxilian 12:02 when does it occur?
amackera 12:02 on page load of FBControl.htm
taxilian 12:02 on page load?
that's weird
most commonly that would be due to a bad browserhost pointer
amackera 12:02 hmm
taxilian 12:02 are you using any BrowsetHost* instead of BrowserHostPtr, etc?
amackera 12:02 It's crashing in PluginCore::setReady
taxilian 12:02 I repeat my question; are you using any raw pointers anywhere where you should be using a shared_ptr?
amackera 12:02 sorry
it's certainly possible, but not that i'm aware of
where might the problematic areas be? in factory?
taxilian 12:02 any class that has a BrowserHost* instead of BrowserHostPtr
legacy code from older versions of FireBreath
or another class that contains BrowserHostPtr that you had a bad ptr to
just that the most likely reason for that assert to fail is if the mutex isn't valid — which means the class containing it isn't valid
could be because it was already destructed or for another reason
amackera 12:02 Hm ok
I am grepping for BrowserHost* but nothing yet
nothing
I'll see if i can work it out
taxilian 12:02 good luck
amackera 14:02 I can
can't figure this out *
it's crashing in SafeQueue.h:49
the_condition_variable.notify_one()
taxilian 14:02 that doesn't sound like the crash you described before
amackera 14:02 yes you're right, I should have been more specific
the scheduleAsyncCallback() pushes the callback to the SafeQueue
everythign seems to work
then when notify_one() is called, a boost assertion fails
taxilian 14:02 what does the assertion mean?
amackera 14:02 I'm not entirely sure, how might I find that out
examine the boost source?
taxilian 14:02 by looking at the code where it fails
amackera 14:02 it fails to lock a pthread_mutex_scoped_lock
taxilian 14:02 has everything been initialized correctly?
again, that sounds like something getting used either before it's initialized or after it's released
you aren't trying to make an async call from a staticinit or anything crazy like that, are you?
amackera 14:02 nope
this is from the onload param
taxilian 14:02 the one that is automatic/built into FireBreath?
amackera 14:02 yep
taxilian 14:02 hmm. any chance you could pastebin me your plugin file?
you're using an object tag, not an embed tag, right?
amackera 14:02 object tag, yep
sorry, what do you mean pastebin the plugin file? you want to try the binary yourself? or the crash?
taxilian 14:02 go to pastebin.com or fpaste.org or whatever and paste the code for your plugin file, then send me the link
so I can look at what you're doing
see if I can spot anything
amackera 14:02 http://pastebin.com/jJgqmA8p
taxilian 14:02 hmm
I don't know
amackera 14:02 a strange one indeed
taxilian 14:02 you could send me the stack trace and I can see if anything triggers an idea
amackera 14:02 http://pastebin.com/ANNxyfX4
taxilian 14:02 have you started any threads or anything at this point?
amackera 14:02 Hmm that's possible, let me check
I start a thread in my onWindowAttached handler
but I don't think a window has been attached yet
taxilian 14:02 I would try commenting out things
simplify it until it works
then start adding things back in
you shouldn't need to modify firebreath while doing that
unless the bug is actually in FB code
but it'll be triggered by something in your code
so even still
amackera 14:02 Yeah that's a good call
I'll keep poking it and see if I can figure out what the cause is
Hmm actually I don't think I even do start a thread
jshanab_wcw 15:02 I have updated to FireBreath 1.4 but am having a bit of an issue with the prep script. I do not have a "projects directory, I brought everything into our svn. So now i have two plugins in their own directory and a common/firebreath directory. I have always done a ..\common\Firebreath\prep2010.cmd .\ and it has worked. Now that I updated to 1.4, the prep script throws a lot more stuff and...
...ends with Configuring incomplete, errors occured. Is this just because not all directories are plugins?
kylehuff 15:02 I have something similar, and it works for me (on 1.4). my directory layout is \main_repo\myplugin and \main_repo\firebreath - to prep I do firebreath\prep2008.cmd . build
taxilian 15:02 yeah, that's basically what I do as well
it will only include directories that have a PluginConfig.cmake in them
jshanab_wcw 15:02 Unfortunantly, now these errors are showing up in Visual studio and cancling the build :-(
taxilian 15:02 but other than that, it shouldn't matter
pastebin the cmake log
jshanab_wcw 15:02 So your firebreath is below the plugin
I want 1 common firebreath and multiple projects
taxilian 15:02 that's what I do
jshanab_wcw 15:02 ok, After the meeting, I will send....
amackera 15:02 taxilian: I think I've figured it out...! not an FB bug
taxilian 15:02 amackera: that's what I like to hear
kylehuff 15:02 hmmm... my plugin doesn't run on w32 at all now.. and I haven't changed anything that I recall..
taxilian 15:02 w32 is overrated
kylehuff 16:02 taxilian: should this warning concern me?
damned RDP
taxilian 16:02 I don't know; I've never seen that warning
sounds interesting, though ;-)
kylehuff 16:02 PluginWindow.obj : warning LNK4221: no public symbols found; archive member will be inaccessible
taxilian 16:02 probably not
but that does seem strange
actually, no, that's normal
kylehuff 16:02 other than that warning, my build log is clean on windows, but my plugin no longer runs.. bombs out when chrome loads it
taxilian 16:02 hmm. when did you last update?
and have you tried it on firefox?
kylehuff 16:02 just now, when the update of 1.4 didn't fix it, I switched to master to try it out
I am about to try on firefox
taxilian 16:02 1.4 and master are identical at the moment
re-run the prep script if you havne't
kylehuff 16:02 ah, well, then I tried it on a refreshed 1.4 twice...
=c )
(which included rerunning the prep after blowing away the build dir)
taxilian 16:02 o
ok
kylehuff 16:02 yeah, it seems to crash firefox entirely
amackera 16:02 as soon as I have a reference to boost::thread in my plugin it always crashes at the condition variable notify_one()
taxilian 16:02 kylehuff: crash dump?
kylehuff 16:02 taxilian: okay, as soon as I figure out how to get one of those in windows....
kylehuff 16:02 taxilian: crash dump like this? https://crash-stats.mozilla.com/report/index/f60a7abf-e8d0-4ea9-9eec-83d842110203
taxilian 16:02 hmm
kylehuff 16:02 I know I tested if it would compile under windows when you were proposing 1.4, but I don't remember if I actually tested it after compiling... I think I might have moved on to OSX, now that I think about it...
taxilian 16:02 this crash dump doesn't tell me enough; the best way would be to catch the crash in a debugger
and then see where it is crashing
kylehuff 16:02 taxilian: I could run in VS attached to the process, but I don't know what I am doing otherwise..
jshanab_wcw 17:02 Taxilian. The problem i was having is the removal of boost and the fetch on first run of prep. Therer seems to be a chicken and the egg problem, it fails to get boost so if fails to prep so it fails to get boost.
amackera 17:02 jshanab_wcw: why does it fail to get boost?
jshanab_wcw 17:02 I didn't catch why, but the site is timeing out right now for some things
It just tries to add the boost libs thread directory and fails. It does not appear to try. What triggers the download?
amackera 17:02 if you don't have system boost installed when the prep script is first run it will try to download I beliee
believe*
jshanab_wcw 17:02 "system boost" Is that an environment variable? cause I have other things using a different version of boost. Or is "system boost" part of FB (I don't remember this issue with 1.2, was it all in one?)
I removed the empty boost directory and re-ran prep, it recreates the empty directory and throws a github error :-(
c:\MVS\archiveserver\branches\jshanab-1.1\src\FireBreathPlugin\build>cmake -G "Visual Studio 10" -DPROJECTS_DIR="c:\MVS\archiveserver\b
ranches\jshanab-1.1\src\FireBreathPlugin" "c:\MVS\archiveserver\branches\jshanab-1.1\src\common\FireBreath"
Boost not found; downloading latest FireBreath-boost from GitHub (http://github.com/firebreath/firebreath-boost)
Using git
fatal: Not a git repository (or any of the parent directories): .git
ooo, that didn't come out very good, sorry
taxilian. Is GitHub Dead?
kylehuff 17:02 github.com is up for me
jshanab_wcw 17:02 I see it in a browser, but prep says "Not a git repository." Any ideas?
Remove .git folder and it seems to fix the issue.
Except i am still getting "504 gateway time-out" like when I choose curent zip link on website
taxilian 17:02 jshanab_wcw: github downloads may be down
if you have git, just git the whole thing from git
git clone git://github.com/firebreath/FireBreath -b firebreath-1.4 && git submodule update --init --recursive
jshanab_wcw 17:02 HUmm, that gets part way thru ...
Cloning into FireBreath...
remote: Counting objects: 13242, done.
remote: Compressing objects: 100% (4296/4296), done.
remote: Total 13242 (delta 10067), reused 11524 (delta 8800)
Receiving objects: 100% (13242/13242), 10.98 MiB | 882 KiB/s, done.
Resolving deltas: 100% (10067/10067), done.
fatal: Not a git repository (or any of the parent directories): .git
amackera 17:02 :|
you need to cd into the directory
perhaps?
kylehuff 17:02 ok, so I recompiled in debug mode, attached to firefox and I am at the point it breaks... but I don't know what I am looking at! lol.. the last item on the call stack is ">npgpgAuthPlugin.dll!strlen(unsigned char * buf=0x0012cdc4) Line 81 Asm" - does that mean anything to anyone?
jshanab_wcw 17:02 what directory? I just created a tmp/Firebreath (I am new to git)
Oh, for the second command submodule update LOL
amackera 17:02 git clone git://github.com/firebreath/FireBreath -b firebreath-1.4 && cd FireBreath && git submodule update --init --recursive
should do it i think
kylehuff 17:02 I think I figured out how to read this mess of crap..
jshanab_wcw 17:02 That certainly makes sense . And away she goes. Thanks
amackera 17:02 kylehuff: if you attach your VS debugger to firefox, when you crash the debugger should point to the sport where it crashed
spot*
jshanab_wcw 18:02 kylehuff, yeah you don't have a debug version of firtefox, jsut dig down into the call stack until you get to your code
kylehuff 18:02 yeah, I think I found the line it doesn't like.. but I don't know why it is crashing on win32...
amackera 18:02 hmm
a few things that have caught me:
if you specify a return type but don't return anything from a function
g++ has a default return, but VC++ crashes
Also unintialized booleans default to false in g++ but default to undefined in VC++ (and crash)
I don't know if that helps at all
kylehuff 18:02 this is the last line it runs of my code "std::string gpg_agent_info = (char *) getenv("GPG_AGENT_INFO");", and this is the call stack before and after that: http://pastebin.com/raw.php?i=SskaqkNb
amackera: anything helps, even if it is wrong or bad advice - I know virtually nothing about C/C++
=c )
jshanab_wcw 18:02 One that got me was when I had a dependent dll (avcodec-52.dll) that didn't load because of a dependency it had so the pluin didn't load and that usually just makes the javascript die, but sometimes javascript was there and plugin wasn't. (Windows is an eager loader, Linux is a lazy loader)
amackera 18:02 kylehuff: does getenv work in windows?
kylehuff 18:02 amackera: I have no idea; I assumed the compiler would have complained if it didn't..
but maybe that is a not a good assumption..
amackera 18:02 I'm pretty sure you need to use GetEnvironmentVariable()... etc.
so likely what's happening is that getenv nops, then the char * is NULL, which is bad access
jshanab_wcw 18:02 I have an existing 1.2 plugin, looks like I have some work to do to port it to FB-1.4 :-(
kylehuff 18:02 amackera: okay, I will try that, thanks.. would I need to do that different from OSX and Linux? (i.e. detect win32 and use GetEnvironmentVariable and otherwise use getenv ?)
amackera 18:02 that's right
GetEnvronmentVariable() is a win32api function
getenv() will work in both OSX and linux
jshanab_wcw 18:02 night all, returning to the fight in the morning
kylehuff 18:02 okay, I will give that a shot.. I am first going to hard-code the value of that variable, and see if my code runs otherwise - since I might introduce new problems with this new function.
amackera 18:02 jshanab_wcw: night!
kylehuff: good idea
Also GetEnvironmentVariable is a b*tch to use... you have to call it to get the length of the buffer, then call it again with a properly sized buffer
it's annoying as hell.
kylehuff 18:02 sounds like fun
in my search for examples of GetEnvironmentVariable() I found this, is this not relevant? http://msdn.microsoft.com/en-us/library/tehxacec(v=vs.80).aspx
wait, I'm using 2008, not 2005... my mistake..
amackera 18:02 hmm
it looks like it should work
perhaps the environment variable doesn't exist? it's returning a null char*?
kylehuff 18:02 yeah, it might not exist..
kylehuff 18:02 ok, oddly enough, it had nothing to do with getenv() directly, it had to do with the fact that later on, about 3 lines down, I used the variable (which contained a NULL pointer)...
amackera 18:02 haha weird
does that mean getenv works no problem in windows?
what was I smoking when I was writing that code in my own plugin...!?
kylehuff 18:02 I don't actually know if it works, since there I have no variable.. lol
I will populate the variable and let you know if it can read it..
amackera 18:02 alright
This is messed up...
I can create a new boost::thread in FBTestPlugin, but not my own plugin...
kylehuff 18:02 amackera: yeah, it can read the env variable using getenv
amackera 18:02 nice1
nice!*
kylehuff 18:02 at least on winXP SP3
amackera 18:02 I'll have to revisit my trashy win32 code
kylehuff 18:02 I wish win32 didn't exist... I feel like a dirty whore...
amackera 18:02 agreed
kylehuff 18:02 I think I am offended that the VS debugger lied to me about the line causing the problem
amackera 18:02 MS goes with the "close enough" philosophy for debugging
kylehuff 18:02 lol
taxilian 18:02 lol
sorry guys, I've been out most of the day; starting to feel a little more alive so maybe I'll be more helpful
this cough makes me almost wish I wasn't alive, though :-/
amackera 18:02 harsh :(
taxilian 18:02 this flu just won't go away
it's been a week and a half
kylehuff 18:02 yuk
amackera 18:02 yuck, that sucks
taxilian: I think I found a strange bug
key word there is *think*
taxilian 18:02 I try to avoid thinking
it gives me headaches
amackera 18:02 i'm pretty rusty at it, honestly
i believe when you include <boost/thread.hpp> in a header, then actually use it somewhere, plugin crashes hard
but if you include it in an implementation file then it works
kylehuff 18:02 taxilian: I got my problem sorted; it boils down to a windows and how it deals with getenv(). I also learned more than I wanted to know about debugging on windows.
thanks for your help with the debugging amackera
amackera 18:02 no problem, i'm glad you've sorted it out :)
taxilian 18:02 amackera: hmm; it's hard to say, but there could be things that could cause issues that way
you should never include a header file in another header file unless you really have to
kylehuff: glad you got it working =]
sorry you had to prostitute yourself to do it
anyone have any experience with any free forum software? considering putting up a firebreath forum
kylehuff 19:02 taxilian: simple machines forum has been solid for me. lots of features, easy to setup
taxilian 19:02 will look at it
thanks
amackera 19:02 taxilian: False alarm again :P bug is not in FB
taxilian 19:02 lol
amackera 19:02 haha
taxilian 19:02 music to my ears...
kylehuff 19:02 gonna head home.. later gus
&guys
amackera 19:02 later!
actually i'm headed out too, ttyl!
get well soon taxilian :)
kylehuff 21:02 on linux, what is the default build configuration? Debug? Release? MinSizeRel?
taxilian 21:02 debug
kylehuff 21:02 ah, okay.. how do you specify which one you want to build?
taxilian 21:02 it's a command line switch
I forget exactly
kylehuff 21:02 I can look it up, thanks!
taxilian 21:02 ok. good luck
kylehuff 21:02 now that I've got firebreath submoduled, it is so much easier to re-build the binaries on the various platforms