| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "core/frame/FrameConsole.h" | 64 #include "core/frame/FrameConsole.h" |
| 65 #include "core/frame/FrameHost.h" | 65 #include "core/frame/FrameHost.h" |
| 66 #include "core/frame/FrameView.h" | 66 #include "core/frame/FrameView.h" |
| 67 #include "core/frame/History.h" | 67 #include "core/frame/History.h" |
| 68 #include "core/frame/LocalFrame.h" | 68 #include "core/frame/LocalFrame.h" |
| 69 #include "core/frame/Location.h" | 69 #include "core/frame/Location.h" |
| 70 #include "core/frame/Navigator.h" | 70 #include "core/frame/Navigator.h" |
| 71 #include "core/frame/Screen.h" | 71 #include "core/frame/Screen.h" |
| 72 #include "core/frame/Settings.h" | 72 #include "core/frame/Settings.h" |
| 73 #include "core/html/HTMLFrameOwnerElement.h" | 73 #include "core/html/HTMLFrameOwnerElement.h" |
| 74 #include "core/inspector/ConsoleMessage.h" |
| 74 #include "core/inspector/InspectorInstrumentation.h" | 75 #include "core/inspector/InspectorInstrumentation.h" |
| 75 #include "core/inspector/InspectorTraceEvents.h" | 76 #include "core/inspector/InspectorTraceEvents.h" |
| 76 #include "core/inspector/ScriptCallStack.h" | 77 #include "core/inspector/ScriptCallStack.h" |
| 77 #include "core/loader/DocumentLoader.h" | 78 #include "core/loader/DocumentLoader.h" |
| 78 #include "core/loader/FrameLoadRequest.h" | 79 #include "core/loader/FrameLoadRequest.h" |
| 79 #include "core/loader/FrameLoader.h" | 80 #include "core/loader/FrameLoader.h" |
| 80 #include "core/loader/FrameLoaderClient.h" | 81 #include "core/loader/FrameLoaderClient.h" |
| 81 #include "core/loader/MixedContentChecker.h" | 82 #include "core/loader/MixedContentChecker.h" |
| 82 #include "core/loader/SinkDocument.h" | 83 #include "core/loader/SinkDocument.h" |
| 83 #include "core/loader/appcache/ApplicationCache.h" | 84 #include "core/loader/appcache/ApplicationCache.h" |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta
ckTrace()); | 898 dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta
ckTrace()); |
| 898 m_postMessageTimers.remove(timer); | 899 m_postMessageTimers.remove(timer); |
| 899 } | 900 } |
| 900 | 901 |
| 901 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip
tCallStack> stackTrace) | 902 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip
tCallStack> stackTrace) |
| 902 { | 903 { |
| 903 if (intendedTargetOrigin) { | 904 if (intendedTargetOrigin) { |
| 904 // Check target origin now since the target document may have changed si
nce the timer was scheduled. | 905 // Check target origin now since the target document may have changed si
nce the timer was scheduled. |
| 905 if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig
in())) { | 906 if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig
in())) { |
| 906 String message = ExceptionMessages::failedToExecute("postMessage", "
DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() +
"') does not match the recipient window's origin ('" + document()->securityOrig
in()->toString() + "')."); | 907 String message = ExceptionMessages::failedToExecute("postMessage", "
DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() +
"') does not match the recipient window's origin ('" + document()->securityOrig
in()->toString() + "')."); |
| 907 frameConsole()->addMessage(SecurityMessageSource, ErrorMessageLevel,
message, stackTrace); | 908 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(Secur
ityMessageSource, ErrorMessageLevel, message); |
| 909 consoleMessage->setCallStack(stackTrace); |
| 910 frameConsole()->addMessage(consoleMessage.release()); |
| 908 return; | 911 return; |
| 909 } | 912 } |
| 910 } | 913 } |
| 911 | 914 |
| 912 dispatchEvent(event); | 915 dispatchEvent(event); |
| 913 } | 916 } |
| 914 | 917 |
| 915 DOMSelection* LocalDOMWindow::getSelection() | 918 DOMSelection* LocalDOMWindow::getSelection() |
| 916 { | 919 { |
| 917 if (!isCurrentlyDisplayedInFrame() || !m_frame) | 920 if (!isCurrentlyDisplayedInFrame() || !m_frame) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 return; | 980 return; |
| 978 | 981 |
| 979 if (!activeDocument->canNavigate(*m_frame)) | 982 if (!activeDocument->canNavigate(*m_frame)) |
| 980 return; | 983 return; |
| 981 } | 984 } |
| 982 | 985 |
| 983 Settings* settings = m_frame->settings(); | 986 Settings* settings = m_frame->settings(); |
| 984 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); | 987 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); |
| 985 | 988 |
| 986 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1
|| allowScriptsToCloseWindows)) { | 989 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1
|| allowScriptsToCloseWindows)) { |
| 987 frameConsole()->addMessage(JSMessageSource, WarningMessageLevel, "Script
s may close only the windows that were opened by it."); | 990 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Scripts may close only the windows that were opened by it.")); |
| 988 return; | 991 return; |
| 989 } | 992 } |
| 990 | 993 |
| 991 if (!m_frame->loader().shouldClose()) | 994 if (!m_frame->loader().shouldClose()) |
| 992 return; | 995 return; |
| 993 | 996 |
| 994 InspectorInstrumentation::willCloseWindow(context); | 997 InspectorInstrumentation::willCloseWindow(context); |
| 995 | 998 |
| 996 page->chrome().closeWindowSoon(); | 999 page->chrome().closeWindowSoon(); |
| 997 } | 1000 } |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 } | 1696 } |
| 1694 | 1697 |
| 1695 void LocalDOMWindow::printErrorMessage(const String& message) | 1698 void LocalDOMWindow::printErrorMessage(const String& message) |
| 1696 { | 1699 { |
| 1697 if (!isCurrentlyDisplayedInFrame()) | 1700 if (!isCurrentlyDisplayedInFrame()) |
| 1698 return; | 1701 return; |
| 1699 | 1702 |
| 1700 if (message.isEmpty()) | 1703 if (message.isEmpty()) |
| 1701 return; | 1704 return; |
| 1702 | 1705 |
| 1703 frameConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message); | 1706 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, ErrorMess
ageLevel, message)); |
| 1704 } | 1707 } |
| 1705 | 1708 |
| 1706 // 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 |
| 1707 // 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 |
| 1708 // exactly which details may be exposed to JavaScript. | 1711 // exactly which details may be exposed to JavaScript. |
| 1709 // | 1712 // |
| 1710 // http://crbug.com/17325 | 1713 // http://crbug.com/17325 |
| 1711 String LocalDOMWindow::sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* ca
llingWindow) | 1714 String LocalDOMWindow::sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* ca
llingWindow) |
| 1712 { | 1715 { |
| 1713 if (!callingWindow || !callingWindow->document()) | 1716 if (!callingWindow || !callingWindow->document()) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 visitor->trace(m_localStorage); | 1928 visitor->trace(m_localStorage); |
| 1926 visitor->trace(m_applicationCache); | 1929 visitor->trace(m_applicationCache); |
| 1927 visitor->trace(m_performance); | 1930 visitor->trace(m_performance); |
| 1928 visitor->trace(m_css); | 1931 visitor->trace(m_css); |
| 1929 visitor->trace(m_eventQueue); | 1932 visitor->trace(m_eventQueue); |
| 1930 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); | 1933 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); |
| 1931 EventTargetWithInlineData::trace(visitor); | 1934 EventTargetWithInlineData::trace(visitor); |
| 1932 } | 1935 } |
| 1933 | 1936 |
| 1934 } // namespace blink | 1937 } // namespace blink |
| OLD | NEW |