IRC Log Viewer » #firebreath » 2012-08-23

IRC Nick Time (GMT-7) Message
Guest67780 15:08 I need the plugin ive written to only function on one domain. I've found enum SecurityLevel in the APITypes.cpp and created a custom level. I'm passing this into FB::JSAPIImpl in JSAPIauto.cpp
taxilian 15:08 woah there
Guest67780 15:08 I cant find where to specify the restrictions
taxilian 15:08 you don't ever need to modify JSAPIAuto or JSAPIImpl
Guest67780 15:08 is that wrong ? ha
haha k
taxilian 15:08 or really any firebreath source files
nothing but your project
Guest67780 15:08 good news
taxilian 15:08 you can look at those files for an example of how to set the securitylevel for various APIs
Guest67780 15:08 I saw the SecurityScope_Public being passed in the initialization list
taxilian 15:08 great; so why did you think you needed to change that instead of just using the alternate constructor that allows you to pass your own SecurityZone?
https://github.com/firebreath/FireBreath/blob/master/src/ScriptingCore/JSAPIAuto.h#L112
you're already extending JSAPIAuto; you just need to use the other constructor
and your default securityzone will be magically changed
hurray!
Guest67780 15:08 ok that makes sense
taxilian 15:08 also, the magically thing called SecurityZone is really just an int or some such
Guest67780 15:08 now how do I define the specifics of a security zone?
taxilian 15:08 there are a few predefined constants; SecurityScope_Public is one of them
grep for it and you'll find the others
it's probably in APITypes.h or somewhere similar
Guest67780 15:08 ya just an emun
enum
taxilian 15:08 right
so you can use whatever you want, but those will probably be good enough since most people only use two
https://github.com/firebreath/FireBreath/blob/master/src/ScriptingCore/JSAPIAuto.cpp#L52
there is an example of registering methods and properties inside a particular securityscope
reichi 15:08 hmm
taxilian 15:08 just create a scoped_zonelock with the scope you want it in
reichi 15:08 taxilian: the unsolicited stream patch got lost in 1.7
taxilian 15:08 reichi: I'm not sure it was every actually pulled in
reichi 15:08 including my change to stop the browser from contiously sending in data
taxilian 15:08 I haven't yet fully reviewed
reichi 15:08 (that one got lost in 1.6, too)
taxilian 15:08 reviewed it
reichi 15:08 ah, ok :)
taxilian 15:08 and it's totally your fault for not nagging me more
Guest67780 15:08 ok cool. how do I set what each zone means?
reichi 15:08 than i have probably not even mentioned anything :p
have i?
taxilian: i am in no hurry at all ;)
1.6 is doing exactly what we currently need
without any issues :)
taxilian 15:08 Guest67780: each zone means exactly nothing. the only thing that means anything is whatever zone is currently set on your JSAPI object, you can only access things that are in a zone greater than or equal to your current zone
Guest67780 15:08 ok what is the definition of a zone then?
taxilian 15:08 it's a number
in other words, if you put all your methods in zone 1 and the current zone is 2, nothing will show up
if you have some methods in zone 4 and some in 1, and your current zone is 2, only the ones in zone 4 will show up
Guest67780 15:08 i want all functions to only work on mydomain.com. I dont understand what a zone maps to
taxilian 15:08 the zone maps to nothing
you have to set the zone
so when the plugin starts up, you get the location, decide what you want, and then change which zone is active on the JSAPI object
it is not automatic; you could do it in response to the domain, a password, the ip address of the computer, or even the moon phase (if you feel like calculating that)
Guest67780 15:08 haha
taxilian 15:08 call setDefaultZone to change the active zone
https://github.com/firebreath/FireBreath/blob/master/src/ScriptingCore/JSAPIImpl.h#L200
Guest67780 15:08 how do I query the current domain?
taxilian 15:08 !wiki DOMWindow
FireBreathBot 15:08 0 results found. Note: Results limited to 8
taxilian 15:08 ahh
!wiki DOM Window
Guest67780 15:08 i havent gone far off the tutorials yet!
k
FireBreathBot 15:08 8 results found. Note: Results limited to 8
"class FB DOM Window window": http://tinyurl.com/c2mdmdl
"class FB DOM Window ~Window": http://tinyurl.com/clht3nw
taxilian 15:08 anyway, it's on one of the DOM objects
FireBreathBot 15:08 "class FB DOM Window": http://tinyurl.com/czwxx92
"class FB DOM Window getDocument": http://tinyurl.com/ct96a7w
"class FB DOM Window createMap": http://tinyurl.com/blp9u45
"class FB DOM Window create": http://tinyurl.com/cvkwwll
"class FB DOM Window alert": http://tinyurl.com/ckg5sny
"class FB DOM Window getLocation": http://tinyurl.com/ct23t6o
taxilian 15:08 there it is
m_host->getDOMWindow()->getLocation()
Guest67780 15:08 ah ok, if I dont get the zones working I can always just query that!
ill try to do it right ;)
thanks
taxilian 15:08 feel free to write up some docs for the next poor sap who has to figure it out
that would be very helpful
Guest67780 15:08 ill see what I can do.
thanks again!
taxilian 15:08 I have limited time to work on the system, so I spend it coding and answering questions; in return, I ask that users help with docs
good luck
Guest67780 15:08 fair enough
fishfish 16:08 Hi, need some help with my FB NPAPI injecting JS to to a page
taxilian 16:08 okay
fishfish 16:08 can i get access to the window page even without the plugin being init in the page by the html page?
window object
taxilian 16:08 no
the plugin has to be inserted into the DOM using an object tag
fishfish 16:08 FB::DOM::WindowPtr window = m_host->getDOMWindow();
taxilian 16:08 until that happens you don't exist at all
fishfish 16:08 so till an object tag is created the FB does not have any access to the page.
taxilian 16:08 it's not just a question of having access ot the page
fishfish 16:08 is there a way for the FB to be created for every page?
taxilian 16:08 you could use an extension
read http://npapi.com/extensions
.extensions
FireBreathBot 16:08 Browser plugins vs extensions: Plugins live in an <object> tag and only interact with the DOM.
They don't hook into any special events with the browser, aren't given special web browser info.
They cannot automatically affect a page without being inserted into said page.
Note that FireBreath plugins can often be used as part of an extension.
For more information about the difference between a plugin and extension, see http://npapi.com/extensions
fishfish 16:08 ok so i will first need to inject using the extension to init the FB
understood
BadBreathFish 16:08 thanks for helping with this
fishfish 18:08 hi. another Q, i got the FB compiling on Mac, now i want to include cocoa code
can i add .m files to the Mac folder?
is there some other way to do that?
because under the cmake i see i can only add .cpp files
(btw the video tutorial is really good)
taxilian 19:08 fishfish: in the mac/projectDef.cmake file it looks for .mm files as well, I think
even if it didn't, you could just add it
fishfish 20:08 and how do i call a function in the mm file from the cpp file?
i added the libraries as it details in the documentation
taxilian 21:08 fishfish: you can't call objective C stuff from a cpp file
oh, he's gone
FireBreathBot: tell fishfish you can't call obj c from a .cpp file, but you *can* call c++ from a .mm file and expose c++ functions from that file