It was recently brought to my attention that the void* from an ArrayBuffer
created in JS can be retrieved from a TypedArray using
Object::GetIndexedPropertiesExternalArrayData(). Here's an example:


// JS side
var ui = new Uint8Array(new ArrayBuffer(16));
fillArray(ui);


// C++ side
void FillArray(const FunctionCallbackInfo<Value>& args) {
    Local<Object> o = args[0].As<Object>();
    char* data = 
static_cast<char*>(o->GetIndexedPropertiesExternalArrayData());
    // Now have a pointer to the data
}


Wanted to check if this was intentional or just a side-effect of some 
internal
implementation details. Also whether it is "safe" to use or not.

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to