IRC Log Viewer » #firebreath » 2012-02-13

IRC Nick Time (GMT-7) Message
kun 03:02 taxilian...are u there??
reichi 03:02 for sure not
it like 3/4 o'clock in the morning for him i think
kun 03:02 k thanks
linearray 06:02 kun: did you see the reply by thg435?
to your fist question
on stackoverflow
kun 08:02 taxilian?
FireBreathBot 12:02 JIRA issue issue created by colinblake
taxilian 12:02 linearray: the problem with FIREBREATH-162 is that I can't repro it :-/
FireBreathBot 12:02 FIREBREATH-162: Summary: Build test fails on Mac
FIREBREATH-162: Assigned To: richard
FIREBREATH-162: Priority: Minor, Status: Open,
taxilian 12:02 hard to fix what you can't repro
linearray 12:02 well, I have it as well
I'll take a look
ch 12:02 this is probably really that ScriptingCoreTest fails, not really connected to xcodebuild
linearray 12:02 yes
ch 12:02 (I saw this as well.)
taxilian 12:02 the thing is that ScriptingCoreTest doesn't fail on any of my machines
linearray 12:02 I guess one of them is Lion + XCode 4.2.1
It fails on both my machines with that configuration
taxilian 12:02 I am running Lion w/ XCode 4.2.1
blarson 13:02 I need to tell Chrome in Linux that my plugin uses xembed
NPP_GetValue() isn't called with NPPVpluginNeedsXEmbed though
am I missing something?
taxilian 13:02 you have to call something to tell it you support it
blarson 13:02 I didn't see anything on - I'll start searching through FireBreath
linearray 13:02 after wstring->variant->string what remains of скажи is скажи
taxilian 13:02 it'd most likely be in NpapiPluginX11
!findfile NPAPIPluginX11
FireBreathBot 13:02 Found 2 matching file(s) in the master branch. First 2 are:
taxilian 13:02 go back to that page and read Telling Mozilla You Support XEmbed
it's there
blarson 13:02 do the calls to GetvalueProc() matter?
I don't care if the browser supports the feature - I'm only targeting chrome on linux
ch 13:02 whats the point of converting wide data into a std::string, btw?
taxilian 13:02 ch: in what context?
ch 13:02 in that test
the test tries to do a wstring->variant->string conversion
taxilian 13:02 ahh
the point is that firefox doesn't support wide data
it supports UTF8
so if we can't convert wide data to UTF8 (std::string) then we can't support those characters on any npapi browsers
(I said firefox, but I meant NPAPI)
fredmanjr 13:02 Hello. I'm new to Firebreath and just experimenting. I am trying to wrap a C API that uses opaque pointers. I'm wondering what the best way is to wrap them. Any help?
taxilian 13:02 probably with a C++ class
seriously, though, it's really hard to say because I have no idea what you're trying to do
fredmanjr 13:02 On the JavaScript side, I'd like to do something like this: var myObj = plugin().CreateObj(); plugin().DoSomethingWithObj(myObj, 5);
In C, I'd have an opaque Obj type: typedef __Obj* Obj;
And functions like this:
Obj CreateObj();
void DoSomethingWithObj(Obj obj, int x);
taxilian 13:02 if you're doing that, then I'd probably just have a std:map with a map from an id of some sort to your opaque pointer
return the id to javascript and pass it back in
however, tha'ts not a very "javascript"-like API
rather, in Javascript you'd usually do myObj.DoSomething(5)
fredmanjr 13:02 Yes, the plan would be to create a JavaScript class that provides the type of interface you mentioned. Under the hood it would make calls to the C-like API.
taxilian 13:02 well, plugin().CreateObj() would call a function CreateObj on the main JSAPI class
and it would instantiate a new instance of (probably) a different JSAPI object that would track the opaque pointer, etc
and return it
then all future calls would happen on that object which still has the opaque pointer
fredmanjr 13:02 Yes, that should work, no? Maybe I'm not following...
taxilian 13:02 yes
that should work just fine
fredmanjr 13:02 Cool. Now, are there any examples in the FireBreath docs for wrapping a simple C++ class? In other words, can I create a JavaScript object with properties/methods and return it? Do I simply extend from JSAPIAuto, like my API class?
taxilian 13:02 that's exactly what you do
it's just another API class
there is nothing magical about your base JSAPI class; you could even make more instances of that and return them if you wanted
fredmanjr 13:02 Great. Now it'd be great if someone wrote a SWIG module for FireBreath...
taxilian 13:02 be my guest ;-)
reichi 13:02 hrhr
fredmanjr 13:02 haha
reichi 13:02 connecting to python?
fredmanjr 13:02 Nah, I want a JavaScript wrapper for my C++ code. I've used SWIG in the past for creating python wrappers. It'd be nice if I could do the same for Firebreath. Or are you suggesting that if I had python wrappers then JavaScript to python would not be difficult?
taxilian 13:02 heh. some have embedded python into a browser plugin, but I wouldn't say it's not difficult
fredmanjr 13:02 Interesting.
Well, thanks for your help!
taxilian 13:02 good luck
blarson 14:02 taxilian: I'm following the docs at
when I run './', it complains that there is no ./projects folder
if I create one, it complains again:
project dir: /home/blarson/projects/FireBreath/projects
No projects found in /.
CMake Error at CMakeLists.txt:151 (MESSAGE):
To build examples, run 'prep<ver> examples'
taxilian 14:02 are you trying to build an example, or create a new project?
blarson 14:02 build an example for now
taxilian 14:02 then you should read the error message because it tells you waht to do
./ examples
also on the page you mentioned, read "Generate the example project files"
blarson 14:02 yeah that ran fine - later on in the docs it says to run ./ w/out arguments - I guess that only works if the projects/ folder is populated?
taxilian 14:02 that is if you're building your own project which is in the projects dir
reichi 14:02 so that's what you get when you miss the point where you should have cleaned your pc fan instead of compiling all day long...: "CPU0: Core temperature above threshold, cpu clock throttled (total events = 1)"
taxilian 14:02 the syntax is ./ <projects dir> <build dir>
reichi 14:02 :/
taxilian 14:02 reichi: oops :-/
reichi 14:02 i gues i'll better shut it down and clean it up now ;)
taxilian 14:02 maybe time for a new fan, definitely time to clean =]
reichi 14:02 luckily modern pcs don break
but just slow themselves down
in the good old times the cpu would've blown up straight away
taxilian 14:02 hehe
yeah, convenient, that
blarson 14:02 is there an easy way to build the examples in debug mode?
taxilian 14:02
should probably add that or a link to it on the building on linux page
feel free to do so =] I dont' have time
blarson 14:02 you've been so helpful, only seems fair :)
I'll go create an account
taxilian 14:02 you'd be surprised how many people don't seem to see it that way… =] I appreciate it
and please update any docs you find to be confusing; linux in particular isn't used as much and so the support for it isn't as good
blarson 14:02 yeah if I run across anything I'll see if I can improve it
right now I just want to figure out why Chrome won't use xembed for my plugin, but will for FireBreath
taxilian 14:02 yeah, looking again I don't know the answer to your question :-/ one thing about Chrome is that sometimes if it sees something it doesn't like it'll abort without notice
you could just use FireBreath for your plugin =]
blarson 14:02 hehe yeah :)
I'm just trying to get jnext - a dead npapi plugin - to work on modern-day chrome
porting it to FireBreath is probably my last resort
taxilian 14:02 hehe
I remember now
too much going on; I can't keep track of which project each person is looking into =]
blarson 14:02 yeah no problem, you have a lot of people bugging you
taxilian 14:02 well, more to the point I have a full time job =]
and speaking of which, I will be AFK for a bit. good luck
blarson 14:02 I dug through the chromium source and see where it calls GetValue(NPPVpluginNeedsXEmbed) before logging the error I see, but I never get that call. No clue what is going on. I wonder if the plugin is doing something odd in NPP_New before the browser calls getvalue to check for xembed
thesleepr 20:02 Hello!
dougma 20:02 hi!
thesleepr 20:02 i'm new to firebreath, and I hate asking questions like this, but is it even possible to use C++ programming within the firebreath dll?
dougma 20:02 yes, firebreath is c++
thesleepr 20:02 oh, good.
what do i have to know to declare, define, and finally call said function?
dougma 20:02 you need to know c++
and you should look at the example projects
thesleepr 20:02 :( i tried looking at the FB example plugin, but it really didn't seem helpful since all of the scripting is on the test.html file
dougma 20:02 yeah you want to look at the c++ project. :)
it shows how to create a jsapi and decalre the methods and implement them
thesleepr 20:02 is that within the FB example?
dougma 20:02 !find fbtestplugin
FireBreathBot 20:02 Could not find any tags matching fbtestplugin
dougma 20:02 mmm
yeah, build the examples... load the solution
thesleepr 20:02 yeah, i have the solution open in VS 2010 right now
i've been browsing the source and header files
dougma 20:02 ok, and browse through the wiki.. maybe start here?
thesleepr 20:02 that looks helpful. I'll read around on that. The reason for my stress in this thing is that I work 60 hr weeks right now and I'm basically transferring over to the code department in april. before then, I was kinda given the task to make a chrome extension that launches something the way that we do it in firefox. only problem is that firefox can do that through java. chrome can not
so yeah... thanks for helping :P
thesleepr 20:02 okay. i think i'm understanding it a bit more. the cpp file handles the functions and the calls and declarations look to happen in the header of the API files.
thesleepr 21:02 are there functions defined in the FB test plugin that aren't used at all? I'm trying to find how the asBool function is called
taxilian 21:02 it's quite possible
thesleepr 21:02 mkay. I'll look for one that is
taxilian 21:02 FBTestPlugin is a test plugin; the test.html file is kinda hacked together and may not be as complete as it could be
is there a particular problem you're trying to understand?
thesleepr 21:02 well, basically this is my first adventure into realistic programming application. before, I always just made calculating functions for a programming class. so I'm stumbling through figuring out how all of these things interact with eachother
taxilian 21:02 keep in mind that there is a lot of "magic" glue going on behind the scenes with JSAPIAuto
registerMethod and registerProperty are what make a method or property available to javascript
thesleepr 21:02 hmm.. okay, well based on your expertise in this matter, how difficult would it be to make it so a chrome extension passes the string of a URL into the plugin which then launches an external application with a modified version of the string as an argument?
taxilian 21:02 easy
at least as far as the plugin part goes
I don't do extensions
thesleepr 21:02 yeah, they're not as powerful as firefox
taxilian 21:02 ?
I don't understand your comment
my specialty is plugins; plugins are sometimes used as par of extensions, but extensions aren't my thing so I don't know the details of that part of the interaction
thesleepr 21:02 oh, I'm just saying that firefox addons have more power than chrome extensions. with firefox, you can just use java to execute the application. with chrome, you have to rely on the npapi
oh, no worries
taxilian 21:02 using java with a firefox extension has got to be about the least well supported and most error prone way of doing things
don't compare that to chrome extensions, please =] it's not at all the same thing
thesleepr 21:02 sorry
taxilian 21:02 actually, I'm generally fairly impressed with chrome extensions compared to firefox extensions; but then, I've never been a big fan of making addons rely on java, so I've never used that type of extension
it really is a different thing
thesleepr 21:02 to be honest, I'm not all that familiar with them. This is more or less a crash course into the whole thing.
taxilian 21:02 yeah; it's an interesting world. most people don't even know there is a difference between a plugin and an extension =]
now you're learning that there are different types of extensions, etc
thesleepr 21:02 mhmm. it's definitely fascinating to see all of the different types of programming that go into something
okay. it looks like the best example of a string being sent over into cpp is the echo function. It looks like it sends it over as an FBVariant, then checks if it's an object, converts it into a string, then outputs it in an html log?
taxilian 21:02 you are way overthinking this, my friend
if you need a string, just make the parameter type std::string
no need to start it as a variant
in practice I very rarely use variant as a parameter type for a JSAPI method
thesleepr 21:02 alright then. for string cases, I'm finding things like "plugin.onfired = function (str)"
taxilian 21:02 that would be an example of attaching an event handler
and has nothing to do with a string other than that the event handler is expecting a string from the plugin
thesleepr 21:02 gotcha
well, sorta. that seems to be the only function in the test.html that mentions a string
taxilian 21:02 there is nothing special about a string
to firebreath, it's just another type
all of the examples that use an int? you can change it to a string. granted, a + b works a bit different if those are std::strings, but it would still work
create a plugin project using fbgen and play with it
it's really really easy
thesleepr 21:02 yeah, I could probably create another test html
taxilian 21:02 create a *plugin project*
not FBTestPlugin
your own
it generates a FBControl.htm that gives you a starting point
use the javascript console to play
and just experiment
thesleepr 21:02 i actually have no idea how to get that console
taxilian 21:02 looking at examples is good, but doing things on your own is a better place to start; you look at the examples when something isn't working
it's in chrome
!lmgt chrome javascript console
.lmgt chrome javascript console
FireBreathBot 21:02 Let me google that for you:
thesleepr 21:02 lol
alrighty then. I'll play around a bit.
taxilian 21:02 good luck =]
thesleepr 21:02 btw, is there a specific command used for executing .exes? I have one set up with ShellExecute(NULL, NULL, "C:\\Windows\\notepad.exe", NULL, NULL, SW_SHOW);
shenberg 21:02 Erm, do you really want to use the shell? If it's just for creating a process, why not CreateProcess? It's slightly more obnoxious to use, but it doesn't go through the shell so things like the downloaded-from-internet pop-up won't happen
taxilian 21:02 yeah, don't use ShellExecute; use CreateProcessEx
'least-wise, that's what I'd do
shenberg 21:02 Also, does anyone know what's the "right" way to test JSObjectPtr objects for javascript equality? I have two JSObjectPtrs pointing to DOM nodes in a document, I want to check whether they're pointing to the same node, and I'm not really sure how to do that...
taxilian 21:02 I don't know of a way to do that
you could give them an id and check that
shenberg 21:02 Hmm... I'm trying to do this in a way that javascript code can't interfere with...
dougma 21:02 you could say that if it's in the same position in the dom it's the same object
like work out that it's, for example, the first child of the third child of the second child.
but that sounds like a slow process
shenberg 21:02 Interesting idea
I might try that. I'm trying some other nasty hack right now
this isn't behaving the way it should: my plugin object has this line in the c'tor: registerAttribute("isTrue", true, true);
and yet, setting plugin.isTrue = false from javascript works just fine (chrome 17)
Should I just use a property with only a getter? I remember seeing those work...
dougma 21:02 never used readonly attributes myself. do other browsers have the same problem?
taxilian 21:02 shenberg: what version of FireBreath are you using? there was a fix for that recently
there may be a bug in readonly attributes; they aren't well tested or widely used
I ended up not needing them, so I haven't done any extensive testing
anyway, I gotta run now
I'll be on tomorrow
dougma 21:02 bye
shenberg 21:02 last commit is 43e46bd31c4e0ea720be6bf58f9fe241b3cf525f
FireBreathBot 21:02 43e46bd by Christian Hofstaedtler: FIREBREATH-153 Make honor CMAKE_OSX_ARCHITECTURES
shenberg 21:02 g'night
dougma 22:02 maybe he means 902bfdad6356bc577caaf283cc1614a2af2534c1
FireBreathBot 22:02 902bfda by Richard Bateman: Fixed bug in JSAPIAuto attributes
shenberg 22:02 that looks like the fix
I'll test it out and see if it actually helps. Unfortunately I have a weird memory leak in that area so I modified the code there myself some
thesleepr 22:02 hello again!
i have a question again. I got my function to call from the console to the point of where I somewhat understand what's going on.
i changed the return document.getElementById() from testPlugin to another name and also made the change in the injectPlugin. now, when I try and call it with a new name, it says Property 'onConextClick' of object <JSAPI-Auto Javascript Object> is not a function
anyone happen to know why that happens?
dougma 22:02 are you saying you changed the name of an attribute?
did you change the corresponding registerAttribute line?
thesleepr 22:02 i made a hacked up test.html
eerrr.. where do i find that?
it looks like that's in the Auto files. is the testPlugin the definition to that by default? because I can't find "testPlugin" anywhere in my plugin, but the thing doesn't seem to work with anything but that as the id name
dougma 22:02 well... you've lost me.
thesleepr 22:02 so. in google chrome console, I'm typing testPlugin.onContextClick("string") to test my function in the logs
when I changed the references of "testPlugin" to "myTest" in the test.html, it seems to stop working
dougma 22:02 is your plugin being instantiated? does your plugin have a method called onContextClick?
why are you typing "testPlugin.onContextClick...." if you've changed to "myTest"?
thesleepr 22:02 it was testPlugin. I used it that way, then wanted to customize it to my own uses so i changed it and reloaded the page
now, it's stopped working
dougma 22:02 well... first confirm that it is being instantiated.
thesleepr 22:02 i'm getting the Plugin onload event passed! from the test.html, so I'm pretty sure that part is good
dougma 22:02 great.
thesleepr 22:02 (i changed the html to check for my plugin)
dougma 22:02 what browser are you using?
thesleepr 22:02 chrome
dougma 22:02 so try document.getElementById("testPlugin").onContextClick("string")
(in the console)
thesleepr 22:02 lkjglkjhdljk... damnit. it's working now lol
i didn't change anything
thanks for letting me bug you :P
dougma 23:02 probably you made a typo... "Property 'onConextClick' of object <JSAPI-Auto Javascript Object> is not a function