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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2239303003: Remove SandboxBlocksModals runtime flag (status=stable) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 { 725 {
726 if (!frame()) 726 if (!frame())
727 return; 727 return;
728 728
729 FrameHost* host = frame()->host(); 729 FrameHost* host = frame()->host();
730 if (!host) 730 if (!host)
731 return; 731 return;
732 732
733 if (document()->isSandboxed(SandboxModals)) { 733 if (document()->isSandboxed(SandboxModals)) {
734 UseCounter::count(document(), UseCounter::DialogInSandboxedContext); 734 UseCounter::count(document(), UseCounter::DialogInSandboxedContext);
735 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { 735 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'print()'. The document is sandboxed, and t he 'allow-modals' keyword is not set."));
736 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou rce, ErrorMessageLevel, "Ignored call to 'print()'. The document is sandboxed, a nd the 'allow-modals' keyword is not set.")); 736 return;
737 return;
738 }
739 } 737 }
740 738
741 if (scriptState && v8::MicrotasksScope::IsRunningMicrotasks(scriptState->iso late())) { 739 if (scriptState && v8::MicrotasksScope::IsRunningMicrotasks(scriptState->iso late())) {
742 UseCounter::count(document(), UseCounter::During_Microtask_Print); 740 UseCounter::count(document(), UseCounter::During_Microtask_Print);
743 } 741 }
744 742
745 if (frame()->isLoading()) { 743 if (frame()->isLoading()) {
746 m_shouldPrintWhenFinishedLoading = true; 744 m_shouldPrintWhenFinishedLoading = true;
747 return; 745 return;
748 } 746 }
(...skipping 11 matching lines...) Expand all
760 frame()->loader().stopAllLoaders(); 758 frame()->loader().stopAllLoaders();
761 } 759 }
762 760
763 void LocalDOMWindow::alert(ScriptState* scriptState, const String& message) 761 void LocalDOMWindow::alert(ScriptState* scriptState, const String& message)
764 { 762 {
765 if (!frame()) 763 if (!frame())
766 return; 764 return;
767 765
768 if (document()->isSandboxed(SandboxModals)) { 766 if (document()->isSandboxed(SandboxModals)) {
769 UseCounter::count(document(), UseCounter::DialogInSandboxedContext); 767 UseCounter::count(document(), UseCounter::DialogInSandboxedContext);
770 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { 768 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'alert()'. The document is sandboxed, and t he 'allow-modals' keyword is not set."));
771 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou rce, ErrorMessageLevel, "Ignored call to 'alert()'. The document is sandboxed, a nd the 'allow-modals' keyword is not set.")); 769 return;
772 return;
773 }
774 } 770 }
775 771
776 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { 772 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
777 UseCounter::count(document(), UseCounter::During_Microtask_Alert); 773 UseCounter::count(document(), UseCounter::During_Microtask_Alert);
778 } 774 }
779 775
780 document()->updateStyleAndLayoutTree(); 776 document()->updateStyleAndLayoutTree();
781 777
782 FrameHost* host = frame()->host(); 778 FrameHost* host = frame()->host();
783 if (!host) 779 if (!host)
784 return; 780 return;
785 781
786 UseCounter::countCrossOriginIframe(*document(), UseCounter::CrossOriginWindo wAlert); 782 UseCounter::countCrossOriginIframe(*document(), UseCounter::CrossOriginWindo wAlert);
787 783
788 host->chromeClient().openJavaScriptAlert(frame(), message); 784 host->chromeClient().openJavaScriptAlert(frame(), message);
789 } 785 }
790 786
791 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message) 787 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message)
792 { 788 {
793 if (!frame()) 789 if (!frame())
794 return false; 790 return false;
795 791
796 if (document()->isSandboxed(SandboxModals)) { 792 if (document()->isSandboxed(SandboxModals)) {
797 UseCounter::count(document(), UseCounter::DialogInSandboxedContext); 793 UseCounter::count(document(), UseCounter::DialogInSandboxedContext);
798 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { 794 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'confirm()'. The document is sandboxed, and the 'allow-modals' keyword is not set."));
799 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou rce, ErrorMessageLevel, "Ignored call to 'confirm()'. The document is sandboxed, and the 'allow-modals' keyword is not set.")); 795 return false;
800 return false;
801 }
802 } 796 }
803 797
804 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { 798 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
805 UseCounter::count(document(), UseCounter::During_Microtask_Confirm); 799 UseCounter::count(document(), UseCounter::During_Microtask_Confirm);
806 } 800 }
807 801
808 document()->updateStyleAndLayoutTree(); 802 document()->updateStyleAndLayoutTree();
809 803
810 FrameHost* host = frame()->host(); 804 FrameHost* host = frame()->host();
811 if (!host) 805 if (!host)
812 return false; 806 return false;
813 807
814 UseCounter::countCrossOriginIframe(*document(), UseCounter::CrossOriginWindo wConfirm); 808 UseCounter::countCrossOriginIframe(*document(), UseCounter::CrossOriginWindo wConfirm);
815 809
816 return host->chromeClient().openJavaScriptConfirm(frame(), message); 810 return host->chromeClient().openJavaScriptConfirm(frame(), message);
817 } 811 }
818 812
819 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c onst String& defaultValue) 813 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c onst String& defaultValue)
820 { 814 {
821 if (!frame()) 815 if (!frame())
822 return String(); 816 return String();
823 817
824 if (document()->isSandboxed(SandboxModals)) { 818 if (document()->isSandboxed(SandboxModals)) {
825 UseCounter::count(document(), UseCounter::DialogInSandboxedContext); 819 UseCounter::count(document(), UseCounter::DialogInSandboxedContext);
826 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { 820 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'prompt()'. The document is sandboxed, and the 'allow-modals' keyword is not set."));
827 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou rce, ErrorMessageLevel, "Ignored call to 'prompt()'. The document is sandboxed, and the 'allow-modals' keyword is not set.")); 821 return String();
828 return String();
829 }
830 } 822 }
831 823
832 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { 824 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
833 UseCounter::count(document(), UseCounter::During_Microtask_Prompt); 825 UseCounter::count(document(), UseCounter::During_Microtask_Prompt);
834 } 826 }
835 827
836 document()->updateStyleAndLayoutTree(); 828 document()->updateStyleAndLayoutTree();
837 829
838 FrameHost* host = frame()->host(); 830 FrameHost* host = frame()->host();
839 if (!host) 831 if (!host)
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 { 1529 {
1538 // If the LocalDOMWindow still has a frame reference, that frame must point 1530 // If the LocalDOMWindow still has a frame reference, that frame must point
1539 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1531 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1540 // where script execution leaks between different LocalDOMWindows. 1532 // where script execution leaks between different LocalDOMWindows.
1541 if (m_frameObserver->frame()) 1533 if (m_frameObserver->frame())
1542 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1534 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1543 return m_frameObserver->frame(); 1535 return m_frameObserver->frame();
1544 } 1536 }
1545 1537
1546 } // namespace blink 1538 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/SandboxFlags.cpp ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698