Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Unified Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1126253007: Block modal dialogs inside sandboxes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WebSandboxFlags. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/SandboxFlags.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/dom/SandboxFlags.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698