Chromium Code Reviews| Index: Source/core/frame/LocalDOMWindow.cpp | 
| diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp | 
| index 08ef5fe3195c75d369887d4c3394cfce6da16fcc..7efcedd3908c0efd8d509177ce999e4e625de6bd 100644 | 
| --- a/Source/core/frame/LocalDOMWindow.cpp | 
| +++ b/Source/core/frame/LocalDOMWindow.cpp | 
| @@ -37,6 +37,7 @@ | 
| #include "core/css/resolver/StyleResolver.h" | 
| #include "core/dom/DOMImplementation.h" | 
| #include "core/dom/FrameRequestCallback.h" | 
| +#include "core/dom/SandboxFlags.h" | 
| #include "core/editing/Editor.h" | 
| #include "core/events/DOMWindowEventQueue.h" | 
| #include "core/events/HashChangeEvent.h" | 
| @@ -788,15 +789,18 @@ void LocalDOMWindow::print() | 
| if (!host) | 
| return; | 
| + if (frame()->document()->isSandboxed(SandboxModals)) { | 
| + UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| + if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 
| + return; | 
| + } | 
| + | 
| 
 
Yoav Weiss
2015/05/22 14:32:24
Might be a good idea to count the "sandboxed but a
 
 | 
| if (frame()->isLoading()) { | 
| m_shouldPrintWhenFinishedLoading = true; | 
| return; | 
| } | 
| m_shouldPrintWhenFinishedLoading = false; | 
| host->chrome().print(frame()); | 
| - | 
| - if (frame()->document()->sandboxFlags()) | 
| - UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| } | 
| void LocalDOMWindow::stop() | 
| @@ -811,15 +815,18 @@ void LocalDOMWindow::alert(const String& message) | 
| if (!frame()) | 
| return; | 
| + if (frame()->document()->isSandboxed(SandboxModals)) { | 
| + UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| + if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 
| + return; | 
| + } | 
| + | 
| frame()->document()->updateLayoutTreeIfNeeded(); | 
| FrameHost* host = frame()->host(); | 
| if (!host) | 
| return; | 
| - if (frame()->document()->sandboxFlags()) | 
| - UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| - | 
| host->chrome().runJavaScriptAlert(frame(), message); | 
| } | 
| @@ -828,14 +835,23 @@ bool LocalDOMWindow::confirm(const String& message) | 
| if (!frame()) | 
| return false; | 
| + if (frame()->document()->isSandboxed(SandboxModals)) { | 
| + UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| + if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 
| + return false; | 
| + } | 
| + | 
| frame()->document()->updateLayoutTreeIfNeeded(); | 
| FrameHost* host = frame()->host(); | 
| if (!host) | 
| return false; | 
| - if (frame()->document()->sandboxFlags()) | 
| + if (frame()->document()->isSandboxed(SandboxModals)) { | 
| UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| + if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 
| + return false; | 
| + } | 
| return host->chrome().runJavaScriptConfirm(frame(), message); | 
| } | 
| @@ -845,15 +861,18 @@ String LocalDOMWindow::prompt(const String& message, const String& defaultValue) | 
| if (!frame()) | 
| return String(); | 
| + if (frame()->document()->isSandboxed(SandboxModals)) { | 
| + UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| + if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 
| + return String(); | 
| + } | 
| + | 
| frame()->document()->updateLayoutTreeIfNeeded(); | 
| FrameHost* host = frame()->host(); | 
| if (!host) | 
| return String(); | 
| - if (frame()->document()->sandboxFlags()) | 
| - UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext); | 
| - | 
| String returnValue; | 
| if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, returnValue)) | 
| return returnValue; |