Title: [127285] branches/chromium/1132/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Revision
127285
Author
kar...@chromium.org
Date
2012-08-31 10:58:27 -0700 (Fri, 31 Aug 2012)

Log Message

Merge 124689 - Disabling eval changes the timing of DidCreateScriptContext
https://bugs.webkit.org/show_bug.cgi?id=92189

Reviewed by Eric Seidel.

When we implemented Content-Security-Policy, we added the ability to
disable eval in the _javascript_ engine. However, when we process the
Content-Security-Policy header, we might not have initialized the
script context for the given frame.

Previously, we would initialize the context, but that generates a
DidCreateScriptContext callback to the embedder earlier in the Document's
lifetime that before. A natural thing to do in this callback is to run
script to customize the script context, but Document isn't fully
initialized yet, which leads to odd bugs and general confusion.

In this patch, we delay actually disabling eval until we would have
created the scripting context previously. From the perspective of the
web platform, this has the same behavior. The only difference is that
now the DidCreateScriptContext notification occurs at the same time
regardless of whether Content-Security-Policy disables eval.

I tried to write a test for this change, but it was unclear to me how
to write a good test. I tried writing a Chromium WebKit unit test to no
avail. The good news is that this patch will be covered by the
PlatformAppBrowserTest.Iframes test in Chromium once
https://bugs.webkit.org/show_bug.cgi?id=93079 lands. That's not the
best way to test this change, but it might be sufficient.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::initScript):
(WebCore::ScriptController::disableEval):
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::enableEval):
(WebCore::ScriptController::disableEval):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::initContextIfNeeded):


TBR=aba...@webkit.org
Review URL: https://chromiumcodereview.appspot.com/10919034

Modified Paths

Diff

Modified: branches/chromium/1132/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (127284 => 127285)


--- branches/chromium/1132/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-31 17:50:56 UTC (rev 127284)
+++ branches/chromium/1132/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-31 17:58:27 UTC (rev 127285)
@@ -34,6 +34,7 @@
 #include "PlatformSupport.h"
 #include "ContentSecurityPolicy.h"
 #include "ContentSecurityPolicy.h"
+#include "ContentSecurityPolicy.h"
 #include "DateExtension.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to