| 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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 { | 780 { |
| 781 if (!frame()) | 781 if (!frame()) |
| 782 return; | 782 return; |
| 783 | 783 |
| 784 FrameHost* host = frame()->host(); | 784 FrameHost* host = frame()->host(); |
| 785 if (!host) | 785 if (!host) |
| 786 return; | 786 return; |
| 787 | 787 |
| 788 if (frame()->document()->isSandboxed(SandboxModals)) { | 788 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 789 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 789 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 790 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 790 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 791 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'print()'. The document is sandboxed, a
nd the 'allow-modals' keyword is not set.")); |
| 791 return; | 792 return; |
| 793 } |
| 792 } | 794 } |
| 793 | 795 |
| 794 if (frame()->isLoading()) { | 796 if (frame()->isLoading()) { |
| 795 m_shouldPrintWhenFinishedLoading = true; | 797 m_shouldPrintWhenFinishedLoading = true; |
| 796 return; | 798 return; |
| 797 } | 799 } |
| 798 m_shouldPrintWhenFinishedLoading = false; | 800 m_shouldPrintWhenFinishedLoading = false; |
| 799 host->chromeClient().print(frame()); | 801 host->chromeClient().print(frame()); |
| 800 } | 802 } |
| 801 | 803 |
| 802 void LocalDOMWindow::stop() | 804 void LocalDOMWindow::stop() |
| 803 { | 805 { |
| 804 if (!frame()) | 806 if (!frame()) |
| 805 return; | 807 return; |
| 806 frame()->loader().stopAllLoaders(); | 808 frame()->loader().stopAllLoaders(); |
| 807 } | 809 } |
| 808 | 810 |
| 809 void LocalDOMWindow::alert(const String& message) | 811 void LocalDOMWindow::alert(const String& message) |
| 810 { | 812 { |
| 811 if (!frame()) | 813 if (!frame()) |
| 812 return; | 814 return; |
| 813 | 815 |
| 814 if (frame()->document()->isSandboxed(SandboxModals)) { | 816 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 815 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 817 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 816 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 818 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 819 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'alert()'. The document is sandboxed, a
nd the 'allow-modals' keyword is not set.")); |
| 817 return; | 820 return; |
| 821 } |
| 818 } | 822 } |
| 819 | 823 |
| 820 frame()->document()->updateLayoutTreeIfNeeded(); | 824 frame()->document()->updateLayoutTreeIfNeeded(); |
| 821 | 825 |
| 822 FrameHost* host = frame()->host(); | 826 FrameHost* host = frame()->host(); |
| 823 if (!host) | 827 if (!host) |
| 824 return; | 828 return; |
| 825 | 829 |
| 826 host->chromeClient().openJavaScriptAlert(frame(), message); | 830 host->chromeClient().openJavaScriptAlert(frame(), message); |
| 827 } | 831 } |
| 828 | 832 |
| 829 bool LocalDOMWindow::confirm(const String& message) | 833 bool LocalDOMWindow::confirm(const String& message) |
| 830 { | 834 { |
| 831 if (!frame()) | 835 if (!frame()) |
| 832 return false; | 836 return false; |
| 833 | 837 |
| 834 if (frame()->document()->isSandboxed(SandboxModals)) { | 838 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 835 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 839 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 836 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 840 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 841 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'confirm()'. The document is sandboxed,
and the 'allow-modals' keyword is not set.")); |
| 837 return false; | 842 return false; |
| 843 } |
| 838 } | 844 } |
| 839 | 845 |
| 840 frame()->document()->updateLayoutTreeIfNeeded(); | 846 frame()->document()->updateLayoutTreeIfNeeded(); |
| 841 | 847 |
| 842 FrameHost* host = frame()->host(); | 848 FrameHost* host = frame()->host(); |
| 843 if (!host) | 849 if (!host) |
| 844 return false; | 850 return false; |
| 845 | 851 |
| 846 if (frame()->document()->isSandboxed(SandboxModals)) { | |
| 847 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | |
| 848 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | |
| 849 return false; | |
| 850 } | |
| 851 | |
| 852 return host->chromeClient().openJavaScriptConfirm(frame(), message); | 852 return host->chromeClient().openJavaScriptConfirm(frame(), message); |
| 853 } | 853 } |
| 854 | 854 |
| 855 String LocalDOMWindow::prompt(const String& message, const String& defaultValue) | 855 String LocalDOMWindow::prompt(const String& message, const String& defaultValue) |
| 856 { | 856 { |
| 857 if (!frame()) | 857 if (!frame()) |
| 858 return String(); | 858 return String(); |
| 859 | 859 |
| 860 if (frame()->document()->isSandboxed(SandboxModals)) { | 860 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 861 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 861 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 862 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) | 862 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 863 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'prompt()'. The document is sandboxed,
and the 'allow-modals' keyword is not set.")); |
| 863 return String(); | 864 return String(); |
| 865 } |
| 864 } | 866 } |
| 865 | 867 |
| 866 frame()->document()->updateLayoutTreeIfNeeded(); | 868 frame()->document()->updateLayoutTreeIfNeeded(); |
| 867 | 869 |
| 868 FrameHost* host = frame()->host(); | 870 FrameHost* host = frame()->host(); |
| 869 if (!host) | 871 if (!host) |
| 870 return String(); | 872 return String(); |
| 871 | 873 |
| 872 String returnValue; | 874 String returnValue; |
| 873 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue
, returnValue)) | 875 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue
, returnValue)) |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 DOMWindow::trace(visitor); | 1505 DOMWindow::trace(visitor); |
| 1504 DOMWindowLifecycleNotifier::trace(visitor); | 1506 DOMWindowLifecycleNotifier::trace(visitor); |
| 1505 } | 1507 } |
| 1506 | 1508 |
| 1507 LocalFrame* LocalDOMWindow::frame() const | 1509 LocalFrame* LocalDOMWindow::frame() const |
| 1508 { | 1510 { |
| 1509 return m_frameObserver->frame(); | 1511 return m_frameObserver->frame(); |
| 1510 } | 1512 } |
| 1511 | 1513 |
| 1512 } // namespace blink | 1514 } // namespace blink |
| OLD | NEW |