IRC Log Viewer » #firebreath » 2013-03-07

IRC Nick Time (GMT-7) Message
vahram 01:03 Hello.
I would like my plugin able to register to DOM onload event.
Idea is when any page is loaded in browser, to get that event , and lookup on that page
IS it possible to get that DOM event in my plugin?
vahram 01:03 I'm new on this, and if you ahve idea please give example how I can get DOM event from plugin
sbagay 04:03 Hello
I need a way to scan documents to browser
James_BB 04:03 Hi, I was wondering if anyone could help me with linking an external DLL to my Firebreath plugin
I'm trying to follow the instructions that Taxilian gave in his answer to that question
I just have really basic queries
1. Should I paste the .lib file for my dll into the root of the project? i.e. Firebreath/build/projects/MyFBPlugin
set (LIBRARY_PATH ${FireBreath_SOURCE_DIR}/path/to/library)
Would that then just be (in CMakeLists.txt)
And then would this work?
target_link_libraries(${PROJECT_NAME} debug "${LIBRARY_PATH}/debug/library.lib")
or would I need to put the .lib somewhere else?
I'm sorry, I'm just pretty confused
Also do I need to do all of this before I run the Prep scripts?
kylehuff 05:03 James_BB: I'm no expert on the matter, however, you can take a look at how I did it here:
you will notice I have the lib file in my plugin source directory, in a subdir named "libs"
James_BB 05:03 Hi Kyle
Had a look
set_property(TARGET libgpgme PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/libs/libgpgme/WINNT_x86-msvc/libgpgme.lib)
so, did you have more than just the .lib file in the subdirectory?
I'm really not understanding how to link things! :/
kylehuff 05:03 James_BB: yes, I did, however they are extra files for other distribution purposes. if built correctly, you should only need the .lib file
also, that line doesn't do any linking. it just sets up the library within cmake to eventually be linked. a little further down the line, the library is linked using the target_link_libraries directive
taxilian 08:03 James_BB: note that depending on the library type (static or shared) you will either need just the .lib or you may need a .dll as well; in the case of the .dll it'll need to be copied to your output directory for a wix installer creation to work
but otherwise looks like you're on the right track
JuanDaugherty 08:03 is the browser user agent string stored someplace? get "NPAPI" from getBrowser. Know the NPAPI funcs have it but asking about FB.
taxilian 08:03 hmm; I don't think it's stored anywhere, but you can cast your BrowserHostPtr to a NpapiBrowserHostPtr and call ->UserAgent()
JuanDaugherty 08:03 got it, thx
JuanDaugherty 14:03 turned out with Opera all the npfuncs including useragent are trapping and the linked mozdev page list them as a party to the npruntime ;
that is I assume they are
taxilian 14:03 yes, they use npruntime
but they've always just had some weird oddities about their implementation
which is why I don't officially support them
it keeps breaking with no clear reason
JuanDaugherty 15:03 isn't all npapi npruntime now?
because a lot of plugins do work with it
i'd like not to just crash when invoked in it, looking for a workaround to at least say they aren't supported and exit gracefully
(i.e. do work in Opera)
but to do that have to know it's them
taxilian 15:03 yes
its all npruntime
JuanDaugherty 15:03 telling that that (the user agent string) isn't in the framework, kind of a first thing you'd think from 1st principles
how ya gonna know who's on first?
JuanDaugherty 15:03 they've got a separate version that runs out of process like everybody else
JuanDaugherty 15:03 "opera_plugin_wrapper.exe" at least works with debugger
taxilian 16:03 well, in general the goal has been to not need to care which browser you're in
but you're right; that would probably be a good thing to have exposed
you're welcome to submit a pull request
JuanDaugherty 16:03 PRAW
taxilian 16:03 =]
JuanDaugherty 16:03 seems like the right policy would be if it's invoking npruntime and can't answer the useragent string, just consider it defective.
get's into a whole area of exception processing
because that useragent call will trap in the bad guys
taxilian 16:03 opera doesn't respond to NPN_UserAgent?
JuanDaugherty 16:03 no and a matter of fact neither did FF but stopped the activity when I saw no way to get std Opera functional
taxilian 16:03 odd
JuanDaugherty 16:03 I assume they'll get better or get out of the browser biz
may be something wrong with npfunc ptr. BTW why is everthing in the guarded by the main thread assert?
*everything in there
taxilian 16:03 because a really common problem in NPAPI plugins used to be calling NPN_ functions on the wrong thread
so that's a protection; it does nothing in release mode, if memory serves
only debug
JuanDaugherty 16:03 yeah I know
taxilian 16:03 so it's a sanity check
JuanDaugherty 16:03 this (threading policy) is the kind of thing where some expository documentation of your product would be helpful
taxilian 16:03 what specifically?
JuanDaugherty 16:03 you ask "what" after a sentence beginning with "this" identifying the what?
I can read the code, so it's OK
didn't notice till now the thread is a parameter to the npapi plugin constructor
taxilian 17:03 I'm not sure what you mean by "this (threading policy)"
FireBreath has a very simple threading policy: everything related to the browser must be run on the main thread that starts the plugin. The reason for this is simply that that is the policy of all plugins
FireBreath simply provides a few helpers to keep you from shooting yourself in the foot if you don't understand what the browser requires
the only exception to this is that JSObjectPtr will automatically transfer calls across threads as needed
JuanDaugherty 17:03 right that's what I meant, that kind of statement of policy
if you were to guess how many heavily used products including those that have or haven't notified you, what you guess that count would be? Is FB using it?
JuanDaugherty 17:03 "FB" there meant facebook
taxilian 17:03 FaceBook is using it for a few things internally, but the project I was doing for them is gone
there are some other big companies that are using it; vmware and amazon, for sure, but I don't know who else for certain
there are a couple that I know of but am not at liberty to admit to knowing, since the people who told me weren't supposed to tell me =]
JuanDaugherty 18:03 well I told you, but kept it confidential
I was thinking would be nice if there was something like the unit tests which you could run to checkout a specific browser
taxilian 18:03 yeah; FBTestPlugin does that a little bit (run test.html)
JuanDaugherty 18:03 s/specific/given/
taxilian 18:03 I've wanted to create something with selenium, but just haven't had time
of course, as always, PRAW ;-)
JuanDaugherty 18:03 i meant more focused on internals, selenium would be for app level testing wouldn't it?
to asses compatibility with firebreath as in the case of opera
taxilian 18:03 the only way to do that would be through javascript
JuanDaugherty 18:03 why is that?
why only js?
taxilian 18:03 maybe I'm misunderstanding you; do you mean to test the npapi capabilities of a browser or test how a plugin will work with a browser?
JuanDaugherty 18:03 the first
taxilian 18:03 ahh
yeah, sorry, I misunderstood
JuanDaugherty 18:03 np
taxilian 18:03 I've thought about creating a shim plugin that would load another plugin and provide troubleshooting and logging; such a thing could easily report on browser quirks as well
JuanDaugherty 18:03 though for a minute there js had taken over the world
taxilian 18:03 but again, another project I haven't had time for
JuanDaugherty 18:03 *thought
taxilian 18:03 hehe. I think it has, but not quite that far.
JuanDaugherty 18:03 I've seen em come and go taxillian.
stuff peaks and then levels off usually leaving a long tail. E.g. "classic asp".
Ruby peaked about 2-3 years ago.
js is peaking now
it's ubiquity means it's be around a long time
everything gets old though and eventually dies off or becomes some arcane legacy thing like FORTRAN
you'll maybe be able to see if js is still in use 70 years after it's first introduction like FORTRAN
taxilian 18:03 hehe
JuanDaugherty 19:03 the opera thing prolly is threading, was just looking at one of your stack overflow posts "Browser main thread from the NPAPI plugin"
taxilian 19:03 ahh
JuanDaugherty 19:03 so you don't start any threads if not mistaken
meant end plugin threads, not utility threads like timer service
end plugin or plugin mainline of function
JuanDaugherty 21:03 so I'm guessing that "wrong thread" you mention above is actually the browser, which can be expected to have many
taxilian 22:03 JuanDaugherty: the browser will only ever call the plugin on one thread
and that is the only thread that the plugin is allowed to talk to the browser on
JuanDaugherty 22:03 hmm
taxilian 22:03 it's, like, fundamental rule #1 of NPAPI =]
JuanDaugherty 22:03 well I got your assert and I sure as hell didn't fire any threads
taxilian 22:03 which browser?
JuanDaugherty 22:03 but we just talks across each other. You're talking about what the plugin is allowed to do and I meant what the browser does.
by a process of elimination the browser must have entered the plugin from two different threads
taxilian 22:03 well, I could believe that Opera is breaking the rules before I'd believe any of the other browsers would
Opera just can't seem to get things together with npapi plugins
JuanDaugherty 22:03 unless there's something wrong with the logic of the assert, boost thread id, which I discount to (near) zero
taxilian 22:03 Which calls specifically is Opera making?
that seems pretty darn unlikely
given that nobody else has had the issue
though of course not impossible
JuanDaugherty 22:03 it makes a number of calls successfully into my code in the plugin in npapi calls associated with streaming which you don't currently fully deal with. Those go OK.
but once npfuncs it's passed like useragent are invoked there's a crash and running under the debugger showed the assert was tripped
the once it enters the npfunc (useragent), crash
*then once
I just added in the useragent stuff because I was trying to gracefully shutdown on detecting opera
so the newly used useragent call then became the first invoked npfunc
dunno but guess any of them would (crash)
so they have OOPP which runs like everybody else with a container process for the plugin but its actually behind their current common 32 distribution for windows by a substantial amount
12 vs. 12.14 oder
but they both are same as far as this behavior
so a pull request means what? commit rights to github, and of so what path?
*and if so
taxilian 22:03 weird
the easiest way to do a pull request is generally to fork the repo, check out master, create a new branch, make your commits there, and push the whole thing
then from that branch in github create a pull request
JuanDaugherty 22:03 why is it called a pull request when you could just pull anonymously from github ...
taxilian 22:03 when you do a pull request it'll include all commits from where the two branches diverged together
it's a request for me to pull from your branch into the main repo
JuanDaugherty 22:03 well I may have a feature set which I can pass back to deal with the issue opera raises
taxilian 22:03 that would be cool
JuanDaugherty 22:03 presumably a singleton set
the user agent string should be available even if it only has a value like "UNSUPPORTED USER AGENT", "CRASHED_NPAPI" or whatever if the browser host is ready
taxilian 22:03 yeah; I think I was always trying to avoid making browser detection necessary, but there are places where we're doing it behind the scenes as well
not sure why I never plumbed it out
JuanDaugherty 22:03 it's hard not to detect a crash, I think that should be a driver
taxilian 22:03 yeah
well, ideally if FireBreath were going to support Opera it should detect whatever is going on and find a workaround
but I just don't have the time to deal with non-critical issues right now
and despite my continued pleas for help, nobody is stepping up to help maintain; I guess I did my job too well
not enough critcal issues these days to attract help =]
Wayne__ 22:03 I've posted a question on stackoverflow someone could have a look? Thanks,
taxilian 22:03 looking
Wayne__ 22:03 Thanks, waiting for your answer :)
taxilian 22:03 people keep asking about this
so I'm actually writing up an example
it's taking a few minutes
Wayne__: answer written
and after all that work, you better remember to mark it as the correct answer =]
of course, ask for clarification if needed
but many new to stack overflow forget to flag the answer as correct
Wayne__ 22:03 of course, I will... thanks again for your help, I will try your sample code later.