Diff
Modified: trunk/Source/WebCore/ChangeLog (133052 => 133053)
--- trunk/Source/WebCore/ChangeLog 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/ChangeLog 2012-10-31 18:47:31 UTC (rev 133053)
@@ -1,3 +1,37 @@
+2012-10-31 Mike West <[email protected]>
+
+ Prefer document->addConsoleMessage to document->domWindow->console->addMessage.
+ https://bugs.webkit.org/show_bug.cgi?id=100850
+
+ Reviewed by Adam Barth.
+
+ For historical reasons, a few places in WebCore talk to Console directly
+ via 'document()->domWindow()->console()->addMessage(...)'. This is more
+ safely wrapped by calling 'addConsoleMessage' on the Document itself.
+
+ No visible functionality should change; we'll simply avoid potential
+ null dereferences in the future.
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::validateInteractively):
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore):
+ (WebCore::WebGLRenderingContext::printWarningToConsole):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::reportLocalLoadFailed):
+ * loader/MixedContentChecker.cpp:
+ (WebCore::MixedContentChecker::logWarning):
+ * loader/appcache/ApplicationCacheGroup.cpp:
+ (WebCore::ApplicationCacheGroup::abort):
+ (WebCore::ApplicationCacheGroup::didReceiveResponse):
+ (WebCore::ApplicationCacheGroup::didFinishLoading):
+ (WebCore::ApplicationCacheGroup::didFail):
+ (WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
+ (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
+ (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::printAccessDeniedMessage):
+
2012-10-31 Pavel Feldman <[email protected]>
Web Inspector: frame chooser does not work on subsequent inspector open.
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (133052 => 133053)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2012-10-31 18:47:31 UTC (rev 133053)
@@ -31,6 +31,7 @@
#include "ActiveDOMObject.h"
#include "ConsoleTypes.h"
#include "KURL.h"
+#include "ScriptCallStack.h"
#include "SecurityContext.h"
#include "Supplementable.h"
#include <wtf/Forward.h>
@@ -53,7 +54,6 @@
class EventQueue;
class EventTarget;
class MessagePort;
-class ScriptCallStack;
#if ENABLE(BLOB)
class PublicURLManager;
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (133052 => 133053)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -26,7 +26,6 @@
#include "HTMLFormElement.h"
#include "Attribute.h"
-#include "Console.h"
#include "DOMFormData.h"
#include "DOMWindow.h"
#include "Document.h"
@@ -257,7 +256,7 @@
continue;
String message("An invalid form control with name='%name' is not focusable.");
message.replace("%name", unhandledAssociatedElement->name());
- document()->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, message, document()->url().string());
+ document()->addConsoleMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, message, document()->url().string());
}
}
return false;
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (133052 => 133053)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -31,7 +31,6 @@
#include "CachedImage.h"
#include "CheckedInt.h"
-#include "Console.h"
#include "DOMWindow.h"
#include "EXTTextureFilterAnisotropic.h"
#include "ExceptionCode.h"
@@ -5207,20 +5206,10 @@
{
if (!canvas())
return;
- // FIXME: This giant cascade of null checks seems a bit paranoid.
Document* document = canvas()->document();
if (!document)
return;
- Frame* frame = document->frame();
- if (!frame)
- return;
- DOMWindow* window = document->domWindow();
- if (!window)
- return;
- Console* console = window->console();
- if (!console)
- return;
- console->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message, document->url().string());
+ document->addConsoleMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message, document->url().string());
}
bool WebGLRenderingContext::validateFramebufferFuncParameters(const char* functionName, GC3Denum target, GC3Denum attachment)
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (133052 => 133053)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -1392,7 +1392,7 @@
if (!frame)
return;
- frame->document()->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url);
+ frame->document()->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url);
}
const ResourceRequest& FrameLoader::initialRequest() const
Modified: trunk/Source/WebCore/loader/MixedContentChecker.cpp (133052 => 133053)
--- trunk/Source/WebCore/loader/MixedContentChecker.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/loader/MixedContentChecker.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -98,11 +98,10 @@
void MixedContentChecker::logWarning(bool allowed, const String& action, const KURL& target) const
{
- Console* console = m_frame->document()->domWindow()->console();
// FIXME: Why does this message not have a source URL or a line number? webkit.org/b/97979
String message = String::format("%sThe page at %s %s insecure content from %s.\n",
(allowed ? "" : "[blocked] "), asUTF8(m_frame->document()->url()).data(), action.utf8().data(), asUTF8(target).data());
- console->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message);
+ m_frame->document()->addConsoleMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (133052 => 133053)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -474,7 +474,7 @@
if (m_completionType != None)
return;
- frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, TipMessageLevel, "Application Cache download process was aborted.");
+ frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, TipMessageLevel, "Application Cache download process was aborted.");
cacheUpdateFailed();
}
@@ -568,7 +568,7 @@
if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->firstRequest().url()) {
if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + m_currentHandle->firstRequest().url().string() +
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + m_currentHandle->firstRequest().url().string() +
((response.httpStatusCode() / 100 != 2) ? " could not be fetched." : " was redirected."));
// Note that cacheUpdateFailed() can cause the cache group to be deleted.
cacheUpdateFailed();
@@ -645,7 +645,7 @@
// FIXME: Should we break earlier and prevent redownloading on later page loads?
if (m_originQuotaExceededPreviously && m_availableSpaceInQuota < m_cacheBeingUpdated->estimatedSizeInStorage()) {
m_currentResource = 0;
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
cacheUpdateFailed();
return;
}
@@ -678,7 +678,7 @@
m_pendingEntries.remove(url);
if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + url.string() + " could not be fetched.");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + url.string() + " could not be fetched.");
// Note that cacheUpdateFailed() can cause the cache group to be deleted.
cacheUpdateFailed();
} else {
@@ -707,13 +707,13 @@
return;
if (response.httpStatusCode() / 100 != 2) {
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched.");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched.");
cacheUpdateFailed();
return;
}
if (response.url() != m_manifestHandle->firstRequest().url()) {
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched, because a redirection was attempted.");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched, because a redirection was attempted.");
cacheUpdateFailed();
return;
}
@@ -733,7 +733,7 @@
if (!isUpgradeAttempt && !m_manifestResource) {
// The server returned 304 Not Modified even though we didn't send a conditional request.
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched because of an unexpected 304 Not Modified server response.");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched because of an unexpected 304 Not Modified server response.");
cacheUpdateFailed();
return;
}
@@ -759,7 +759,7 @@
Manifest manifest;
if (!parseManifest(m_manifestURL, m_manifestResource->data()->data(), m_manifestResource->data()->size(), manifest)) {
// At the time of this writing, lack of "CACHE MANIFEST" signature is the only reason for parseManifest to fail.
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?");
cacheUpdateFailed();
return;
}
@@ -948,7 +948,7 @@
// We ran out of space for this origin. Fall down to the normal error handling
// after recording this state.
m_originQuotaExceededPreviously = true;
- m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
+ m_frame->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
}
if (failureReason == ApplicationCacheStorage::TotalQuotaReached && !m_calledReachedMaxAppCacheSize) {
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (133052 => 133053)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -629,7 +629,7 @@
message = "Unsafe attempt to load URL " + url.string() + " from frame with URL " + m_document->url().string() + ". Domains, protocols and ports must match.\n";
// FIXME: provide line number and source URL.
- frame()->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message);
+ frame()->document()->addConsoleMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message);
}
void CachedResourceLoader::setAutoLoadImages(bool enable)
Modified: trunk/Source/WebKit/chromium/ChangeLog (133052 => 133053)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-31 18:47:31 UTC (rev 133053)
@@ -1,3 +1,20 @@
+2012-10-31 Mike West <[email protected]>
+
+ Prefer document->addConsoleMessage to document->domWindow->console->addMessage.
+ https://bugs.webkit.org/show_bug.cgi?id=100850
+
+ Reviewed by Adam Barth.
+
+ For historical reasons, a few places in WebCore talk to Console directly
+ via 'document()->domWindow()->console()->addMessage(...)'. This is more
+ safely wrapped by calling 'addConsoleMessage' on the Document itself.
+
+ No visible functionality should change; we'll simply avoid potential
+ null dereferences in the future.
+
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::addMessageToConsole):
+
2012-10-31 Kent Tamura <[email protected]>
Remove code to hide/reshow text caret for PagePopups
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (133052 => 133053)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-10-31 18:45:45 UTC (rev 133052)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-10-31 18:47:31 UTC (rev 133053)
@@ -859,7 +859,7 @@
return;
}
- frame()->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text);
+ frame()->document()->addConsoleMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text);
}
void WebFrameImpl::collectGarbage()