Hi Josip,

In newer versions of SpiderMonkey you can use the object metadata callback.
This allows you to associate extra data (like an ID) with an object when
it's allocated. The JS shell has some testing functions
(setObjectMetadataCallback, getObjectMetadata, setObjectMetadata) in
builtin/TestingFunctions.cpp that show you how you can use them.

The default ShellObjectMetadataCallback stores an ID + stack trace for each
object, you could do something like that and then call
GetObjectMetadata(JSObject*) to get the metadata when you need it.

Jan


On Thu, Aug 21, 2014 at 11:49 AM, Josip Maras <[email protected]> wrote:

> Hi,
>
> I'm trying to use Firefox to do some dynamic analysis with the end goal of
> creating a dependency graph for a particular execution (
> http://marjan.fesb.hr/~jomaras/documents/IdentifyingCodeofIndividualFeaturesinClientsideWebApplications.pdf
> ).
>
> To do this, I would like to assign a unique ID to each object created
> during script execution. I've tried extending JsObject, ObjectImpl with an
> additional ID property, but this always fails - it takes me down a rabbit
> hole filled with compiler errors, assertion fails, and runtime errors (this
> is most likely due to my inexperience with such advanced c++ code).
>
> I would be extremely grateful if someone could provide some points on what
> is an OK way to add a unique ID to each created object. Ideally, this ID
> should be accessible in the main interpreter loop, so that i can establish
> dependencies when an object's property is accessed, when an object is used
> as a function context, etc.
>
> Thank you!
>
> Josip
> _______________________________________________
> dev-tech-js-engine-internals mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
>
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to