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

Unified Diff: Source/core/frame/FrameConsole.cpp

Issue 644073003: Fixing crash with sig: blink::FrameConsole::addMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/FrameConsole.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameConsole.cpp
diff --git a/Source/core/frame/FrameConsole.cpp b/Source/core/frame/FrameConsole.cpp
index c3e2ab9b2634a0a2ef0477c04abf128c653a7d70..861e5aacf33a3a3b9828b3b2de7a75202343b176 100644
--- a/Source/core/frame/FrameConsole.cpp
+++ b/Source/core/frame/FrameConsole.cpp
@@ -85,6 +85,8 @@ void FrameConsole::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleM
ExecutionContext* context = frame().document();
if (!context)
return;
+ if (!messageStorage())
+ return;
String messageURL;
unsigned lineNumber = 0;
@@ -165,24 +167,32 @@ void FrameConsole::unmute()
ConsoleMessageStorage* FrameConsole::messageStorage()
{
- ASSERT(m_frame->page());
- return &m_frame->page()->frameHost().consoleMessageStorage();
+ if (!m_frame->host())
+ return nullptr;
+ return &m_frame->host()->consoleMessageStorage();
}
void FrameConsole::clearMessages()
{
- messageStorage()->clear();
+ ConsoleMessageStorage* storage = messageStorage();
+ if (storage)
+ storage->clear();
}
void FrameConsole::adoptWorkerMessagesAfterTermination(WorkerGlobalScopeProxy* proxy)
{
- messageStorage()->adoptWorkerMessagesAfterTermination(proxy);
+ ConsoleMessageStorage* storage = messageStorage();
+ if (storage)
+ storage->adoptWorkerMessagesAfterTermination(proxy);
}
void FrameConsole::didFailLoading(unsigned long requestIdentifier, const ResourceError& error)
{
if (error.isCancellation()) // Report failures only.
return;
+ ConsoleMessageStorage* storage = messageStorage();
+ if (!storage)
+ return;
StringBuilder message;
message.appendLiteral("Failed to load resource");
if (!error.localizedDescription().isEmpty()) {
@@ -191,13 +201,12 @@ void FrameConsole::didFailLoading(unsigned long requestIdentifier, const Resourc
}
RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(NetworkMessageSource, ErrorMessageLevel, message.toString(), error.failingURL());
consoleMessage->setRequestIdentifier(requestIdentifier);
- messageStorage()->reportMessage(consoleMessage.release());
+ storage->reportMessage(consoleMessage.release());
}
void FrameConsole::trace(Visitor* visitor)
{
visitor->trace(m_frame);
- visitor->trace(m_consoleMessageStorage);
}
} // namespace blink
« no previous file with comments | « Source/core/frame/FrameConsole.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698