Hi Frolin,
On Wed, Jan 20, 2016 at 12:49 AM, Frolin Ocariza <[email protected]>
wrote:
> Thanks for the response. Actually, I realized that I actually didn't need
> to put that code in Isolate::ReportPendingMessages(), but rather, in
> HandleApiCallHelper(), which is in builtins.cc (just to give you a bit of
> context, what I'm trying to do is basically intercept all calls to DOM API
> methods, and then retrieve certain pieces of information about that call,
> including the Xpath or ID of relevant DOM elements).
>
> I thought the problem was going to go away, but it seems like V8 has some
> built-in mechanism to prevent recursive calls. I tried to bypass this by
> defining a new boolean variable in the v8::Isolate class called
> "inJsbtDomAccess", which is set to true if the code that I added is
> executing, and false otherwise. In other words, I wrapped my code as
> follows (isolate is a v8::Isolate object):
>
> if (!isolate->inJsbtDomAccess) {
> isolate->inJsbtDomAccess = true;
> /*THE CODE I ADDED*/
> isolate->inJsbtDomAccess = false;
> }
>
>
>
> Unfortunately, even with the above workaround, V8 is still detecting the
> recursion it seems, and it always automatically breaks at
> assertV8RecursionScope() in V8PerIsolateData.cpp when debugging. Is there
> any way I can bypass this recursion check? Or perhaps there are other ways
> to access DOM element properties?
>
I'm a little confused on what you're trying to accomplish, so unfortunately
I can't give very specific advice. Generally speaking:
- You can easily bypass any check by commenting it out. But I suspect what
you really want is to avoid the error condition.
- You have placed your code inside of V8, but all of your code uses the V8
API (i.e., include/v8.h, not src/*.h) to call into V8. So from V8's
perspective, it's being called from "outside" while it's not expecting it.
I suspect that's the recursion you're looking at.
- Compiling a script to access the information is convenient, but also
rather heavy-weight, since it uses pretty much all of V8's machinery,
compiler & all. Directly accessing the objects would probably be more
successful.
- If you're inside HandleApiCallHelper: Look at the FunctionCallbackArguments
structure
<https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/builtins.cc&q=HandleApiCallHelper&sq=package:chromium&type=cs&l=3437-3443>,
which contains pointers to all the pieces involved. If it's a DOM call,
args.receiver() should contain a pointer to the Node wrapper. (I.e., to
V8's representation of the DOM node that's being acted upon.)
- The DOM actually lives in Blink, not V8, and V8 only sees wrapper objects
for the various DOM nodes. Depending on what you're trying to do, you'd
probably be better off doing it inside Blink. E.g., DOM accesses from V8
usually end up in this generated code
<https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/bindings/core/v8/V8Node.cpp&sq=package:chromium&dr=CSs>
.
Hope this helps,
Daniel
--
--
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.