IRC Log Viewer » #firebreath » 2011-12-05

IRC Nick Time (GMT-7) Message
shaheenbanu 03:12 hi
taxilian 08:12 good morning
linearray 08:12 hi
linearray 09:12 Is there any way at all I can prevent someone from running my plugin in two tabs at the same time?
taxilian 09:12 global variable, don't do anything if another tab is already running
linearray 09:12 isn't this a problem with refreshes?
taxilian 09:12 can be, yes
linearray 09:12 I could use a lock of sorts
wait until the lock can be acquired
taxilian 09:12 I'd do it in createJSAPI rather than in the constructor
linearray 09:12 I'll probably do that... currently I have an elaborate locking scheme on process-level that uses a different RootJSAPI if the plugin is already open in a different browser
taxilian 09:12 JSAPIProxy may be helpful for that as well
allows you to change which JSAPI object is exposed on the fly
and/or simply reset to an empty JSAPI
linearray 09:12 yes. this seems to be useful
"when in doubt, add another layer of indirection"
taxilian 09:12 then of course there are also SecurityZones; if you set the securityzone to −1 it will effectively prevent anything from being called
linearray 15:12 is there an example somewhere on how to use it?
taxilian 15:12 use which?
JSAPIProxy?
linearray 15:12 SecurityZones
taxilian 15:12 oh, those
of course not :-P
not fully, anyway
but it's not hard
look at JSAPIAuto for an example of how to define methods or properties in a given zone
then you just setDefaultZone to the zone you want
it will only give you access to the zone you are on and greater
linearray 15:12 ah, I see
taxilian 15:12 sorry, less
so if you set the zone to 10 you have access to things defined at 6, 3, 2, etc
but if you set the zone to −1 and everything is defined > 0 you have access to nothing
linearray 15:12 ok, so I can ignore the whole push/pop/lock thing
taxilian 15:12 NO
but you can use the smart push/pop/locker
so that it isn't dangerous =]
!findfile JSAPIAuto.cpp
FireBreathBot 15:12 Found 1 matching file(s) in the master branch. First 1 are:
src/ScriptingCore/JSAPIAuto.cpp http://goo.gl/tIOol
linearray 15:12 got it. this is pretty sophisticated
taxilian 15:12 well, I was trying to keep it simple
but you know how that goes
linearray 17:12 when refreshing the page, is there any guarantee what the browser calls before he starts a new plugin instance
or can he just keep around the previous plugin+api for as long as he wants
taxilian 17:12 no guarantee, but I've never seen the old one still be around by the time that the new one's pluginready was called
still, doesn't mean it's impossible, just very rare
linearray 17:12 I'm thinking about a timed_mutex. If the old API is still around, when the new one is about to be created, I do a timed_lock for three seconds. If it's still around, I expect it to stay around, which means the user opened the plugin in a new tab as opposed to refresh the page.
taxilian 17:12 fair enough; keep in mind, though, that if you do that on the main thread you'll lock up the browser for those three seconds
so it'd need to be a timed_mutex on a new thread
linearray 17:12 yeah, it's a hack... Alternatively I set a shutdown_in_progress flag in DetachedEvent. If it's set I wait in createJSAPI() until the old api is gone.
which is also a hack I guess, but maybe less so
taxilian 17:12 actually, if you release your mutex in DetachedEvent and grab it in AttachedEvent you should be pretty reliable
5EXAAKPA8 18:12 Hi, a question I have asked at chromium-extension, but get no answer there, so wish I have luck here.
As in a NPAPI plugin, I wish to open a local file packed in chromium-extension. And the plugin is the extension's private plugin (actually , this does matter)
how can I map a chrome-extension://id/filename into local filesystem's path?
Or any way I can do to read the contents?
linearray 18:12 map?
5EXAAKPA8 18:12 linearray: say, to map the url into local filepath
linearray 18:12 i have no idea how extension urls work
5EXAAKPA8 18:12 from chrome-extension://myextension/myconfigfile to /mydir/.../myconfigfile, so that a fopen can open it
linearray 18:12 ah, so you need to know the basedir for your extension
5EXAAKPA8 18:12 right
At present, I do eval js code to run through AJAX xhttprequest etc to do it in js space and fetch the result back with getProperty, that's pretty tricky, and can not really fullfill my requirement
linearray 18:12 no idea, sorry
you can store the files in the source and write them to a temp dir on startup
5EXAAKPA8 18:12 :) that's not my usage, the file is come with the extension package
taxilian 18:12 do you know where the file is relative to where the plugin dll is?
5EXAAKPA8 there was a recent question on stackoverflow about this
5EXAAKPA8 18:12 I know, there is a way to know where the plugin dll is located?
taxilian 18:12 they loaded the file using XmlHttpRequest, but if you know where the .dll is relative to the file you need, you can get the path and filename of the dll
yes
!wiki tips
FireBreathBot 18:12 8 results found. Note: Results limited to 8
"Tips and Tricks": http://goo.gl/sOA8M
"Building FireBreath Plugins": http://goo.gl/3bTjS
"Using FireBreath": http://goo.gl/IHwid
taxilian 18:12 it's on the tips and tricks page
FireBreathBot 18:12 "Building on Windows": http://goo.gl/VYTcE
"FireBreath Home": http://goo.gl/zCdgZ
"Getting Started": http://goo.gl/MiOKQ
"Building on Linux": http://goo.gl/DBFGn
"Building on Mac OS X": http://goo.gl/iQ1mh
5EXAAKPA8 18:12 taxilian: great, the m_filesystemPath works for me well. Thx.
taxilian 18:12 yw
amazing what you can find on the website, huh? =]