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

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

Issue 2079183002: Measure the usage of cross-origin modal dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove { } around a single-line conditional body. Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | 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, 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable d()) { 757 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable d()) {
758 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou rce, ErrorMessageLevel, "Ignored call to 'print()' during microtask execution.") ); 758 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou rce, ErrorMessageLevel, "Ignored call to 'print()' during microtask execution.") );
759 return; 759 return;
760 } 760 }
761 } 761 }
762 762
763 if (frame()->isLoading()) { 763 if (frame()->isLoading()) {
764 m_shouldPrintWhenFinishedLoading = true; 764 m_shouldPrintWhenFinishedLoading = true;
765 return; 765 return;
766 } 766 }
767
768 if (frame()->isCrossOrigin())
769 UseCounter::count(frame()->document(), UseCounter::CrossOriginWindowPrin t);
770
767 m_shouldPrintWhenFinishedLoading = false; 771 m_shouldPrintWhenFinishedLoading = false;
768 host->chromeClient().print(frame()); 772 host->chromeClient().print(frame());
769 } 773 }
770 774
771 void LocalDOMWindow::stop() 775 void LocalDOMWindow::stop()
772 { 776 {
773 if (!frame()) 777 if (!frame())
774 return; 778 return;
775 frame()->loader().stopAllLoaders(); 779 frame()->loader().stopAllLoaders();
776 } 780 }
(...skipping 18 matching lines...) Expand all
795 return; 799 return;
796 } 800 }
797 } 801 }
798 802
799 frame()->document()->updateStyleAndLayoutTree(); 803 frame()->document()->updateStyleAndLayoutTree();
800 804
801 FrameHost* host = frame()->host(); 805 FrameHost* host = frame()->host();
802 if (!host) 806 if (!host)
803 return; 807 return;
804 808
809 if (frame()->isCrossOrigin())
810 UseCounter::count(frame()->document(), UseCounter::CrossOriginWindowAler t);
811
805 host->chromeClient().openJavaScriptAlert(frame(), message); 812 host->chromeClient().openJavaScriptAlert(frame(), message);
806 } 813 }
807 814
808 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message) 815 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message)
809 { 816 {
810 if (!frame()) 817 if (!frame())
811 return false; 818 return false;
812 819
813 if (frame()->document()->isSandboxed(SandboxModals)) { 820 if (frame()->document()->isSandboxed(SandboxModals)) {
814 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); 821 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
(...skipping 10 matching lines...) Expand all
825 return false; 832 return false;
826 } 833 }
827 } 834 }
828 835
829 frame()->document()->updateStyleAndLayoutTree(); 836 frame()->document()->updateStyleAndLayoutTree();
830 837
831 FrameHost* host = frame()->host(); 838 FrameHost* host = frame()->host();
832 if (!host) 839 if (!host)
833 return false; 840 return false;
834 841
842 if (frame()->isCrossOrigin())
843 UseCounter::count(frame()->document(), UseCounter::CrossOriginWindowConf irm);
844
835 return host->chromeClient().openJavaScriptConfirm(frame(), message); 845 return host->chromeClient().openJavaScriptConfirm(frame(), message);
836 } 846 }
837 847
838 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c onst String& defaultValue) 848 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c onst String& defaultValue)
839 { 849 {
840 if (!frame()) 850 if (!frame())
841 return String(); 851 return String();
842 852
843 if (frame()->document()->isSandboxed(SandboxModals)) { 853 if (frame()->document()->isSandboxed(SandboxModals)) {
844 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); 854 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
(...skipping 14 matching lines...) Expand all
859 frame()->document()->updateStyleAndLayoutTree(); 869 frame()->document()->updateStyleAndLayoutTree();
860 870
861 FrameHost* host = frame()->host(); 871 FrameHost* host = frame()->host();
862 if (!host) 872 if (!host)
863 return String(); 873 return String();
864 874
865 String returnValue; 875 String returnValue;
866 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue , returnValue)) 876 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue , returnValue))
867 return returnValue; 877 return returnValue;
868 878
879 if (frame()->isCrossOrigin())
880 UseCounter::count(frame()->document(), UseCounter::CrossOriginWindowProm pt);
881
869 return String(); 882 return String();
870 } 883 }
871 884
872 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st 885 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st
873 { 886 {
874 if (!isCurrentlyDisplayedInFrame()) 887 if (!isCurrentlyDisplayedInFrame())
875 return false; 888 return false;
876 889
877 // FIXME (13016): Support searchInFrames and showDialog 890 // FIXME (13016): Support searchInFrames and showDialog
878 FindOptions options = (backwards ? Backwards : 0) | (caseSensitive ? 0 : Cas eInsensitive) | (wrap ? WrapAround : 0) | (wholeWord ? WholeWord | AtWordStarts : 0); 891 FindOptions options = (backwards ? Backwards : 0) | (caseSensitive ? 0 : Cas eInsensitive) | (wrap ? WrapAround : 0) | (wholeWord ? WholeWord | AtWordStarts : 0);
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 { 1566 {
1554 // If the LocalDOMWindow still has a frame reference, that frame must point 1567 // If the LocalDOMWindow still has a frame reference, that frame must point
1555 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1568 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1556 // where script execution leaks between different LocalDOMWindows. 1569 // where script execution leaks between different LocalDOMWindows.
1557 if (m_frameObserver->frame()) 1570 if (m_frameObserver->frame())
1558 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1571 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1559 return m_frameObserver->frame(); 1572 return m_frameObserver->frame();
1560 } 1573 }
1561 1574
1562 } // namespace blink 1575 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698