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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "core/frame/FrameConsole.h" | 65 #include "core/frame/FrameConsole.h" |
66 #include "core/frame/FrameHost.h" | 66 #include "core/frame/FrameHost.h" |
67 #include "core/frame/FrameView.h" | 67 #include "core/frame/FrameView.h" |
68 #include "core/frame/History.h" | 68 #include "core/frame/History.h" |
69 #include "core/frame/LocalFrame.h" | 69 #include "core/frame/LocalFrame.h" |
70 #include "core/frame/Location.h" | 70 #include "core/frame/Location.h" |
71 #include "core/frame/Navigator.h" | 71 #include "core/frame/Navigator.h" |
72 #include "core/frame/Screen.h" | 72 #include "core/frame/Screen.h" |
73 #include "core/frame/Settings.h" | 73 #include "core/frame/Settings.h" |
74 #include "core/html/HTMLFrameOwnerElement.h" | 74 #include "core/html/HTMLFrameOwnerElement.h" |
| 75 #include "core/inspector/ConsoleMessage.h" |
75 #include "core/inspector/InspectorInstrumentation.h" | 76 #include "core/inspector/InspectorInstrumentation.h" |
76 #include "core/inspector/InspectorTraceEvents.h" | 77 #include "core/inspector/InspectorTraceEvents.h" |
77 #include "core/inspector/ScriptCallStack.h" | 78 #include "core/inspector/ScriptCallStack.h" |
78 #include "core/loader/DocumentLoader.h" | 79 #include "core/loader/DocumentLoader.h" |
79 #include "core/loader/FrameLoadRequest.h" | 80 #include "core/loader/FrameLoadRequest.h" |
80 #include "core/loader/FrameLoader.h" | 81 #include "core/loader/FrameLoader.h" |
81 #include "core/loader/FrameLoaderClient.h" | 82 #include "core/loader/FrameLoaderClient.h" |
82 #include "core/loader/MixedContentChecker.h" | 83 #include "core/loader/MixedContentChecker.h" |
83 #include "core/loader/SinkDocument.h" | 84 #include "core/loader/SinkDocument.h" |
84 #include "core/loader/appcache/ApplicationCache.h" | 85 #include "core/loader/appcache/ApplicationCache.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 event->entangleMessagePorts(document()); | 883 event->entangleMessagePorts(document()); |
883 dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta
ckTrace()); | 884 dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta
ckTrace()); |
884 } | 885 } |
885 | 886 |
886 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip
tCallStack> stackTrace) | 887 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip
tCallStack> stackTrace) |
887 { | 888 { |
888 if (intendedTargetOrigin) { | 889 if (intendedTargetOrigin) { |
889 // Check target origin now since the target document may have changed si
nce the timer was scheduled. | 890 // Check target origin now since the target document may have changed si
nce the timer was scheduled. |
890 if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig
in())) { | 891 if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig
in())) { |
891 String message = ExceptionMessages::failedToExecute("postMessage", "
DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() +
"') does not match the recipient window's origin ('" + document()->securityOrig
in()->toString() + "')."); | 892 String message = ExceptionMessages::failedToExecute("postMessage", "
DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() +
"') does not match the recipient window's origin ('" + document()->securityOrig
in()->toString() + "')."); |
892 frameConsole()->addMessage(SecurityMessageSource, ErrorMessageLevel,
message, stackTrace); | 893 frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSou
rce, ErrorMessageLevel, message, stackTrace)); |
893 return; | 894 return; |
894 } | 895 } |
895 } | 896 } |
896 | 897 |
897 dispatchEvent(event); | 898 dispatchEvent(event); |
898 } | 899 } |
899 | 900 |
900 DOMSelection* LocalDOMWindow::getSelection() | 901 DOMSelection* LocalDOMWindow::getSelection() |
901 { | 902 { |
902 if (!isCurrentlyDisplayedInFrame() || !m_frame) | 903 if (!isCurrentlyDisplayedInFrame() || !m_frame) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 return; | 963 return; |
963 | 964 |
964 if (!activeDocument->canNavigate(*m_frame)) | 965 if (!activeDocument->canNavigate(*m_frame)) |
965 return; | 966 return; |
966 } | 967 } |
967 | 968 |
968 Settings* settings = m_frame->settings(); | 969 Settings* settings = m_frame->settings(); |
969 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); | 970 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); |
970 | 971 |
971 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1
|| allowScriptsToCloseWindows)) { | 972 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1
|| allowScriptsToCloseWindows)) { |
972 frameConsole()->addMessage(JSMessageSource, WarningMessageLevel, "Script
s may close only the windows that were opened by it."); | 973 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Scripts may close only the windows that were opened by it.")); |
973 return; | 974 return; |
974 } | 975 } |
975 | 976 |
976 if (!m_frame->loader().shouldClose()) | 977 if (!m_frame->loader().shouldClose()) |
977 return; | 978 return; |
978 | 979 |
979 page->chrome().closeWindowSoon(); | 980 page->chrome().closeWindowSoon(); |
980 } | 981 } |
981 | 982 |
982 void LocalDOMWindow::print() | 983 void LocalDOMWindow::print() |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 // FIXME: What if activeDocument()->frame() is 0? | 1696 // FIXME: What if activeDocument()->frame() is 0? |
1696 completedURL, Referrer(activeDocument->outgoingReferrer(), activeDocumen
t->referrerPolicy()), | 1697 completedURL, Referrer(activeDocument->outgoingReferrer(), activeDocumen
t->referrerPolicy()), |
1697 locking != LockHistoryBasedOnGestureState); | 1698 locking != LockHistoryBasedOnGestureState); |
1698 } | 1699 } |
1699 | 1700 |
1700 void LocalDOMWindow::printErrorMessage(const String& message) | 1701 void LocalDOMWindow::printErrorMessage(const String& message) |
1701 { | 1702 { |
1702 if (message.isEmpty()) | 1703 if (message.isEmpty()) |
1703 return; | 1704 return; |
1704 | 1705 |
1705 frameConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message); | 1706 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, ErrorMess
ageLevel, message)); |
1706 } | 1707 } |
1707 | 1708 |
1708 // FIXME: Once we're throwing exceptions for cross-origin access violations, we
will always sanitize the target | 1709 // FIXME: Once we're throwing exceptions for cross-origin access violations, we
will always sanitize the target |
1709 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with
this method after considering | 1710 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with
this method after considering |
1710 // exactly which details may be exposed to JavaScript. | 1711 // exactly which details may be exposed to JavaScript. |
1711 // | 1712 // |
1712 // http://crbug.com/17325 | 1713 // http://crbug.com/17325 |
1713 String LocalDOMWindow::sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* ca
llingWindow) | 1714 String LocalDOMWindow::sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* ca
llingWindow) |
1714 { | 1715 { |
1715 if (!callingWindow || !callingWindow->document()) | 1716 if (!callingWindow || !callingWindow->document()) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 visitor->trace(m_localStorage); | 1928 visitor->trace(m_localStorage); |
1928 visitor->trace(m_applicationCache); | 1929 visitor->trace(m_applicationCache); |
1929 visitor->trace(m_performance); | 1930 visitor->trace(m_performance); |
1930 visitor->trace(m_css); | 1931 visitor->trace(m_css); |
1931 visitor->trace(m_eventQueue); | 1932 visitor->trace(m_eventQueue); |
1932 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); | 1933 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); |
1933 EventTargetWithInlineData::trace(visitor); | 1934 EventTargetWithInlineData::trace(visitor); |
1934 } | 1935 } |
1935 | 1936 |
1936 } // namespace WebCore | 1937 } // namespace WebCore |
OLD | NEW |