pacificIT / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

Handling all Set/Get operation of object using CefV8Accessor #599

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
CEF should allow to have generic CefV8Accessor for an object.
I want to handle all Get/Set operation of an object (CefV8Value) using 
CefV8Accessor. I have a code like below. In this, whenever I access 
'myObject.myProperty', my MyAccessor's Set/Get is getting called.

Issue is, We can't make MyAccessor as default Accessor for all the properties 
of an object.

Example: In Java Script, if I set/get any property value in 'myObject' (like 
'myObject.yourProperty = "abc"' ), the call should come to my MyAccessor object.

class MyAccessor : public CefV8Accessor
{
....
};

// Create Accessor
CefRefPtr<CefV8Accessor> myAccessorObj = new MyAccessor();

// Create the new V8 object.
CefRefPtr<CefV8Value> dwObjectPtr = CefV8Value::CreateObject(NULL, 
myAccessorObj );

// Adding myObject in the global scope.
globalObj->SetValue("myObject", dwObjectPtr, V8_PROPERTY_ATTRIBUTE_NONE);

// Register an identifier whose access will be forwarded to the CefV8Accessor
dwObjectPtr->SetValue("myProperty", V8_ACCESS_CONTROL_DEFAULT, 
V8_PROPERTY_ATTRIBUTE_NONE);

Original issue reported on code.google.com by tumapa...@gmail.com on 17 May 2012 at 5:04

GoogleCodeExporter commented 9 years ago
Adding this sort of dynamic handling of Get/Set methods will make it much 
easier to customize the types of objects that can be injected into scripting 
namespace.
My team had to cope with absence of this feature when adding COM object support 
into CEF adaptation.
This feature would rock!

Original comment by karen.ga...@gmail.com on 19 May 2012 at 1:57

GoogleCodeExporter commented 9 years ago
+1. It is stupid that you are required to register all the properties.

Original comment by thomas...@gmail.com on 20 Nov 2012 at 6:09

GoogleCodeExporter commented 9 years ago
Generic CEFV8Accessor is absolutely needed.
Its not feasible to register each property

Original comment by megha...@gmail.com on 25 Sep 2013 at 12:48

GoogleCodeExporter commented 9 years ago
This functionality can be implemented currently in JavaScript using harmony 
proxies: http://wiki.ecmascript.org/doku.php?id=harmony:proxies

Original comment by magreenb...@gmail.com on 25 Sep 2013 at 12:53

GoogleCodeExporter commented 9 years ago
Is there a way to achieve the same thing in managed code since the properties 
are registered in REnderProcessHandler

Original comment by megha...@gmail.com on 25 Sep 2013 at 5:57

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 10 Jan 2014 at 6:56