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

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

Issue 1191903002: Add console messages when modals are suppressed due to sandboxing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | 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 951255ace8577aa40c02952f5350e1c789f533be..2842e4b38ebbd988b33af2c22f5cad5b712fe9ab 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -787,8 +787,10 @@ void LocalDOMWindow::print()
if (frame()->document()->isSandboxed(SandboxModals)) {
UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext);
- if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled())
+ if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) {
+ frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'print()'. The document is sandboxed, and the 'allow-modals' keyword is not set."));
return;
+ }
}
if (frame()->isLoading()) {
@@ -813,8 +815,10 @@ void LocalDOMWindow::alert(const String& message)
if (frame()->document()->isSandboxed(SandboxModals)) {
UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext);
- if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled())
+ if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) {
+ frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'alert()'. The document is sandboxed, and the 'allow-modals' keyword is not set."));
return;
+ }
}
frame()->document()->updateLayoutTreeIfNeeded();
@@ -833,8 +837,10 @@ bool LocalDOMWindow::confirm(const String& message)
if (frame()->document()->isSandboxed(SandboxModals)) {
UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext);
- if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled())
+ if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) {
+ frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'confirm()'. The document is sandboxed, and the 'allow-modals' keyword is not set."));
return false;
+ }
}
frame()->document()->updateLayoutTreeIfNeeded();
@@ -843,12 +849,6 @@ bool LocalDOMWindow::confirm(const String& message)
if (!host)
return false;
- if (frame()->document()->isSandboxed(SandboxModals)) {
- UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext);
- if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled())
- return false;
- }
-
return host->chromeClient().openJavaScriptConfirm(frame(), message);
}
@@ -859,8 +859,10 @@ String LocalDOMWindow::prompt(const String& message, const String& defaultValue)
if (frame()->document()->isSandboxed(SandboxModals)) {
UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedContext);
- if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled())
+ if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) {
+ frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'prompt()'. The document is sandboxed, and the 'allow-modals' keyword is not set."));
return String();
+ }
}
frame()->document()->updateLayoutTreeIfNeeded();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698