diff options
Diffstat (limited to 'WebCore/bindings/v8/V8Proxy.cpp')
-rw-r--r-- | WebCore/bindings/v8/V8Proxy.cpp | 72 |
1 files changed, 19 insertions, 53 deletions
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index be2be07..e7dca4f 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -39,7 +39,7 @@ #include "FrameLoaderClient.h" #include "IDBFactoryBackendInterface.h" #include "IDBPendingTransactionMonitor.h" -#include "InspectorTimelineAgent.h" +#include "InspectorInstrumentation.h" #include "Page.h" #include "PageGroup.h" #include "PlatformBridge.h" @@ -77,7 +77,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/UnusedParam.h> -#include <wtf/text/CString.h> +#include <wtf/text/StringConcatenate.h> #ifdef ANDROID_INSTRUMENT #include "TimeCounter.h" @@ -199,11 +199,8 @@ void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay) // FIXME: This error message should contain more specifics of why the same // origin check has failed. - String str = String::format("Unsafe JavaScript attempt to access frame " - "with URL %s from frame with URL %s. " - "Domains, protocols and ports must match.\n", - targetDocument->url().string().utf8().data(), - sourceDocument->url().string().utf8().data()); + String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(), + " from frame with URL ", sourceDocument->url().string(), ". Domains, protocols and ports must match.\n"); // Build a console message with fake source ID and line number. const String kSourceID = ""; @@ -394,10 +391,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod V8GCController::checkMemoryUsage(); -#if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) - timelineAgent->willEvaluateScript(source.url().isNull() ? String() : source.url().string(), source.startLine()); -#endif + InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine()); v8::Local<v8::Value> result; { @@ -432,10 +426,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod PlatformBridge::traceEventEnd("v8.run", node, ""); #endif -#if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) - timelineAgent->didEvaluateScript(); -#endif + InspectorInstrumentation::didEvaluateScript(cookie); return result; } @@ -536,33 +527,23 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8 // execution finishs before firing the timer. m_frame->keepAlive(); -#if ENABLE(INSPECTOR) - Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0; - if (inspectedPage) { - if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) { - v8::ScriptOrigin origin = function->GetScriptOrigin(); - String resourceName("undefined"); - int lineNumber = 1; - if (!origin.ResourceName().IsEmpty()) { - resourceName = toWebCoreString(origin.ResourceName()); - lineNumber = function->GetScriptLineNumber() + 1; - } - timelineAgent->willCallFunction(resourceName, lineNumber); - } else - inspectedPage = 0; + InspectorInstrumentationCookie cookie; + if (InspectorInstrumentation::hasFrontends()) { + v8::ScriptOrigin origin = function->GetScriptOrigin(); + String resourceName("undefined"); + int lineNumber = 1; + if (!origin.ResourceName().IsEmpty()) { + resourceName = toWebCoreString(origin.ResourceName()); + lineNumber = function->GetScriptLineNumber() + 1; + } + cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber); } -#endif // !ENABLE(INSPECTOR) m_recursion++; result = function->Call(receiver, argc, args); m_recursion--; -#if ENABLE(INSPECTOR) - if (inspectedPage) - if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) - timelineAgent->didCallFunction(); -#endif // !ENABLE(INSPECTOR) - + InspectorInstrumentation::didCallFunction(cookie); } // Release the storage mutex if applicable. @@ -862,32 +843,17 @@ void V8Proxy::registerExtensionWithV8(v8::Extension* extension) bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension) { for (size_t i = 0; i < m_extensions.size(); ++i) { - if (m_extensions[i].extension == extension) + if (m_extensions[i] == extension) return true; } return false; } -void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction) -{ - registerExtensionWithV8(extension); - V8ExtensionInfo info = {schemeRestriction, 0, extension, false}; - m_extensions.append(info); -} - -void V8Proxy::registerExtension(v8::Extension* extension, int extensionGroup) -{ - registerExtensionWithV8(extension); - V8ExtensionInfo info = {String(), extensionGroup, extension, false}; - m_extensions.append(info); -} - void V8Proxy::registerExtension(v8::Extension* extension) { registerExtensionWithV8(extension); - V8ExtensionInfo info = {String(), 0, extension, true}; - m_extensions.append(info); + m_extensions.append(extension); } bool V8Proxy::setContextDebugId(int debugId) |