| 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 746 |
| 747 if (frame()->document()->isSandboxed(SandboxModals)) { | 747 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 748 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 748 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 749 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { | 749 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 750 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'print()'. The document is sandboxed, a
nd the 'allow-modals' keyword is not set.")); | 750 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'print()'. The document is sandboxed, a
nd the 'allow-modals' keyword is not set.")); |
| 751 return; | 751 return; |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 | 754 |
| 755 if (scriptState && v8::MicrotasksScope::IsRunningMicrotasks(scriptState->iso
late())) { | 755 if (scriptState && v8::MicrotasksScope::IsRunningMicrotasks(scriptState->iso
late())) { |
| 756 Deprecation::countDeprecation(frame()->document(), UseCounter::During_Mi
crotask_Print); | 756 UseCounter::count(frame()->document(), UseCounter::During_Microtask_Prin
t); |
| 757 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable
d()) { | |
| 758 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'print()' during microtask execution.")
); | |
| 759 return; | |
| 760 } | |
| 761 } | 757 } |
| 762 | 758 |
| 763 if (frame()->isLoading()) { | 759 if (frame()->isLoading()) { |
| 764 m_shouldPrintWhenFinishedLoading = true; | 760 m_shouldPrintWhenFinishedLoading = true; |
| 765 return; | 761 return; |
| 766 } | 762 } |
| 767 m_shouldPrintWhenFinishedLoading = false; | 763 m_shouldPrintWhenFinishedLoading = false; |
| 768 host->chromeClient().print(frame()); | 764 host->chromeClient().print(frame()); |
| 769 } | 765 } |
| 770 | 766 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 782 | 778 |
| 783 if (frame()->document()->isSandboxed(SandboxModals)) { | 779 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 784 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 780 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 785 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { | 781 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 786 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'alert()'. The document is sandboxed, a
nd the 'allow-modals' keyword is not set.")); | 782 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'alert()'. The document is sandboxed, a
nd the 'allow-modals' keyword is not set.")); |
| 787 return; | 783 return; |
| 788 } | 784 } |
| 789 } | 785 } |
| 790 | 786 |
| 791 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { | 787 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { |
| 792 Deprecation::countDeprecation(frame()->document(), UseCounter::During_Mi
crotask_Alert); | 788 UseCounter::count(frame()->document(), UseCounter::During_Microtask_Aler
t); |
| 793 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable
d()) { | |
| 794 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'alert()' during microtask execution.")
); | |
| 795 return; | |
| 796 } | |
| 797 } | 789 } |
| 798 | 790 |
| 799 frame()->document()->updateStyleAndLayoutTree(); | 791 frame()->document()->updateStyleAndLayoutTree(); |
| 800 | 792 |
| 801 FrameHost* host = frame()->host(); | 793 FrameHost* host = frame()->host(); |
| 802 if (!host) | 794 if (!host) |
| 803 return; | 795 return; |
| 804 | 796 |
| 805 host->chromeClient().openJavaScriptAlert(frame(), message); | 797 host->chromeClient().openJavaScriptAlert(frame(), message); |
| 806 } | 798 } |
| 807 | 799 |
| 808 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message) | 800 bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message) |
| 809 { | 801 { |
| 810 if (!frame()) | 802 if (!frame()) |
| 811 return false; | 803 return false; |
| 812 | 804 |
| 813 if (frame()->document()->isSandboxed(SandboxModals)) { | 805 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 814 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 806 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 815 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { | 807 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 816 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'confirm()'. The document is sandboxed,
and the 'allow-modals' keyword is not set.")); | 808 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'confirm()'. The document is sandboxed,
and the 'allow-modals' keyword is not set.")); |
| 817 return false; | 809 return false; |
| 818 } | 810 } |
| 819 } | 811 } |
| 820 | 812 |
| 821 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { | 813 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { |
| 822 Deprecation::countDeprecation(frame()->document(), UseCounter::During_Mi
crotask_Confirm); | 814 UseCounter::count(frame()->document(), UseCounter::During_Microtask_Conf
irm); |
| 823 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable
d()) { | |
| 824 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'confirm()' during microtask execution.
")); | |
| 825 return false; | |
| 826 } | |
| 827 } | 815 } |
| 828 | 816 |
| 829 frame()->document()->updateStyleAndLayoutTree(); | 817 frame()->document()->updateStyleAndLayoutTree(); |
| 830 | 818 |
| 831 FrameHost* host = frame()->host(); | 819 FrameHost* host = frame()->host(); |
| 832 if (!host) | 820 if (!host) |
| 833 return false; | 821 return false; |
| 834 | 822 |
| 835 return host->chromeClient().openJavaScriptConfirm(frame(), message); | 823 return host->chromeClient().openJavaScriptConfirm(frame(), message); |
| 836 } | 824 } |
| 837 | 825 |
| 838 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c
onst String& defaultValue) | 826 String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, c
onst String& defaultValue) |
| 839 { | 827 { |
| 840 if (!frame()) | 828 if (!frame()) |
| 841 return String(); | 829 return String(); |
| 842 | 830 |
| 843 if (frame()->document()->isSandboxed(SandboxModals)) { | 831 if (frame()->document()->isSandboxed(SandboxModals)) { |
| 844 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); | 832 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont
ext); |
| 845 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { | 833 if (RuntimeEnabledFeatures::sandboxBlocksModalsEnabled()) { |
| 846 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'prompt()'. The document is sandboxed,
and the 'allow-modals' keyword is not set.")); | 834 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'prompt()'. The document is sandboxed,
and the 'allow-modals' keyword is not set.")); |
| 847 return String(); | 835 return String(); |
| 848 } | 836 } |
| 849 } | 837 } |
| 850 | 838 |
| 851 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { | 839 if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) { |
| 852 Deprecation::countDeprecation(frame()->document(), UseCounter::During_Mi
crotask_Prompt); | 840 UseCounter::count(frame()->document(), UseCounter::During_Microtask_Prom
pt); |
| 853 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable
d()) { | |
| 854 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, "Ignored call to 'prompt()' during microtask execution."
)); | |
| 855 return String(); | |
| 856 } | |
| 857 } | 841 } |
| 858 | 842 |
| 859 frame()->document()->updateStyleAndLayoutTree(); | 843 frame()->document()->updateStyleAndLayoutTree(); |
| 860 | 844 |
| 861 FrameHost* host = frame()->host(); | 845 FrameHost* host = frame()->host(); |
| 862 if (!host) | 846 if (!host) |
| 863 return String(); | 847 return String(); |
| 864 | 848 |
| 865 String returnValue; | 849 String returnValue; |
| 866 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue
, returnValue)) | 850 if (host->chromeClient().openJavaScriptPrompt(frame(), message, defaultValue
, returnValue)) |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 { | 1537 { |
| 1554 // If the LocalDOMWindow still has a frame reference, that frame must point | 1538 // 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 | 1539 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
| 1556 // where script execution leaks between different LocalDOMWindows. | 1540 // where script execution leaks between different LocalDOMWindows. |
| 1557 if (m_frameObserver->frame()) | 1541 if (m_frameObserver->frame()) |
| 1558 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1542 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
| 1559 return m_frameObserver->frame(); | 1543 return m_frameObserver->frame(); |
| 1560 } | 1544 } |
| 1561 | 1545 |
| 1562 } // namespace blink | 1546 } // namespace blink |
| OLD | NEW |