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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 void LocalDOMWindow::blur() {} 694 void LocalDOMWindow::blur() {}
695 695
696 void LocalDOMWindow::print(ScriptState* scriptState) { 696 void LocalDOMWindow::print(ScriptState* scriptState) {
697 if (!frame()) 697 if (!frame())
698 return; 698 return;
699 699
700 FrameHost* host = frame()->host(); 700 FrameHost* host = frame()->host();
701 if (!host) 701 if (!host)
702 return; 702 return;
703 703
704 if (document()->isSandboxed(SandboxModals)) {
705 UseCounter::count(document(), UseCounter::DialogInSandboxedContext);
706 frameConsole()->addMessage(ConsoleMessage::create(
707 SecurityMessageSource, ErrorMessageLevel,
708 "Ignored call to 'print()'. The document is sandboxed, and the "
709 "'allow-modals' keyword is not set."));
710 return;
711 }
712
713 if (scriptState && 704 if (scriptState &&
714 v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { 705 v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
715 UseCounter::count(document(), UseCounter::During_Microtask_Print); 706 UseCounter::count(document(), UseCounter::During_Microtask_Print);
716 } 707 }
717 708
718 if (frame()->isLoading()) { 709 if (frame()->isLoading()) {
719 m_shouldPrintWhenFinishedLoading = true; 710 m_shouldPrintWhenFinishedLoading = true;
720 return; 711 return;
721 } 712 }
722 713
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 1549
1559 LocalFrame* LocalDOMWindow::frame() const { 1550 LocalFrame* LocalDOMWindow::frame() const {
1560 // If the LocalDOMWindow still has a frame reference, that frame must point 1551 // If the LocalDOMWindow still has a frame reference, that frame must point
1561 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1552 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1562 // where script execution leaks between different LocalDOMWindows. 1553 // where script execution leaks between different LocalDOMWindows.
1563 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); 1554 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this);
1564 return m_frame; 1555 return m_frame;
1565 } 1556 }
1566 1557
1567 } // namespace blink 1558 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp ('k') | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698