Diff
Modified: trunk/Source/WebCore/ChangeLog (104693 => 104694)
--- trunk/Source/WebCore/ChangeLog 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/ChangeLog 2012-01-11 10:58:00 UTC (rev 104694)
@@ -1,3 +1,34 @@
+2012-01-11 Jochen Eisinger <[email protected]>
+
+ Move the check for canExecuteScripts out of V8Proxy::retrieve
+ https://bugs.webkit.org/show_bug.cgi?id=75533
+
+ Reviewed by Adam Barth.
+
+ This change doesn't move the check to custom/generated bindings for
+ individual objects, as these won't get executed if scripts are disabled
+ anyway.
+
+ No new tests. No functional change.
+
+ * bindings/v8/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::addListener):
+ * bindings/v8/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::execute):
+ * bindings/v8/ScriptCachedFrameData.cpp:
+ (WebCore::ScriptCachedFrameData::restore):
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ * bindings/v8/V8EventListener.cpp:
+ (WebCore::V8EventListener::callListenerFunction):
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::callListenerFunction):
+ (WebCore::V8LazyEventListener::prepareListenerObject):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::handleOutOfMemory):
+ (WebCore::V8Proxy::retrieve):
+ (WebCore::toV8Context):
+
2012-01-11 Kentaro Hara <[email protected]>
ShouldSkipTypeInHeader() and ShouldSkipTypeInImplementation() should be the same
Modified: trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -76,9 +76,10 @@
void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
{
+ ScriptController* scriptController = page->mainFrame()->script();
+ if (!scriptController->canExecuteScripts(NotAboutToExecuteScript))
+ return;
V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame());
- if (!proxy)
- return;
v8::HandleScope scope;
v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
Modified: trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -94,15 +94,20 @@
void ScheduledAction::execute(ScriptExecutionContext* context)
{
- V8Proxy* proxy = V8Proxy::retrieve(context);
- if (proxy)
+ if (context->isDocument()) {
+ Frame* frame = static_cast<Document*>(context)->frame();
+ ScriptController* scriptController = frame->script();
+ if (!scriptController->canExecuteScripts(NotAboutToExecuteScript))
+ return;
+ V8Proxy* proxy = V8Proxy::retrieve(frame);
execute(proxy);
+ }
#if ENABLE(WORKERS)
- else if (context->isWorkerContext())
+ else {
+ ASSERT(context->isWorkerContext());
execute(static_cast<WorkerContext*>(context));
+ }
#endif
- // It's possible that _javascript_ is disabled and that we have neither a V8Proxy
- // nor a WorkerContext. Do nothing in that case.
}
void ScheduledAction::execute(V8Proxy* proxy)
Modified: trunk/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -59,6 +59,9 @@
if (m_context.get().IsEmpty())
return;
+ if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ return;
+
v8::HandleScope handleScope;
v8::Context::Scope contextScope(m_context.get());
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -216,8 +216,11 @@
v8::Handle<v8::Context> context = v8::Context::GetCurrent();
if (!context.IsEmpty()) {
v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
- if (isWrapperOfType(globalPrototype, &V8DOMWindow::info))
- proxy = V8Proxy::retrieve(V8DOMWindow::toNative(globalPrototype)->frame());
+ if (isWrapperOfType(globalPrototype, &V8DOMWindow::info)) {
+ Frame* frame = V8DOMWindow::toNative(globalPrototype)->frame();
+ if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ proxy = V8Proxy::retrieve(frame);
+ }
#if ENABLE(WORKERS)
else
workerContext = V8WorkerContext::toNative(lookupDOMWrapper(V8WorkerContext::GetTemplate(), context->Global()));
Modified: trunk/Source/WebCore/bindings/v8/V8EventListener.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/V8EventListener.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/V8EventListener.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -35,6 +35,8 @@
#include "TraceEvent.h"
#endif
+#include "Document.h"
+#include "Frame.h"
#include "V8Proxy.h"
namespace WebCore {
@@ -81,8 +83,11 @@
TRACE_EVENT("V8EventListener::callListenerFunction", this, 0);
#endif
- if (V8Proxy* proxy = V8Proxy::retrieve(context))
- return proxy->callFunction(handlerFunction, receiver, 1, parameters);
+ if (V8Proxy* proxy = V8Proxy::retrieve(context)) {
+ Frame* frame = static_cast<Document*>(context)->frame();
+ if (frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ return proxy->callFunction(handlerFunction, receiver, 1, parameters);
+ }
return v8::Local<v8::Value>();
}
Modified: trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -65,8 +65,11 @@
v8::Handle<v8::Value> parameters[1] = { jsEvent };
- if (V8Proxy* proxy = V8Proxy::retrieve(context))
- return proxy->callFunction(handlerFunction, receiver, 1, parameters);
+ if (V8Proxy* proxy = V8Proxy::retrieve(context)) {
+ Frame* frame = static_cast<Document*>(context)->frame();
+ if (frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ return proxy->callFunction(handlerFunction, receiver, 1, parameters);
+ }
return v8::Local<v8::Value>();
}
@@ -89,6 +92,9 @@
V8Proxy* proxy = V8Proxy::retrieve(context);
if (!proxy)
return;
+ ASSERT(context->isDocument());
+ if (!static_cast<Document*>(context)->frame()->script()->canExecuteScripts(NotAboutToExecuteScript))
+ return;
// Use the outer scope to hold context.
v8::Local<v8::Context> v8Context = worldContext().adjustedContext(proxy);
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (104693 => 104694)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -190,7 +190,7 @@
Frame* frame = V8Proxy::retrieveFrame(context);
V8Proxy* proxy = V8Proxy::retrieve(frame);
- if (proxy) {
+ if (proxy && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) {
// Clean m_context, and event handlers.
proxy->clearForClose();
@@ -505,9 +505,7 @@
V8Proxy* V8Proxy::retrieve(Frame* frame)
{
- if (!frame)
- return 0;
- return frame->script()->canExecuteScripts(NotAboutToExecuteScript) ? frame->script()->proxy() : 0;
+ return frame ? frame->script()->proxy() : 0;
}
V8Proxy* V8Proxy::retrieve(ScriptExecutionContext* context)
@@ -708,8 +706,11 @@
v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldContextHandle& worldContext)
{
if (context->isDocument()) {
- if (V8Proxy* proxy = V8Proxy::retrieve(context))
- return worldContext.adjustedContext(proxy);
+ if (V8Proxy* proxy = V8Proxy::retrieve(context)) {
+ Frame* frame = static_cast<Document*>(context)->frame();
+ if (frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ return worldContext.adjustedContext(proxy);
+ }
#if ENABLE(WORKERS)
} else if (context->isWorkerContext()) {
if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy())
Modified: trunk/Source/WebKit/chromium/ChangeLog (104693 => 104694)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-01-11 10:58:00 UTC (rev 104694)
@@ -1,3 +1,13 @@
+2012-01-11 Jochen Eisinger <[email protected]>
+
+ Move the check for canExecuteScripts out of V8Proxy::retrieve
+ https://bugs.webkit.org/show_bug.cgi?id=75533
+
+ Reviewed by Adam Barth.
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::didClearWindowObject):
+
2012-01-10 Daniel Cheng <[email protected]>
[chromium] Unreviewed, roll Chromium DEPS to r117121.
Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (104693 => 104694)
--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2012-01-11 10:51:16 UTC (rev 104693)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2012-01-11 10:58:00 UTC (rev 104694)
@@ -227,7 +227,7 @@
void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe)
{
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame());
- if (proxy)
+ if (proxy && webframe->frame()->script()->canExecuteScripts(NotAboutToExecuteScript))
proxy->setContextDebugId(m_hostId);
}