Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/frame/WebKitPoint.h" 73 #include "core/frame/WebKitPoint.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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta ckTrace()); 899 dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta ckTrace());
899 m_postMessageTimers.remove(timer); 900 m_postMessageTimers.remove(timer);
900 } 901 }
901 902
902 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip tCallStack> stackTrace) 903 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip tCallStack> stackTrace)
903 { 904 {
904 if (intendedTargetOrigin) { 905 if (intendedTargetOrigin) {
905 // Check target origin now since the target document may have changed si nce the timer was scheduled. 906 // Check target origin now since the target document may have changed si nce the timer was scheduled.
906 if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig in())) { 907 if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig in())) {
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() + "')."); 908 String message = ExceptionMessages::failedToExecute("postMessage", " DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() + "') does not match the recipient window's origin ('" + document()->securityOrig in()->toString() + "').");
908 frameConsole()->addMessage(SecurityMessageSource, ErrorMessageLevel, message, stackTrace); 909 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(Secur ityMessageSource, ErrorMessageLevel, message);
910 consoleMessage->setCallStack(stackTrace);
911 frameConsole()->addMessage(consoleMessage.release());
909 return; 912 return;
910 } 913 }
911 } 914 }
912 915
913 dispatchEvent(event); 916 dispatchEvent(event);
914 } 917 }
915 918
916 DOMSelection* LocalDOMWindow::getSelection() 919 DOMSelection* LocalDOMWindow::getSelection()
917 { 920 {
918 if (!isCurrentlyDisplayedInFrame() || !m_frame) 921 if (!isCurrentlyDisplayedInFrame() || !m_frame)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 return; 981 return;
979 982
980 if (!activeDocument->canNavigate(*m_frame)) 983 if (!activeDocument->canNavigate(*m_frame))
981 return; 984 return;
982 } 985 }
983 986
984 Settings* settings = m_frame->settings(); 987 Settings* settings = m_frame->settings();
985 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows(); 988 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows();
986 989
987 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1 || allowScriptsToCloseWindows)) { 990 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1 || allowScriptsToCloseWindows)) {
988 frameConsole()->addMessage(JSMessageSource, WarningMessageLevel, "Script s may close only the windows that were opened by it."); 991 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni ngMessageLevel, "Scripts may close only the windows that were opened by it."));
989 return; 992 return;
990 } 993 }
991 994
992 if (!m_frame->loader().shouldClose()) 995 if (!m_frame->loader().shouldClose())
993 return; 996 return;
994 997
995 page->chrome().closeWindowSoon(); 998 page->chrome().closeWindowSoon();
996 } 999 }
997 1000
998 void LocalDOMWindow::print() 1001 void LocalDOMWindow::print()
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 } 1725 }
1723 1726
1724 void LocalDOMWindow::printErrorMessage(const String& message) 1727 void LocalDOMWindow::printErrorMessage(const String& message)
1725 { 1728 {
1726 if (!isCurrentlyDisplayedInFrame()) 1729 if (!isCurrentlyDisplayedInFrame())
1727 return; 1730 return;
1728 1731
1729 if (message.isEmpty()) 1732 if (message.isEmpty())
1730 return; 1733 return;
1731 1734
1732 frameConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message); 1735 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, ErrorMess ageLevel, message));
1733 } 1736 }
1734 1737
1735 // FIXME: Once we're throwing exceptions for cross-origin access violations, we will always sanitize the target 1738 // FIXME: Once we're throwing exceptions for cross-origin access violations, we will always sanitize the target
1736 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with this method after considering 1739 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with this method after considering
1737 // exactly which details may be exposed to JavaScript. 1740 // exactly which details may be exposed to JavaScript.
1738 // 1741 //
1739 // http://crbug.com/17325 1742 // http://crbug.com/17325
1740 String LocalDOMWindow::sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* ca llingWindow) 1743 String LocalDOMWindow::sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* ca llingWindow)
1741 { 1744 {
1742 if (!callingWindow || !callingWindow->document()) 1745 if (!callingWindow || !callingWindow->document())
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 visitor->trace(m_localStorage); 1957 visitor->trace(m_localStorage);
1955 visitor->trace(m_applicationCache); 1958 visitor->trace(m_applicationCache);
1956 visitor->trace(m_performance); 1959 visitor->trace(m_performance);
1957 visitor->trace(m_css); 1960 visitor->trace(m_css);
1958 visitor->trace(m_eventQueue); 1961 visitor->trace(m_eventQueue);
1959 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); 1962 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor);
1960 EventTargetWithInlineData::trace(visitor); 1963 EventTargetWithInlineData::trace(visitor);
1961 } 1964 }
1962 1965
1963 } // namespace blink 1966 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698