Changeset 101490 in webkit


Ignore:
Timestamp:
Nov 30, 2011 4:57:12 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[MutationObservers] V8 bindings don't properly wrap all calls into JS
https://bugs.webkit.org/show_bug.cgi?id=72063

Patch by Rafael Weinstein <rafaelw@chromium.org> on 2011-11-30
Reviewed by Adam Barth.

This patch changes cleans up script invocation in V8Proxy. It removes callFunctionWithoutFrame
and changes callers to simply call instrumentedFunctionCall with a null Page. Also, it implements
the non-static callFunction to be implemented in terms of instrumentedFunctionCall.

No new tests.

  • bindings/v8/ScriptFunctionCall.cpp:

(WebCore::ScriptCallback::call):

  • bindings/v8/V8NodeFilterCondition.cpp:

(WebCore::V8NodeFilterCondition::acceptNode):

  • bindings/v8/V8Proxy.cpp:

(WebCore::V8Proxy::callFunction):
(WebCore::V8Proxy::instrumentedCallFunction):

  • bindings/v8/V8Proxy.h:
  • bindings/v8/custom/V8CustomXPathNSResolver.cpp:

(WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r101488 r101490  
     12011-11-30  Rafael Weinstein  <rafaelw@chromium.org>
     2
     3        [MutationObservers] V8 bindings don't properly wrap all calls into JS
     4        https://bugs.webkit.org/show_bug.cgi?id=72063
     5
     6        Reviewed by Adam Barth.
     7
     8        This patch changes cleans up script invocation in V8Proxy. It removes callFunctionWithoutFrame
     9        and changes callers to simply call instrumentedFunctionCall with a null Page. Also, it implements
     10        the non-static callFunction to be implemented in terms of instrumentedFunctionCall.
     11
     12        No new tests.
     13
     14        * bindings/v8/ScriptFunctionCall.cpp:
     15        (WebCore::ScriptCallback::call):
     16        * bindings/v8/V8NodeFilterCondition.cpp:
     17        (WebCore::V8NodeFilterCondition::acceptNode):
     18        * bindings/v8/V8Proxy.cpp:
     19        (WebCore::V8Proxy::callFunction):
     20        (WebCore::V8Proxy::instrumentedCallFunction):
     21        * bindings/v8/V8Proxy.h:
     22        * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
     23        (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
     24
    1252011-11-30  Sheriff Bot  <webkit.review.bot@gmail.com>
    226
  • trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp

    r95901 r101490  
    198198        args[i] = m_arguments[i].v8Value();
    199199
    200     v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(function, object, m_arguments.size(), args.get());
     200    v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* page */, function, object, m_arguments.size(), args.get());
    201201
    202202    if (exceptionCatcher.HasCaught()) {
  • trunk/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp

    r95901 r101490  
    8484    args[0] = toV8(node);
    8585
    86     v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(callback, object, 1, args.get());
     86    v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* page */, callback, object, 1, args.get());
    8787
    8888    if (exceptionCatcher.HasCaught()) {
  • trunk/Source/WebCore/bindings/v8/V8Proxy.cpp

    r101480 r101490  
    431431v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
    432432{
     433    // Keep Frame (and therefore ScriptController and V8Proxy) alive.
     434    RefPtr<Frame> protect(frame());
     435    return V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args);
     436}
     437
     438v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Page* page, v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
     439{
    433440    V8GCController::checkMemoryUsage();
    434441
     
    436443        return handleMaxRecursionDepthExceeded();
    437444
    438     // Keep Frame (and therefore ScriptController and V8Proxy) alive.
    439     RefPtr<Frame> protect(frame());
    440 
    441     v8::Local<v8::Value> result;
    442     {
    443         V8RecursionScope recursionScope;
    444         result = V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args);
    445     }
    446 
    447     didLeaveScriptContext();
    448 
    449     if (v8::V8::IsDead())
    450         handleFatalErrorInV8();
    451 
    452     return result;
    453 }
    454 
    455 v8::Local<v8::Value> V8Proxy::callFunctionWithoutFrame(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
    456 {
    457     V8GCController::checkMemoryUsage();
    458     v8::Local<v8::Value> result = function->Call(receiver, argc, args);
    459 
    460     if (v8::V8::IsDead())
    461         handleFatalErrorInV8();
    462 
    463     return result;
    464 }
    465 
    466 v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Page* page, v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
    467 {
    468445    InspectorInstrumentationCookie cookie;
    469446    if (InspectorInstrumentation::hasFrontends()) {
     
    477454        cookie = InspectorInstrumentation::willCallFunction(page, resourceName, lineNumber);
    478455    }
    479     v8::Local<v8::Value> result = function->Call(receiver, argc, args);
     456
     457    v8::Local<v8::Value> result;
     458    {
     459        V8RecursionScope recursionScope;
     460        result = function->Call(receiver, argc, args);
     461    }
     462
     463    // FIXME: Instrument any work that takes place when script exits to c++ (e.g. Mutation Observers).
     464    didLeaveScriptContext();
     465
    480466    InspectorInstrumentation::didCallFunction(cookie);
     467
     468    if (v8::V8::IsDead())
     469        handleFatalErrorInV8();
     470
    481471    return result;
    482472}
  • trunk/Source/WebCore/bindings/v8/V8Proxy.h

    r101480 r101490  
    165165        v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
    166166
    167         // Call the function with the given receiver and arguments.
    168         static v8::Local<v8::Value> callFunctionWithoutFrame(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
    169 
    170167        // call the function with the given receiver and arguments and report times to DevTools.
    171168        static v8::Local<v8::Value> instrumentedCallFunction(Page*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]);
  • trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp

    r97771 r101490  
    7979    v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() ? v8::Handle<v8::Function>::Cast(m_resolver) : lookupNamespaceURIFunc;
    8080
    81     v8::Handle<v8::Value> retval = V8Proxy::callFunctionWithoutFrame(function, m_resolver, argc, argv);
     81    v8::Handle<v8::Value> retval = V8Proxy::instrumentedCallFunction(0 /* page */, function, m_resolver, argc, argv);
    8282
    8383    // Eat exceptions from namespace resolver and return an empty string. This will most likely cause NAMESPACE_ERR.
Note: See TracChangeset for help on using the changeset viewer.