OLD | NEW |
---|---|
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 19 matching lines...) Expand all Loading... | |
30 #include "bindings/core/v8/ScriptController.h" | 30 #include "bindings/core/v8/ScriptController.h" |
31 #include "core/css/CSSComputedStyleDeclaration.h" | 31 #include "core/css/CSSComputedStyleDeclaration.h" |
32 #include "core/css/CSSRuleList.h" | 32 #include "core/css/CSSRuleList.h" |
33 #include "core/css/DOMWindowCSS.h" | 33 #include "core/css/DOMWindowCSS.h" |
34 #include "core/css/MediaQueryList.h" | 34 #include "core/css/MediaQueryList.h" |
35 #include "core/css/MediaQueryMatcher.h" | 35 #include "core/css/MediaQueryMatcher.h" |
36 #include "core/css/StyleMedia.h" | 36 #include "core/css/StyleMedia.h" |
37 #include "core/css/resolver/StyleResolver.h" | 37 #include "core/css/resolver/StyleResolver.h" |
38 #include "core/dom/DOMImplementation.h" | 38 #include "core/dom/DOMImplementation.h" |
39 #include "core/dom/FrameRequestCallback.h" | 39 #include "core/dom/FrameRequestCallback.h" |
40 #include "core/dom/SandboxFlags.h" | |
40 #include "core/editing/Editor.h" | 41 #include "core/editing/Editor.h" |
41 #include "core/events/DOMWindowEventQueue.h" | 42 #include "core/events/DOMWindowEventQueue.h" |
42 #include "core/events/HashChangeEvent.h" | 43 #include "core/events/HashChangeEvent.h" |
43 #include "core/events/MessageEvent.h" | 44 #include "core/events/MessageEvent.h" |
44 #include "core/events/PageTransitionEvent.h" | 45 #include "core/events/PageTransitionEvent.h" |
45 #include "core/events/PopStateEvent.h" | 46 #include "core/events/PopStateEvent.h" |
46 #include "core/frame/BarProp.h" | 47 #include "core/frame/BarProp.h" |
47 #include "core/frame/Console.h" | 48 #include "core/frame/Console.h" |
48 #include "core/frame/EventHandlerRegistry.h" | 49 #include "core/frame/EventHandlerRegistry.h" |
49 #include "core/frame/FrameConsole.h" | 50 #include "core/frame/FrameConsole.h" |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 | 782 |
782 void LocalDOMWindow::print() | 783 void LocalDOMWindow::print() |
783 { | 784 { |
784 if (!frame()) | 785 if (!frame()) |
785 return; | 786 return; |
786 | 787 |
787 FrameHost* host = frame()->host(); | 788 FrameHost* host = frame()->host(); |
788 if (!host) | 789 if (!host) |
789 return; | 790 return; |
790 | 791 |
792 if (frame()->document()->isSandboxed(SandboxModals)) { | |
793 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
794 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | |
795 return; | |
796 } | |
797 | |
Yoav Weiss
2015/05/22 14:32:24
Might be a good idea to count the "sandboxed but a
| |
791 if (frame()->isLoading()) { | 798 if (frame()->isLoading()) { |
792 m_shouldPrintWhenFinishedLoading = true; | 799 m_shouldPrintWhenFinishedLoading = true; |
793 return; | 800 return; |
794 } | 801 } |
795 m_shouldPrintWhenFinishedLoading = false; | 802 m_shouldPrintWhenFinishedLoading = false; |
796 host->chrome().print(frame()); | 803 host->chrome().print(frame()); |
797 | |
798 if (frame()->document()->sandboxFlags()) | |
799 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
800 } | 804 } |
801 | 805 |
802 void LocalDOMWindow::stop() | 806 void LocalDOMWindow::stop() |
803 { | 807 { |
804 if (!frame()) | 808 if (!frame()) |
805 return; | 809 return; |
806 frame()->loader().stopAllLoaders(); | 810 frame()->loader().stopAllLoaders(); |
807 } | 811 } |
808 | 812 |
809 void LocalDOMWindow::alert(const String& message) | 813 void LocalDOMWindow::alert(const String& message) |
810 { | 814 { |
811 if (!frame()) | 815 if (!frame()) |
812 return; | 816 return; |
813 | 817 |
818 if (frame()->document()->isSandboxed(SandboxModals)) { | |
819 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
820 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | |
821 return; | |
822 } | |
823 | |
814 frame()->document()->updateLayoutTreeIfNeeded(); | 824 frame()->document()->updateLayoutTreeIfNeeded(); |
815 | 825 |
816 FrameHost* host = frame()->host(); | 826 FrameHost* host = frame()->host(); |
817 if (!host) | 827 if (!host) |
818 return; | 828 return; |
819 | 829 |
820 if (frame()->document()->sandboxFlags()) | |
821 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
822 | |
823 host->chrome().runJavaScriptAlert(frame(), message); | 830 host->chrome().runJavaScriptAlert(frame(), message); |
824 } | 831 } |
825 | 832 |
826 bool LocalDOMWindow::confirm(const String& message) | 833 bool LocalDOMWindow::confirm(const String& message) |
827 { | 834 { |
828 if (!frame()) | 835 if (!frame()) |
829 return false; | 836 return false; |
830 | 837 |
838 if (frame()->document()->isSandboxed(SandboxModals)) { | |
839 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
840 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | |
841 return false; | |
842 } | |
843 | |
831 frame()->document()->updateLayoutTreeIfNeeded(); | 844 frame()->document()->updateLayoutTreeIfNeeded(); |
832 | 845 |
833 FrameHost* host = frame()->host(); | 846 FrameHost* host = frame()->host(); |
834 if (!host) | 847 if (!host) |
835 return false; | 848 return false; |
836 | 849 |
837 if (frame()->document()->sandboxFlags()) | 850 if (frame()->document()->isSandboxed(SandboxModals)) { |
838 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | 851 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); |
852 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | |
853 return false; | |
854 } | |
839 | 855 |
840 return host->chrome().runJavaScriptConfirm(frame(), message); | 856 return host->chrome().runJavaScriptConfirm(frame(), message); |
841 } | 857 } |
842 | 858 |
843 String LocalDOMWindow::prompt(const String& message, const String& defaultValue) | 859 String LocalDOMWindow::prompt(const String& message, const String& defaultValue) |
844 { | 860 { |
845 if (!frame()) | 861 if (!frame()) |
846 return String(); | 862 return String(); |
847 | 863 |
864 if (frame()->document()->isSandboxed(SandboxModals)) { | |
865 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
866 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | |
867 return String(); | |
868 } | |
869 | |
848 frame()->document()->updateLayoutTreeIfNeeded(); | 870 frame()->document()->updateLayoutTreeIfNeeded(); |
849 | 871 |
850 FrameHost* host = frame()->host(); | 872 FrameHost* host = frame()->host(); |
851 if (!host) | 873 if (!host) |
852 return String(); | 874 return String(); |
853 | 875 |
854 if (frame()->document()->sandboxFlags()) | |
855 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); | |
856 | |
857 String returnValue; | 876 String returnValue; |
858 if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, retur nValue)) | 877 if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, retur nValue)) |
859 return returnValue; | 878 return returnValue; |
860 | 879 |
861 return String(); | 880 return String(); |
862 } | 881 } |
863 | 882 |
864 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st | 883 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st |
865 { | 884 { |
866 if (!isCurrentlyDisplayedInFrame()) | 885 if (!isCurrentlyDisplayedInFrame()) |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1508 DOMWindow::trace(visitor); | 1527 DOMWindow::trace(visitor); |
1509 DOMWindowLifecycleNotifier::trace(visitor); | 1528 DOMWindowLifecycleNotifier::trace(visitor); |
1510 } | 1529 } |
1511 | 1530 |
1512 LocalFrame* LocalDOMWindow::frame() const | 1531 LocalFrame* LocalDOMWindow::frame() const |
1513 { | 1532 { |
1514 return m_frameObserver->frame(); | 1533 return m_frameObserver->frame(); |
1515 } | 1534 } |
1516 | 1535 |
1517 } // namespace blink | 1536 } // namespace blink |
OLD | NEW |