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

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: Update histograms.xml again 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()) {
dcheng 2016/06/21 11:20:02 Nit: no { } around a single-line conditional body
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 }
812
805 host->chromeClient().openJavaScriptAlert(frame(), message); 813 host->chromeClient().openJavaScriptAlert(frame(), message);
806 } 814 }
807 815
808 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message) 816 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message)
809 { 817 {
810 if (!frame()) 818 if (!frame())
811 return false; 819 return false;
812 820
813 if (frame()->document()->isSandboxed(SandboxModals)) { 821 if (frame()->document()->isSandboxed(SandboxModals)) {
814 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); 822 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
(...skipping 10 matching lines...) Expand all
825 return false; 833 return false;
826 } 834 }
827 } 835 }
828 836
829 frame()->document()->updateStyleAndLayoutTree(); 837 frame()->document()->updateStyleAndLayoutTree();
830 838
831 FrameHost* host = frame()->host(); 839 FrameHost* host = frame()->host();
832 if (!host) 840 if (!host)
833 return false; 841 return false;
834 842
843 if (frame()->isCrossOrigin()) {
844 UseCounter::count(frame()->document(), UseCounter::CrossOriginWindowConf irm);
845 }
835 return host->chromeClient().openJavaScriptConfirm(frame(), message); 846 return host->chromeClient().openJavaScriptConfirm(frame(), message);
836 } 847 }
837 848
838 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c onst String& defaultValue) 849 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c onst String& defaultValue)
839 { 850 {
840 if (!frame()) 851 if (!frame())
841 return String(); 852 return String();
842 853
843 if (frame()->document()->isSandboxed(SandboxModals)) { 854 if (frame()->document()->isSandboxed(SandboxModals)) {
844 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); 855 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
(...skipping 14 matching lines...) Expand all
859 frame()->document()->updateStyleAndLayoutTree(); 870 frame()->document()->updateStyleAndLayoutTree();
860 871
861 FrameHost* host = frame()->host(); 872 FrameHost* host = frame()->host();
862 if (!host) 873 if (!host)
863 return String(); 874 return String();
864 875
865 String returnValue; 876 String returnValue;
866 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue , returnValue)) 877 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue , returnValue))
867 return returnValue; 878 return returnValue;
868 879
880 if (frame()->isCrossOrigin()) {
881 UseCounter::count(frame()->document(), UseCounter::CrossOriginWindowProm pt);
882 }
883
869 return String(); 884 return String();
870 } 885 }
871 886
872 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st 887 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st
873 { 888 {
874 if (!isCurrentlyDisplayedInFrame()) 889 if (!isCurrentlyDisplayedInFrame())
875 return false; 890 return false;
876 891
877 // FIXME (13016): Support searchInFrames and showDialog 892 // FIXME (13016): Support searchInFrames and showDialog
878 FindOptions options = (backwards ? Backwards : 0) | (caseSensitive ? 0 : Cas eInsensitive) | (wrap ? WrapAround : 0) | (wholeWord ? WholeWord | AtWordStarts : 0); 893 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 { 1568 {
1554 // If the LocalDOMWindow still has a frame reference, that frame must point 1569 // 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 1570 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1556 // where script execution leaks between different LocalDOMWindows. 1571 // where script execution leaks between different LocalDOMWindows.
1557 if (m_frameObserver->frame()) 1572 if (m_frameObserver->frame())
1558 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1573 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1559 return m_frameObserver->frame(); 1574 return m_frameObserver->frame();
1560 } 1575 }
1561 1576
1562 } // namespace blink 1577 } // 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