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

IRC Nick Time (GMT-7) Message
iAmJohn 07:05 hi, where can I find more information about how to pass arguments by reference to methods?
reichi 07:05 in any c++ guide
const std::string &argument
usually
johannes 07:05 i assume he wants a reference to the javascript object in a plugin method ... *guessing
iAmJohn 07:05 I know how to do that in c++, but I am new to firebeath and this doc (http://www.firebreath.org/display/documentation/JSAPI+Methods#JSAPIMethods-JavaScriptarrays)) mistook me
reichi 07:05 hmm
firebreath does all that for you
you just have to use firebreath and boost the right way
there are demo plugins
you may want to have a look at them
iAmJohn 07:05 ok, thanks, I will check that!
thanks again reichi!
reichi 07:05 basically you derive everything you want to "pass around" (between c++ and js) from FB::JSAPIAuto
and do something like
registerProperty("visible", make_property(this, &OipfApplication::get_visible));
registerProperty("privateData", make_property(this, &OipfApplication::get_privateData));
in your constructor for everything you want to publish via javascript
(in this case properties/attributes)
which are read-only
as there is no setter :)
iAmJohn 07:05 basically I will create properties that will store the return values, is that right?
reichi 07:05 hmm
i don't think
but maybe i don't get what you mean
let's say OipfApplication is assigned the javascript var app
(referring to my xamples above)
registerProperty("visible", make_property(this, &OipfApplication::get_visible));
alert(app.visible)
would now call the method get_visible on the instance of OipfApplication
and give you it's return-value
trying to set the value would throw an exception
as the property ist read-only
registerProperty("visible", make_property(this, &OipfApplication::get_visible, &OipfApplication::set_visible));
whould be read/write
as there is a setter
https://github.com/firebreath/FireBreath/tree/master/examples
here's the official example code
iAmJohn 07:05 I think that I was not clear in what I want. I want do do exactly what johannes said: "i assume he wants a reference to the javascript object in a plugin method ... *guessing)". I am sorry
reichi 07:05 which object
an existing one?
like interacting with
document.something
?
that would be
http://www.firebreath.org/display/documentation/Invoking+methods+on+the+DOM
if you pass in "random" javascript" objects you would have to do the same i think
but instead you pass the stuff as argument
http://www.firebreath.org/display/documentation/JSAPI+Methods
"JavasCript methods"
instead of a function you can basically pass "anything"
if that's still not what you#re looking for you have to be more specific (an example could help)
iAmJohn 07:05 No, something like: "int getThings(array things)". this function will return an integer describing if it succeed or failed and store in "things" the result
reichi 07:05 called from javascript?
iAmJohn 07:05 yes
reichi 07:05 javascript has no call by reference
you have to return the result
std::string[] getThings()
you may retunr null though
my example was bad
to be honest
iAmJohn 07:05 yes to "return null" ! and maybe create a read only property that stores the error code of the operation,
reichi 07:05 to be flexible
you want to use Fb::Variant as return-type
iAmJohn 07:05 No, I think that I explained myself badly
reichi 07:05 sorry
iAmJohn 07:05 no to "bad example" lol
reichi 07:05 FB::variant
FB::VariantList& Collection::Values()
{
return m_collection;
}
you can also do something like
throw FB::script_error("Index out of range");
(throw an exception)
iAmJohn 07:05 google chrome does not displays the error correctly
reichi 07:05 well you simply cannot pass things in by reference and change them on the fly
that's one thing
iAmJohn 07:05 I have already tried that solution but I am always getting this http://code.google.com/p/firebreath/issues/detail?id=127
reichi 07:05 you may pass something
and return the changed version of it
i think there was some stuff added on the exception object
to get the message manually
iirc
iAmJohn 07:05 That alternative (throw an exception) is the one that i wanted first.
reichi 07:05 you could try
e.what()
iAmJohn 07:05 But my plugin has to support chrome
reichi 07:05 to get the message
iAmJohn 07:05 i will try
reichi 07:05 but i'm not sure if it'll work ;)
iAmJohn 07:05 5 minutes! :p
reichi 07:05 if you want to return "null"
you have to do something like
FB::variant Bla::getSomething(int arg){ return FB::FBNull(); }
iAmJohn 07:05 ( Error calling method on NPObject. has no method 'what')
reichi 07:05 the exception has no what?
iAmJohn 07:05 i tried this
try{plugin().echo("asd");} catch(msg){alert(msg.what());} TypeError: Object Error: Error calling method on NPObject. has no method 'what'
reichi 07:05 well
there was something ;)
"recently"
but i don't remember what it was :/
iAmJohn 07:05 do you remember where?
reichi 07:05 maybe you should wait another hour
and ask taxillian
hes the master-chief-firebreath-guru
i'm just a user ;)
iAmJohn 07:05 I will do that, but I will search also in the irc logs
anyway, thanks a lot for your help and your time!
reichi 07:05 https://github.com/firebreath/FireBreath/commit/d0906952778c991d47c2d10a0b138aff5e355824
FireBreathBot 07:05 d090695 by Richard Bateman: FIREBREATH-117: Added getLastException method to JSAPI objec http://tinyurl.com/6pezfpf
reichi 07:05 this one
oh this bot rocks!
plugin().getLastException() i guess
iAmJohn 07:05 yes, that works! :D
thanks a lot!
reichi 08:05 you#re welcome
but
you always have to call it immediately ;)
(obviously)
iAmJohn 08:05 yes, it makes sense!
;)
it's he last exception! :P
savardc 09:05 hi, I started building a plugin that will use qt as the main component. Do you guys know any example I could look at?
taxilian 09:05 nope
others have ask, nobody has bothered to contribute back an example (assuming they got it working)
savardc 09:05 cool
do you see any reason it should not work?
taxilian 09:05 no, but since I've never actually used QT that doesn't mean much =]
savardc 09:05 hehe, fair enough :)
reichi 09:05 hmm
there is no interface to use QWidget within npapi
which you'd probably expect to be able to
the issue is a simple one
npapi has never been defined for linux without X11
taxilian 09:05 yep
reichi 09:05 so common linux npapi plugin expect the XiD
which you won't have on an embedded system without X11 ;)
you can try to port the qtwebkit symbian api
(that's what i am currently trying
to pass a QWidget and a QPainter to your NPAPI Plugin
instead of GdkWindow
GdkNativeWindow to be more precise
the symbian approach generally solves that
but well
let me tell you, it's more than just c&p
taxilian 09:05 hehe
reichi 09:05 and webkit with debug symbols is about 3Zillion petabytes big and twice as slow...
taxilian 09:05 =]
reichi 09:05 savardc: so if symbian is not your target platfor there is no simple approach
none but using X11
you can fetch the X11 stuff
und push it into the QX11 objects i think
which should allow using standard QWidgets
but hat only works if you do have X11 (not on embedded devices, basically)
savardc 09:05 I'm targeting desktop
I just started looking at this. I was thinking I could just fwd most events to qt
reichi 09:05 ah ok
gimme a sec
i can give a hint where to start i think
savardc 09:05 basically, I have a qt app that I want to put in a plugin
reichi 09:05 i guess you could use a QX11EmbedContainer
(without ever having used that thing myself)
savardc 09:05 hmm.. not sure how much I would gain
reichi 09:05 using gtk would be much easier ;)
i guess
Adan 12:05 Hello.... anyone available for some newb help?
taxilian 12:05 .ask
FireBreathBot 12:05 If you need help, just ask your question and wait for people to come back.
Adan 12:05 I just watched the Windows tutorial, followed it and registered the DLL, but the plugin isn't working in Firefox or Chrome.
Looking for a little help..
taxilian 12:05 did it register successfully?
no error message?
what version of windows?
I'm actually about to go to lunch; I can probably try to help when I get back
Adan 12:05 Registered successfully... Windows 7 x64
Okay, thanks.
taxilian 12:05 which prep script did you run?
Adan 12:05 prep2010x64.cmd
taxilian 12:05 that's yoru problem
those browsers are 32 bit
delete the build dir, dont' use the x64.cmd
Adan 12:05 Ah... start over and run "prep2010.cmd" ?
taxilian 12:05 no need to rerun fbgen
but yes
Adan 12:05 Okay, I'll give it a shot.
Adam_ 12:05 After running the right prep file, it works in FF, but not in Chrome....
taxilian 12:05 did you quit chrome completely and open again?
Adam_ 12:05 No... didn't think I had to. Brb...
Adam__ 12:05 That worked... thanks for the help.
taxilian 12:05 yw
good luck
Adam__ 12:05 I'll need it. Just trying to write a plugin to launch executables from a Chrome extension.
jshanab 16:05 Every once in a while The wix installer heat tool gets stuck on createing the msi. If I run the heat tool on the command line against all the dll's when i get to the plugin, it hangs. Laast time this happened it took a week to solve and I do not know what fixed or broke it. Anyone have this problem?
taxilian 16:05 never seen it
jshanab 16:05 It has happened now twice and even if I check in to git and pull it down to another machine, it moves to the fresh machine. I did see one blog post about curVer and non versioned stuff ending up pointing back to itself, but those people claim 100% cpu when that happens.
I never have the 100% cpu but task manager is the only way to break out of it
jshanab 16:05 When use the verbose flag it stops on the second task "trying to harvest self-registration information from native dll .... Does that give us a hint?
taxilian 16:05 what version of visual studio are you using?
jshanab 16:05 VS2010 premium
taxilian 16:05 hmm
nope
no idea
unless there is something static that isn't closing properly
jshanab 16:05 Maybe my old project is the issue. I have been maintaining the .wxs file myself, but the output of heat is a .wxs file
What do you mean about the static, is it trying to instanitiate or load the dll to get info?
All other people having problems like this are having issues with COM object selfReg (which I know nothing about)
taxilian 16:05 that's almost certainly what is happening
is that your selfreg isn't returning
perhaps something is different when it's running from heat
you could attach a debugger to heat and see where it is hanging
jshanab 16:05 Where in my editing of a firebreath could I of broken this. I made recent changes, maybe that can narrow it down. (i tried attaching but I need symbols :-)) let me try that again
taxilian 16:05 I don't know
jshanab 16:05 #@$##@! worst IDE in history. GRRR. I cannot copy a stack trace to pastebin it. Umong 100 other thins VS2010 just gets wrong like cannot use -> in a watch or printing breakpoint
pfft. got it http://pastebin.com/BANECaqw can't use keystroke or mouse. it is a menu item LOL
Does any of this give you a hint? I am stressing
taxilian 16:05 hmm. no. your DLL isn't loaded at all?
jshanab 16:05 When you first said something about static that isn't closing properly, I happened to add a static variable in a class. I removed the static qualifier and it completed on one machine. Should have zero relation so i am trying it on the second, slower machine now. :-(
Yup. that fixed it.
taxilian 17:05 wow. I suggested something useful?
awesome!
jshanab 17:05 ok. a static class reference to a class subclassed from an export lib whose code is in a dll. prevents wix from working! I will have to remember that and go back to just using a pointer.
http://pastebin.com/7wmhxLCd if audioStream_ is made static, kablewy
Having averted disater, i am going home. Thanks taxillian!
taxilian 17:05 have a good one =]
Feeling 23:05 does anybody know about Failed DoModal(MFC) in workthread if that has parent( PluginWindowWin::getHWND() ) ??
all browser worked OK. except IE.
Feeling 23:05 taxilian: could i post or send message to API Class?