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

Side by Side Diff: third_party/WebKit/Source/core/page/ChromeClient.cpp

Issue 2448833003: Sandbox should prevent 'execCommand("print", ...)'. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "core/page/ChromeClient.h" 22 #include "core/page/ChromeClient.h"
23 23
24 #include "core/dom/Document.h" 24 #include "core/dom/Document.h"
25 #include "core/dom/Element.h" 25 #include "core/dom/Element.h"
26 #include "core/frame/FrameConsole.h"
26 #include "core/frame/LocalFrame.h" 27 #include "core/frame/LocalFrame.h"
28 #include "core/inspector/ConsoleMessage.h"
27 #include "core/inspector/InspectorInstrumentation.h" 29 #include "core/inspector/InspectorInstrumentation.h"
28 #include "core/layout/HitTestResult.h" 30 #include "core/layout/HitTestResult.h"
29 #include "core/page/FrameTree.h" 31 #include "core/page/FrameTree.h"
30 #include "core/page/ScopedPageLoadDeferrer.h" 32 #include "core/page/ScopedPageLoadDeferrer.h"
31 #include "core/page/WindowFeatures.h" 33 #include "core/page/WindowFeatures.h"
32 #include "platform/geometry/IntRect.h" 34 #include "platform/geometry/IntRect.h"
33 #include "platform/network/NetworkHints.h" 35 #include "platform/network/NetworkHints.h"
34 #include "public/platform/WebScreenInfo.h" 36 #include "public/platform/WebScreenInfo.h"
35 #include <algorithm> 37 #include <algorithm>
36 38
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 m_lastToolTipText = toolTip; 189 m_lastToolTipText = toolTip;
188 setToolTip(frame, toolTip, toolTipDirection); 190 setToolTip(frame, toolTip, toolTipDirection);
189 } 191 }
190 192
191 void ChromeClient::clearToolTip(LocalFrame& frame) { 193 void ChromeClient::clearToolTip(LocalFrame& frame) {
192 // Do not check m_lastToolTip* and do not update them intentionally. 194 // Do not check m_lastToolTip* and do not update them intentionally.
193 // We don't want to show tooltips with same content after clearToolTip(). 195 // We don't want to show tooltips with same content after clearToolTip().
194 setToolTip(frame, String(), LTR); 196 setToolTip(frame, String(), LTR);
195 } 197 }
196 198
197 void ChromeClient::print(LocalFrame* frame) { 199 bool ChromeClient::print(LocalFrame* frame) {
200 if (frame->document()->isSandboxed(SandboxModals)) {
201 UseCounter::count(frame, UseCounter::DialogInSandboxedContext);
202 frame->console().addMessage(ConsoleMessage::create(
203 SecurityMessageSource, ErrorMessageLevel,
204 "Ignored call to 'print()'. The document is sandboxed, and the "
205 "'allow-modals' keyword is not set."));
206 return false;
207 }
208
198 // Defer loads in case the client method runs a new event loop that would 209 // Defer loads in case the client method runs a new event loop that would
199 // otherwise cause the load to continue while we're in the middle of 210 // otherwise cause the load to continue while we're in the middle of
200 // executing JavaScript. 211 // executing JavaScript.
201 ScopedPageLoadDeferrer deferrer; 212 ScopedPageLoadDeferrer deferrer;
202 213
203 printDelegate(frame); 214 printDelegate(frame);
215 return true;
204 } 216 }
205 217
206 } // namespace blink 218 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698