Diff
Modified: trunk/Source/WebCore/ChangeLog (126004 => 126005)
--- trunk/Source/WebCore/ChangeLog 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebCore/ChangeLog 2012-08-20 07:53:33 UTC (rev 126005)
@@ -1,3 +1,27 @@
+2012-08-19 Kentaro Hara <[email protected]>
+
+ [V8] Move contextDebugId() and setContextDebugId() from V8Proxy to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=94446
+
+ Reviewed by Adam Barth.
+
+ To kill V8Proxy, we can move contextDebugId() and setContextDebugId()
+ from V8Proxy to ScriptController.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::setContextDebugId):
+ (WebCore):
+ (WebCore::ScriptController::contextDebugId):
+ * bindings/v8/ScriptController.h:
+ (ScriptController):
+ * bindings/v8/V8IsolatedContext.cpp:
+ (WebCore::V8IsolatedContext::V8IsolatedContext):
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+ (V8Proxy):
+
2012-08-20 Kentaro Hara <[email protected]>
[V8] Move V8Proxy::newInstance() to V8ObjectConstructor
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (126004 => 126005)
--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2012-08-20 07:53:33 UTC (rev 126005)
@@ -65,6 +65,7 @@
#include "V8RecursionScope.h"
#include "Widget.h"
#include <wtf/StdLibExtras.h>
+#include <wtf/StringExtras.h>
#include <wtf/text/CString.h>
namespace WebCore {
@@ -532,6 +533,38 @@
}
#endif
+bool ScriptController::setContextDebugId(int debugId)
+{
+ ASSERT(debugId > 0);
+ v8::HandleScope scope;
+ v8::Handle<v8::Context> context = windowShell()->context();
+ if (context.IsEmpty())
+ return false;
+ if (!context->GetData()->IsUndefined())
+ return false;
+
+ v8::Context::Scope contextScope(context);
+
+ char buffer[32];
+ snprintf(buffer, sizeof(buffer), "page,%d", debugId);
+ buffer[31] = 0;
+ context->SetData(v8::String::New(buffer));
+
+ return true;
+}
+
+int ScriptController::contextDebugId(v8::Handle<v8::Context> context)
+{
+ v8::HandleScope scope;
+ if (!context->GetData()->IsString())
+ return -1;
+ v8::String::AsciiValue ascii(context->GetData());
+ char* comma = strnstr(*ascii, ",", ascii.length());
+ if (!comma)
+ return -1;
+ return atoi(comma + 1);
+}
+
void ScriptController::attachDebugger(void*)
{
notImplemented();
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (126004 => 126005)
--- trunk/Source/WebCore/bindings/v8/ScriptController.h 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h 2012-08-20 07:53:33 UTC (rev 126005)
@@ -196,6 +196,9 @@
static void registerExtensionIfNeeded(v8::Extension*);
static V8Extensions& registeredExtensions();
+ bool setContextDebugId(int);
+ static int contextDebugId(v8::Handle<v8::Context>);
+
private:
Frame* m_frame;
const String* m_sourceURL;
Modified: trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp (126004 => 126005)
--- trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp 2012-08-20 07:53:33 UTC (rev 126005)
@@ -82,8 +82,7 @@
// Run code in the new context.
v8::Context::Scope contextScope(m_context->get());
- // Setup context id for JS debugger.
- setInjectedScriptContextDebugId(m_context->get(), proxy->contextDebugId(mainWorldContext));
+ setInjectedScriptContextDebugId(m_context->get(), ScriptController::contextDebugId(mainWorldContext));
getGlobalObject(m_context->get())->SetPointerInInternalField(V8DOMWindow::enteredIsolatedWorldIndex, this);
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (126004 => 126005)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-08-20 07:53:33 UTC (rev 126005)
@@ -434,37 +434,6 @@
return frame->script()->proxy()->mainWorldContext();
}
-bool V8Proxy::setContextDebugId(int debugId)
-{
- ASSERT(debugId > 0);
- v8::HandleScope scope;
- v8::Handle<v8::Context> context = windowShell()->context();
- if (context.IsEmpty())
- return false;
- if (!context->GetData()->IsUndefined())
- return false;
-
- v8::Context::Scope contextScope(context);
-
- char buffer[32];
- snprintf(buffer, sizeof(buffer), "page,%d", debugId);
- context->SetData(v8::String::New(buffer));
-
- return true;
-}
-
-int V8Proxy::contextDebugId(v8::Handle<v8::Context> context)
-{
- v8::HandleScope scope;
- if (!context->GetData()->IsString())
- return -1;
- v8::String::AsciiValue ascii(context->GetData());
- char* comma = strnstr(*ascii, ",", ascii.length());
- if (!comma)
- return -1;
- return atoi(comma + 1);
-}
-
v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldContextHandle& worldContext)
{
if (context->isDocument()) {
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (126004 => 126005)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.h 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h 2012-08-20 07:53:33 UTC (rev 126005)
@@ -136,9 +136,6 @@
// will be moved to ScriptController.
V8DOMWindowShell* windowShell() const;
- bool setContextDebugId(int id);
- static int contextDebugId(v8::Handle<v8::Context>);
-
static void reportUnsafeAccessTo(Document* targetDocument);
// FIXME: Move m_isolatedWorlds to ScriptController and remove this getter.
Modified: trunk/Source/WebKit/chromium/ChangeLog (126004 => 126005)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-20 07:53:33 UTC (rev 126005)
@@ -1,3 +1,18 @@
+2012-08-19 Kentaro Hara <[email protected]>
+
+ [V8] Move contextDebugId() and setContextDebugId() from V8Proxy to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=94446
+
+ Reviewed by Adam Barth.
+
+ To kill V8Proxy, we can move contextDebugId() and setContextDebugId()
+ from V8Proxy to ScriptController.
+
+ No tests. No change in behavior.
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::didCreateScriptContext):
+
2012-08-20 Kentaro Hara <[email protected]>
[V8] Move V8Proxy::m_extensions to ScriptController
Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (126004 => 126005)
--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2012-08-20 07:47:27 UTC (rev 126004)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2012-08-20 07:53:33 UTC (rev 126005)
@@ -424,7 +424,7 @@
if (worldId)
return;
if (WebCore::Frame* frame = webframe->frame())
- frame->script()->proxy()->setContextDebugId(m_hostId);
+ frame->script()->setContextDebugId(m_hostId);
}
void WebDevToolsAgentImpl::mainFrameViewCreated(WebFrameImpl* webFrame)