Commit 46849f81 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org
Browse files

Source/WebCore: Web Inspector: [Chromium] Module's require injects scripts...

Source/WebCore: Web Inspector: [Chromium] Module's require injects scripts before the debug id is set to the context.
https://bugs.webkit.org/show_bug.cgi?id=84166

Re-applying r114497.

* bindings/v8/V8IsolatedContext.cpp:
(WebCore::setInjectedScriptContextDebugId):
(WebCore):
(WebCore::V8IsolatedContext::V8IsolatedContext):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::evaluateInIsolatedWorld):
* bindings/v8/V8Proxy.h:
(V8Proxy):

LayoutTests: Unreviewed, rolling out r114506.
http://trac.webkit.org/changeset/114506
https://bugs.webkit.org/show_bug.cgi?id=84254

Seems to be making gtk's DumpRenderTree crash occasionally
(Requested by tomz on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-04-18

* platform/gtk/test_expectations.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 209a76a2
2012-04-18 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r114506.
http://trac.webkit.org/changeset/114506
https://bugs.webkit.org/show_bug.cgi?id=84254
Seems to be making gtk's DumpRenderTree crash occasionally
(Requested by tomz on #webkit).
* platform/gtk/test_expectations.txt:
2012-04-18 Adrienne Walker <enne@google.com>
 
[chromium] Unreviewed, rebaseline compositing tests after r114283.
2012-04-18 Pavel Feldman <pfeldman@chromium.org>
Web Inspector: [Chromium] Module's require injects scripts before the debug id is set to the context.
https://bugs.webkit.org/show_bug.cgi?id=84166
Re-applying r114497.
* bindings/v8/V8IsolatedContext.cpp:
(WebCore::setInjectedScriptContextDebugId):
(WebCore):
(WebCore::V8IsolatedContext::V8IsolatedContext):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::evaluateInIsolatedWorld):
* bindings/v8/V8Proxy.h:
(V8Proxy):
2012-04-18 Pavel Feldman <pfeldman@chromium.org>
Web Inspector: extract script navigator overlay logic into the scripts navigator controller.
https://bugs.webkit.org/show_bug.cgi?id=84244
Reviewed by Vsevolod Vlasov.
Overlay logic is well separable from the scripts panel and does not belong there.
Extracting it into a separate class.
* inspector/front-end/ScriptsNavigator.js:
(WebInspector.ScriptsNavigatorController.prototype.wasShown):
(WebInspector.ScriptsNavigatorController.prototype._createNavigatorControlButton):
(WebInspector.ScriptsNavigatorController.prototype._escDownWhileNavigatorOverlayOpen):
(WebInspector.ScriptsNavigatorController.prototype._toggleNavigator):
(WebInspector.ScriptsNavigatorController.prototype._hidePinnedNavigator):
(WebInspector.ScriptsNavigatorController.prototype.set _pinNavigator):
(WebInspector.ScriptsNavigatorController.prototype.set showNavigatorOverlay):
(WebInspector.ScriptsNavigatorController.prototype.hideNavigatorOverlay):
(WebInspector.ScriptsNavigatorController.prototype._navigatorOverlayWasShown):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.wasShown):
(WebInspector.ScriptsPanel.prototype._editorClosed):
(WebInspector.ScriptsPanel.prototype._editorSelected):
(WebInspector.ScriptsPanel.prototype._scriptSelected):
2012-04-18 Alexandru Chiculita <achicu@adobe.com>
 
Unreviewed, trying to fix QT build.
......@@ -38,8 +38,7 @@
#include "V8BindingPerContextData.h"
#include "V8DOMWindow.h"
#include "V8Proxy.h"
#include <stdio.h>
#include <wtf/StringExtras.h>
namespace WebCore {
......@@ -55,11 +54,25 @@ void V8IsolatedContext::contextWeakReferenceCallback(v8::Persistent<v8::Value> o
delete context;
}
static void setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext, int debugId)
{
char buffer[32];
if (debugId == -1)
snprintf(buffer, sizeof(buffer), "injected");
else
snprintf(buffer, sizeof(buffer), "injected,%d", debugId);
targetContext->SetData(v8::String::New(buffer));
}
V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup, int worldId)
: m_world(IsolatedWorld::create(worldId)),
m_frame(proxy->frame())
{
v8::HandleScope scope;
v8::Handle<v8::Context> mainWorldContext = proxy->windowShell()->context();
if (mainWorldContext.IsEmpty())
return;
// FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context.
m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup, m_world->id()));
if (m_context->get().IsEmpty())
......@@ -68,6 +81,9 @@ V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup, int wor
// 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));
getGlobalObject(m_context->get())->SetPointerInInternalField(V8DOMWindow::enteredIsolatedWorldIndex, this);
m_perContextData = V8BindingPerContextData::create(m_context->get());
......
......@@ -239,13 +239,6 @@ void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
// FIXME: We should change this to using window shells to match JSC.
m_isolatedWorlds.set(worldID, isolatedContext);
// Setup context id for JS debugger.
if (!setInjectedScriptContextDebugId(isolatedContext->context())) {
m_isolatedWorlds.take(worldID);
delete isolatedContext;
return;
}
}
IsolatedWorldSecurityOriginMap::iterator securityOriginIter = m_isolatedWorldSecurityOrigins.find(worldID);
......@@ -278,25 +271,6 @@ void V8Proxy::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityOri
iter->second->setSecurityOrigin(securityOrigin);
}
bool V8Proxy::setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext)
{
// Setup context id for JS debugger.
v8::Context::Scope contextScope(targetContext);
v8::Handle<v8::Context> context = windowShell()->context();
if (context.IsEmpty())
return false;
int debugId = contextDebugId(context);
char buffer[32];
if (debugId == -1)
snprintf(buffer, sizeof(buffer), "injected");
else
snprintf(buffer, sizeof(buffer), "injected,%d", debugId);
targetContext->SetData(v8::String::New(buffer));
return true;
}
PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript)
{
// A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from
......
......@@ -272,9 +272,6 @@ namespace WebCore {
PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*);
// Returns false when we're out of memory in V8.
bool setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext);
static const char* rangeExceptionName(int exceptionCode);
static const char* eventExceptionName(int exceptionCode);
static const char* xmlHttpRequestExceptionName(int exceptionCode);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment