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

IRC Nick Time (GMT-7) Message
Anton__ 00:07 Hey guys. Is it possible to expose to JS an existing static method? smth like this: registerMethod("getAppDataPath", make_method(this, &FB::System::getAppDataPath)); What should I pass to make_method instead of this?
reichi 00:07 probably &FB::System
but it's just a guess
dougma 01:07 i think make_method always wants a this ptr, so just call the static method from a non-static method.
you could write your own make_static, using the implementation of make_method in MethodConverter.h as a starting point. :)
Anton__ 02:07 too complicated for me :) I already came to wrapping method solution. Thx!
Anton__ 02:07 Ok. Another problem:
std::string path = FB::System::getAppDataPath(appName);
boost::filesystem::create_directory(path);
filesystem::create_directory fails if windows user name contains non-ASCII chars
It's common problem, because for example Russian Windows XP default user named 'Администратор'. I think it's similar for any non English WinXP version.
Anton__ 02:07 Ok. Fixed by boost::filesystem::create_directory(FB::utf8_to_wstring(path));
taxilian 06:07 Anton__ yep, that's the correct fix. one thing to note, though... it's a *really* bad idea to expose actual filesystem paths to the web page
security risk
Anton__ 08:07 taxilian, thanks for the warning. The plugin will be part of Chrome extension whith public=false, which make plugin available only to the extension.
taxilian 08:07 still be careful =]
Anton__ 08:07 i will :)
btw, I found that if I declare JSAPI function parameter as std::wstring, then conversion from UTF-8 to wide string is done automatically. Is it correct to do so?
taxilian 08:07 yes
Anton__ 08:07 thx
cologneGuy 11:07 @taxilian: no success when bulding with VS 2012 Express. ATL includes seem to collide with windows.h etc (re-definition of vars, names etc.) => a nightmare. Then switched to VS 2012 Ultimate - absolutely no problem to generate the build and build the plugin. worked perfectly. great software, thanks!
taxilian 11:07 hmm. well, hopefully someone will figure out how to make it work with vs2012 express :-/
cologneGuy 11:07 I'm sure there is a way - for experts in compiler directives (I'm not the man here...)
Now the real programming starts - I have to put some C code into the plugin - any hints, do's and don'ts on this way (no global variables ...)? Or first port it to C++ before wrapping it into a plugin?
Shibs 15:07 Just out of curiosity, is there any plug-in or extension or some other thing that a web page can run that does not need the users permission? I'm trying to make this as easy and painless as possible for users
taxilian 15:07 I'm not sure I follow the question
plugins may or may not need the user's permission; it depends on the browser
but they have to be installed
same for extensions
if you want something that the user need not be aware of at all that runs native code, I believe they call that a "virus"
Shibs 15:07 That's what I was thinking, I just wanted to make sure I covered all of the web technologies.
I was thinking more along the lines of "a web site does not need a users permission to display text, by navigating to the site, they are agreeing to w/e interaction".
But yeah.. in the end it's just a security issue that needs a minimum requirement of a user selecting "ok".
And that's due to the fact that the browser is sandboxed, therefore the web page can show whatever as long as it's within the browser. Once something accesses outside of the browser, user permission must be granted, correct?
taxilian 15:07 pretty much
Shibs 15:07 Fair enough
Shibs 15:07 So if I'm calling a function from an included library from firebreath, do I need to prepend it with anything? I know that firebreath prepends its functions with pluginname:: but I'm unsure of external functions.
taxilian 15:07 errr
firebreath doesn't prepend anything
those are just c++ classes
Shibs 15:07 Got it, was wondering why they were (I don't use C++, only familiar with C)
taxilian 15:07 in the register_method classes that's just how you reference the function inside a class so that you can get the function pointer
all you're doing is passing in a function pointer