Diff
Modified: trunk/Source/WebCore/ChangeLog (101489 => 101490)
--- trunk/Source/WebCore/ChangeLog 2011-11-30 12:52:30 UTC (rev 101489)
+++ trunk/Source/WebCore/ChangeLog 2011-11-30 12:57:12 UTC (rev 101490)
@@ -1,3 +1,27 @@
+2011-11-30 Rafael Weinstein <[email protected]>
+
+ [MutationObservers] V8 bindings don't properly wrap all calls into JS
+ https://bugs.webkit.org/show_bug.cgi?id=72063
+
+ 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):
+
2011-11-30 Sheriff Bot <[email protected]>
Unreviewed, rolling out r101440 and r101442.
Modified: trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp (101489 => 101490)
--- trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp 2011-11-30 12:52:30 UTC (rev 101489)
+++ trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp 2011-11-30 12:57:12 UTC (rev 101490)
@@ -197,7 +197,7 @@
for (size_t i = 0; i < m_arguments.size(); ++i)
args[i] = m_arguments[i].v8Value();
- v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(function, object, m_arguments.size(), args.get());
+ v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* page */, function, object, m_arguments.size(), args.get());
if (exceptionCatcher.HasCaught()) {
hadException = true;
Modified: trunk/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp (101489 => 101490)
--- trunk/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp 2011-11-30 12:52:30 UTC (rev 101489)
+++ trunk/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp 2011-11-30 12:57:12 UTC (rev 101490)
@@ -83,7 +83,7 @@
OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[1]);
args[0] = toV8(node);
- v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(callback, object, 1, args.get());
+ v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* page */, callback, object, 1, args.get());
if (exceptionCatcher.HasCaught()) {
state->setException(exceptionCatcher.Exception());
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (101489 => 101490)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2011-11-30 12:52:30 UTC (rev 101489)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2011-11-30 12:57:12 UTC (rev 101490)
@@ -430,41 +430,18 @@
v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
- V8GCController::checkMemoryUsage();
-
- if (recursionLevel() >= kMaxRecursionDepth)
- return handleMaxRecursionDepthExceeded();
-
// Keep Frame (and therefore ScriptController and V8Proxy) alive.
RefPtr<Frame> protect(frame());
-
- v8::Local<v8::Value> result;
- {
- V8RecursionScope recursionScope;
- result = V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args);
- }
-
- didLeaveScriptContext();
-
- if (v8::V8::IsDead())
- handleFatalErrorInV8();
-
- return result;
+ return V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args);
}
-v8::Local<v8::Value> V8Proxy::callFunctionWithoutFrame(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
+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[])
{
V8GCController::checkMemoryUsage();
- v8::Local<v8::Value> result = function->Call(receiver, argc, args);
- if (v8::V8::IsDead())
- handleFatalErrorInV8();
+ if (recursionLevel() >= kMaxRecursionDepth)
+ return handleMaxRecursionDepthExceeded();
- return result;
-}
-
-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[])
-{
InspectorInstrumentationCookie cookie;
if (InspectorInstrumentation::hasFrontends()) {
String resourceName("undefined");
@@ -476,8 +453,21 @@
}
cookie = InspectorInstrumentation::willCallFunction(page, resourceName, lineNumber);
}
- v8::Local<v8::Value> result = function->Call(receiver, argc, args);
+
+ v8::Local<v8::Value> result;
+ {
+ V8RecursionScope recursionScope;
+ result = function->Call(receiver, argc, args);
+ }
+
+ // FIXME: Instrument any work that takes place when script exits to c++ (e.g. Mutation Observers).
+ didLeaveScriptContext();
+
InspectorInstrumentation::didCallFunction(cookie);
+
+ if (v8::V8::IsDead())
+ handleFatalErrorInV8();
+
return result;
}
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (101489 => 101490)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.h 2011-11-30 12:52:30 UTC (rev 101489)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h 2011-11-30 12:57:12 UTC (rev 101490)
@@ -164,9 +164,6 @@
// Call the function with the given receiver and arguments.
v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
- // Call the function with the given receiver and arguments.
- static v8::Local<v8::Value> callFunctionWithoutFrame(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
-
// call the function with the given receiver and arguments and report times to DevTools.
static v8::Local<v8::Value> instrumentedCallFunction(Page*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]);
Modified: trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp (101489 => 101490)
--- trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp 2011-11-30 12:52:30 UTC (rev 101489)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp 2011-11-30 12:57:12 UTC (rev 101490)
@@ -78,7 +78,7 @@
v8::Handle<v8::Value> argv[argc] = { v8String(prefix) };
v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() ? v8::Handle<v8::Function>::Cast(m_resolver) : lookupNamespaceURIFunc;
- v8::Handle<v8::Value> retval = V8Proxy::callFunctionWithoutFrame(function, m_resolver, argc, argv);
+ v8::Handle<v8::Value> retval = V8Proxy::instrumentedCallFunction(0 /* page */, function, m_resolver, argc, argv);
// Eat exceptions from namespace resolver and return an empty string. This will most likely cause NAMESPACE_ERR.
if (try_catch.HasCaught())