On Wed, Apr 29, 2009 at 6:47 PM, Marshall Greenblatt <magreenbl...@gmail.com
> wrote:

> Hi All,
>
> I'm excited about using v8::Extension instead of CppBoundClass but the
> JavaScript side of v8::Extension (via the |source| argument) seems a bit
> magical to me.  Is there a document that explains the usage and capabilities
> of v8::Extension in greater detail?  I have the following questions so far:


Yeah, we need to write a document.  Sorry about that.


>
>
> 1. Can native functions be called directly by a renderer-loaded script, or
> must calls to them always be wrapped within |source|-defined JS
> objects/functions?


You can declare a native function in your JS as follows:

   native function foo();

Then you can just call foo() as though it were javascript.  You'll at least
need that one line of JS to declare it.  I'd recommend wrapping always,
otherwise you're putting it into the global namespace, and you need to more
carefully sanitize your inputs for security problems.

If you look at any of the existing examples, it's pretty straightforward to
copy.



>
> 2. Are there any limits in scope or size to what can be done within a
> |source|-defined script?


RAM? :-)


>
> 3. Is there a way to specify native getter/setter functions for a property
> defined on the JS side?  For instance, "myobject.foo = bar" would somehow
> call a natively defined "setFoo" function with the "bar" argument.  If this
> isn't possible, are there any plans to support native properties directly?


No plans to do that.  Keep in mind that exposing C++ directly to JS should
be done with great care.  Remember you're expanding the surface area of
attack.

Mike




>
>
> Thanks,
> Marshall
>
>
> On Tue, Apr 28, 2009 at 9:39 PM, Mike Belshe <mbel...@google.com> wrote:
>
>> Yup.  I am not saying we need to get rid of all of it immediately; just
>> put some comments in the header so that we don't use it *more*.....
>> Mike
>>
>>
>> On Tue, Apr 28, 2009 at 6:38 PM, Feng Qian <fq...@google.com> wrote:
>>
>>> CppBindingClass was started for test_shell if I remember correctly,
>>> and I think the functionality can be replaced by using NPAPI instead.
>>> I had an implementation of replacing CppBindingClass by NPAPI in
>>> test_shell (to avoid two implementations for JSC and V8), I don't
>>> remember where the code went.
>>>
>>> On Tue, Apr 28, 2009 at 6:15 PM, Mike Belshe <mbel...@google.com> wrote:
>>> > I've felt this way for a while, and I figured I'd throw it out to see
>>> if we
>>> > all agree.
>>> > I'm hoping we can deprecate CppBindingClass.  At this point, most
>>> extensions
>>> > are better served (I think!) via the v8::extension facility than the
>>> > CppBindingObject.  If there are cases where this isn't true, I'd
>>> happily
>>> > work on v8::extension to make it so it could be.
>>> > If nobody objects, I hope we can agree to stop adding any new
>>> > CppBindingClass based bindings, and then over time get rid of
>>> > CppBindingObject altogether.
>>> > Anyone feel strongly in opposition?
>>> >
>>> > Mike
>>> >
>>> > >
>>> >
>>>
>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to