<timeless> weirdal: you'll get to learn all about jsrooting
* WeirdAl cries
<timeless> have a rootcanal first, then try it
<timeless> but seriously, it shouldn't be /too/ hard
-->| sicking_ (chatzilla@moz-C9AA1F4F.hsd1.ca.comcast.net) has joined #developers
<timeless> you can try using jsd_xpc as an example
<timeless> basically you'll need your own js context, and an xpcom interface for regexps
<timeless> then you basically start a request, setup a root, create the regexp, make sure it succeeded, don't lose your root, finish your request
=-= smontaguAway is now known as smontagu
<timeless> when someone wants to use your regexp, you start a request, setup a root, create a script, make sure it succeeded, call your script, make sure not to lose your result, spend a lot of effort proxying the result, end your request, return your proxy
<timeless> probably want to eventually discard your root on the script, preferably before you end your request
<timeless> note that before you start a request, you need to create a jscontext
-->| bent (chatzilla-@D140E19A.77FDD0CA.17689BFA.IP) has joined #developers
<timeless> and when your xpcom object dies, preferably before js dies, you want to destroy your context (preferably dropping your root to the regexp first)
<timeless> that's about it
<WeirdAl> rootcanal sounds like it describes the problem pretty well
<timeless> simple, and it shouldn't need more than 2000 lines
* timeless shrugs
<WeirdAl> I'm going to save that text - it'll come in handy for me later
=-= dria-afk is now known as dria
<biesi> wouldn't it be nicer if JS exposed a C API for this>?
<WeirdAl> biesi: that's what I thought they did, via JS_NewRegExpObject
<WeirdAl> that's why I asked about it
<shaver> it'd be hard to expose a C API for it
<shaver> but it's been requested
<biesi> WeirdAl, that probably just creates a JSObject
<timeless> a c api wouldn't really help most xpcom consumers
<shaver> (you need a context to run it on, objects initialized, etc.)
<mvl> i think i saw a patch, using JS regexes from a c++ component
<mvl> long time ago
<biesi> timeless, well an xpcom component would wrap that C api
|<-- IRCMonkey3047300 has left moznet (Quit: IRCMonkey3047300)
<mvl> trying to add regex blocking to the image blocker
<timeless> biesi: what i described does that
<biesi> shaver, hm, ok
<WeirdAl> mvl: I found this via Google: http://www.cps.msu.edu/~dunham/hacks/mozilla-1.2.patch
<shaver> and replaces can run JS functions
<shaver> e.t.c.
<biesi> maybe easier to make a JS component that implements regexes
<biesi> although
<doron> for schema validation, I just wrote a js xpcom component
<biesi> ideally it would have a new context per regex
<biesi> to avoid side-effects from previous ones affecting new ones
<timeless> the constructor would have to be magical
<WeirdAl> biesi: evalInSandbox, create a new sandbox each time?
<timeless> it's possible for a factory to do the right thing
<timeless> but definitely non trivial
<biesi> WeirdAl, oh, that would probably work, yeah
-->| bsmedberg (chatzilla@moz-65155D2C.fa1-0-2.occ.iinet.com) has joined #developers
-->| analogAI (analogAI@moz-360B2CB2.san.res.rr.com) has joined #developers
<WeirdAl> or just delete the values
<biesi> WeirdAl, <shaver> and replaces can run JS functions
* timeless sighs
<biesi> sounds like regexes can therefore do anything
<timeless> biesi: yep
<shaver> replaces can
<shaver> regexes aren't replaces in JS
* Hannibal finally has a use for a JS 1.7 feature, but now has to think of how to design his code so it doesn't need that.
<biesi> oh yeah
<shaver> replace is an operation that takes a regex as an operand
<shaver> Hannibal: why?
* biesi is too tired to pay attention :/
<timeless> hannibal: you want to crash?
<shaver> timeless really needs more work to do
<Hannibal> because Firebug right now needs to work on Fx 1.5 as well?
<shaver> I suppose so...
<Hannibal> and that doesn't have js 1.7
<shaver> does this feature need to work with 1.5? :)
<shaver> anyway
<timeless> mvl: that patch isn't very safe
<shaver> I'm getting in your way
<timeless> for starters, it doesn't do any rooting
<shaver> which is not _technically_ the job of the mentor
<Hannibal> that's ok.
<mvl> timeless: i never really looked at the patch
<Hannibal> heh.
<WeirdAl> so timeless, shaver: an XPCOM API would be preferable over calling into a JS-based component, yes?
<timeless> weirdal: um
<biesi> ?
<timeless> i so didn't say that
<biesi> aren't those two the same?
<timeless> an xpcom api doesn't specify what language implements it
<shaver> XPCOM is how you would call into a JS-based component
<timeless> or how many impls there are
<WeirdAl> ok, so what I said made no sense
<timeless> i just happened to describe how you'd do it from c++
<timeless> i don't know how to do it from js
<timeless> because i don't speak sandbox
<timeless> i've tried a couple of times and never gotten it right
<biesi> well, the sandbox api seems to change every other week too :)
<WeirdAl> in that case, let me rephrase: because I'm doing this from content code, do I want to write the component in JS or in C++?
<timeless> it didn't help that when i tried to
<timeless> weirdal: you don't want to try to use the c apis
<timeless> rooting is hard, even for the spidermonkey devs
-->| Peter6 (Peter6@2521AAD9.3852C170.3D5584FB.IP) has joined #developers
<timeless> it didn't help that when i tried to ... use sandboxes, what i wanted to do wasn't even possible :)
<timeless> i think it might be now,..
<WeirdAl> well, I know how to use sandboxes
<timeless> so the only problem you have left is the xpcom api
<timeless> if you're lucky, dmose and co left one in a bug
=-= sheppy is now known as sheppy-afk
<WeirdAl> so now I need to search for said bug
<WeirdAl> okay, thanks :)