Introduce new message sources for logging.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2013 18:55:52 +0000 (18:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2013 18:55:52 +0000 (18:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110968

Patch by Dmitry Zvorygin <zvorygin@chromium.org> on 2013-03-06
Reviewed by Pavel Feldman.

Source/WebCore:

Added SecurityMessageSource, RenderingMessageSource, StorageMessageSource, AppCacheMessageSource, CSSMessageSource.
Changed some logging lines to contain more descriptive message source.

* Modules/webdatabase/DatabaseBase.cpp:
(WebCore::DatabaseBase::logErrorMessage):
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::logErrorMessage):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::fail):
* bindings/ScriptControllerBase.cpp:
(WebCore::ScriptController::canExecuteScripts):
* css/MediaList.cpp:
(WebCore::addResolutionWarningMessageToConsole):
* dom/Document.cpp:
(WebCore::Document::processHttpEquiv):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeScript):
(WebCore::ScriptElement::notifyFinished):
* dom/ViewportArguments.cpp:
(WebCore::reportViewportWarning):
* html/HTMLFormControlElement.cpp:
(WebCore::shouldAutofocus):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::validateInteractively):
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::parseAttribute):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::getImageData):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::printWarningToConsole):
* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::init):
* html/parser/XSSAuditorDelegate.cpp:
(WebCore::XSSAuditorDelegate::didBlockScript):
* inspector/ConsoleMessage.cpp:
(WebCore::messageSourceValue):
* inspector/Inspector.json:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::submitForm):
(WebCore::FrameLoader::reportLocalLoadFailed):
(WebCore::createWindow):
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::notifyFinished):
* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::responseReceived):
* loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::logWarning):
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::corsPolicyPreventedLoad):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::abort):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::printAccessDeniedMessage):
* page/Console.cpp:
(WebCore::printMessageSourceAndLevelPrefix):
* page/ConsoleTypes.h:
* page/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::logToConsole):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchMessageEventWithOriginCheck):
* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):
* svg/SVGDocumentExtensions.cpp:
(WebCore::reportMessage):

Source/WebKit/mac:

* WebCoreSupport/WebChromeClient.mm:
* WebView/WebUIDelegatePrivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144949 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseBase.cpp
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
Source/WebCore/Modules/websockets/WebSocketChannel.cpp
Source/WebCore/bindings/ScriptControllerBase.cpp
Source/WebCore/css/MediaList.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/dom/ViewportArguments.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLIFrameElement.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/parser/XSSAuditor.cpp
Source/WebCore/html/parser/XSSAuditorDelegate.cpp
Source/WebCore/inspector/ConsoleMessage.cpp
Source/WebCore/inspector/Inspector.json
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ImageLoader.cpp
Source/WebCore/loader/MainResourceLoader.cpp
Source/WebCore/loader/MixedContentChecker.cpp
Source/WebCore/loader/TextTrackLoader.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/page/Console.cpp
Source/WebCore/page/ConsoleTypes.h
Source/WebCore/page/ContentSecurityPolicy.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/PointerLockController.cpp
Source/WebCore/svg/SVGDocumentExtensions.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebView/WebUIDelegatePrivate.h

index d01a991..250c7b8 100644 (file)
@@ -1,3 +1,76 @@
+2013-03-06  Dmitry Zvorygin  <zvorygin@chromium.org>
+
+        Introduce new message sources for logging.
+        https://bugs.webkit.org/show_bug.cgi?id=110968
+
+        Reviewed by Pavel Feldman.
+
+        Added SecurityMessageSource, RenderingMessageSource, StorageMessageSource, AppCacheMessageSource, CSSMessageSource.
+        Changed some logging lines to contain more descriptive message source.
+
+        * Modules/webdatabase/DatabaseBase.cpp:
+        (WebCore::DatabaseBase::logErrorMessage):
+        * Modules/webdatabase/DatabaseManager.cpp:
+        (WebCore::DatabaseManager::logErrorMessage):
+        * Modules/websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::fail):
+        * bindings/ScriptControllerBase.cpp:
+        (WebCore::ScriptController::canExecuteScripts):
+        * css/MediaList.cpp:
+        (WebCore::addResolutionWarningMessageToConsole):
+        * dom/Document.cpp:
+        (WebCore::Document::processHttpEquiv):
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::executeScript):
+        (WebCore::ScriptElement::notifyFinished):
+        * dom/ViewportArguments.cpp:
+        (WebCore::reportViewportWarning):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::shouldAutofocus):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::validateInteractively):
+        * html/HTMLIFrameElement.cpp:
+        (WebCore::HTMLIFrameElement::parseAttribute):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::getImageData):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::printWarningToConsole):
+        * html/parser/XSSAuditor.cpp:
+        (WebCore::XSSAuditor::init):
+        * html/parser/XSSAuditorDelegate.cpp:
+        (WebCore::XSSAuditorDelegate::didBlockScript):
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::messageSourceValue):
+        * inspector/Inspector.json:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::submitForm):
+        (WebCore::FrameLoader::reportLocalLoadFailed):
+        (WebCore::createWindow):
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::notifyFinished):
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::responseReceived):
+        * loader/MixedContentChecker.cpp:
+        (WebCore::MixedContentChecker::logWarning):
+        * loader/TextTrackLoader.cpp:
+        (WebCore::TextTrackLoader::corsPolicyPreventedLoad):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::abort):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::printAccessDeniedMessage):
+        * page/Console.cpp:
+        (WebCore::printMessageSourceAndLevelPrefix):
+        * page/ConsoleTypes.h:
+        * page/ContentSecurityPolicy.cpp:
+        (WebCore::ContentSecurityPolicy::logToConsole):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::dispatchMessageEventWithOriginCheck):
+        * page/PointerLockController.cpp:
+        (WebCore::PointerLockController::requestPointerLock):
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::reportMessage):
+
 2013-03-06  Florin Malita  <fmalita@chromium.org>
 
         SVG pattern to pattern reference does not work if first pattern has a child node
index f37111b..af2377a 100644 (file)
@@ -46,7 +46,7 @@ ScriptExecutionContext* DatabaseBase::scriptExecutionContext() const
 
 void DatabaseBase::logErrorMessage(const String& message)
 {
-    m_scriptExecutionContext->addConsoleMessage(OtherMessageSource, ErrorMessageLevel, message);
+    m_scriptExecutionContext->addConsoleMessage(StorageMessageSource, ErrorMessageLevel, message);
 }
 
 } // namespace WebCore
index 34eda2a..878f8b7 100644 (file)
@@ -430,7 +430,7 @@ void DatabaseManager::interruptAllDatabasesForContext(ScriptExecutionContext* co
 
 void DatabaseManager::logErrorMessage(ScriptExecutionContext* context, const String& message)
 {
-    context->addConsoleMessage(OtherMessageSource, ErrorMessageLevel, message);
+    context->addConsoleMessage(StorageMessageSource, ErrorMessageLevel, message);
 }
 
 } // namespace WebCore
index 2c140b1..5b45e1a 100644 (file)
@@ -195,7 +195,7 @@ void WebSocketChannel::fail(const String& reason)
     ASSERT(!m_suspended);
     if (m_document) {
         InspectorInstrumentation::didReceiveWebSocketFrameError(m_document, m_identifier, reason);
-        m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket connection to '" + m_handshake->url().elidedString() + "' failed: " + reason);
+        m_document->addConsoleMessage(NetworkMessageSource, ErrorMessageLevel, "WebSocket connection to '" + m_handshake->url().elidedString() + "' failed: " + reason);
     }
 
     // Hybi-10 specification explicitly states we must not continue to handle incoming data
index 5351358..e3cf8bf 100644 (file)
@@ -42,7 +42,7 @@ bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
     if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
         if (reason == AboutToExecuteScript)
-            m_frame->document()->addConsoleMessage(HTMLMessageSource, ErrorMessageLevel, "Blocked script execution in '" + m_frame->document()->url().elidedString() + "' because the document's frame is sandboxed and the 'allow-scripts' permission is not set."); 
+            m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked script execution in '" + m_frame->document()->url().elidedString() + "' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.");
         return false;
     }
 
index b054cf1..02c85f8 100644 (file)
@@ -326,7 +326,7 @@ static void addResolutionWarningMessageToConsole(Document* document, const Strin
 
     message.append(serializedExpression);
 
-    document->addConsoleMessage(HTMLMessageSource, DebugMessageLevel, message);
+    document->addConsoleMessage(CSSMessageSource, DebugMessageLevel, message);
 }
 
 void reportMediaQueryWarningIfNeeded(Document* document, const MediaQuerySet* mediaQuerySet)
index 9a8b78e..0a7ecf6 100644 (file)
@@ -2874,7 +2874,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
                 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
                 frameLoader->stopAllLoaders();
                 frame->navigationScheduler()->scheduleLocationChange(securityOrigin(), blankURL(), String());
-                addConsoleMessage(JSMessageSource, ErrorMessageLevel, message, requestIdentifier);
+                addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, requestIdentifier);
             }
         }
     } else if (equalIgnoringCase(equiv, "content-security-policy"))
index fdbe3fc..4b2f6c2 100644 (file)
@@ -296,7 +296,7 @@ void ScriptElement::executeScript(const ScriptSourceCode& sourceCode)
 
 #if ENABLE(NOSNIFF)
     if (m_isExternalScript && m_cachedScript && !m_cachedScript->mimeTypeAllowedByNosniff()) {
-        m_element->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Refused to execute script from '" + m_cachedScript->url().elidedString() + "' because its MIME type ('" + m_cachedScript->mimeType() + "') is not executable, and strict MIME type checking is enabled.");
+        m_element->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Refused to execute script from '" + m_cachedScript->url().elidedString() + "' because its MIME type ('" + m_cachedScript->mimeType() + "') is not executable, and strict MIME type checking is enabled.");
         return;
     }
 #endif
index 470397a..3d242d6 100644 (file)
@@ -449,7 +449,7 @@ void reportViewportWarning(Document* document, ViewportErrorCode errorCode, cons
         message.append(" Note that ';' is not a separator in viewport values. The list should be comma-separated.");
 
     // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-    document->addConsoleMessage(HTMLMessageSource, viewportErrorMessageLevel(errorCode), message);
+    document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLevel(errorCode), message);
 }
 
 } // namespace WebCore
index dea84c0..70af0bc 100644 (file)
@@ -180,7 +180,7 @@ static bool shouldAutofocus(HTMLFormControlElement* element)
         return false;
     if (element->document()->isSandboxed(SandboxAutomaticFeatures)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-        element->document()->addConsoleMessage(HTMLMessageSource, ErrorMessageLevel, "Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set.");
+        element->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set.");
         return false;
     }
     if (element->hasAutofocused())
index 953fec6..ceb12d1 100644 (file)
@@ -261,7 +261,7 @@ bool HTMLFormElement::validateInteractively(Event* event)
                 continue;
             String message("An invalid form control with name='%name' is not focusable.");
             message.replace("%name", unhandledAssociatedElement->name());
-            document()->addConsoleMessage(HTMLMessageSource, ErrorMessageLevel, message);
+            document()->addConsoleMessage(RenderingMessageSource, ErrorMessageLevel, message);
         }
     }
     return false;
index 52ee98a..4d8648b 100644 (file)
@@ -90,7 +90,7 @@ void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicSt
         String invalidTokens;
         setSandboxFlags(value.isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(value, invalidTokens));
         if (!invalidTokens.isNull())
-            document()->addConsoleMessage(HTMLMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidTokens);
+            document()->addConsoleMessage(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidTokens);
     } else if (name == seamlessAttr) {
         // If we're adding or removing the seamless attribute, we need to force the content document to recalculate its StyleResolver.
         if (contentDocument())
index 442c19e..c14110e 100644 (file)
@@ -1867,7 +1867,7 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(ImageBuffer::Coordi
 {
     if (!canvas()->originClean()) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Unable to get image data from canvas because the canvas has been tainted by cross-origin data.")));
-        canvas()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage);
+        canvas()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
         ec = SECURITY_ERR;
         return 0;
     }
index 5bef70d..cbfbd37 100644 (file)
@@ -5483,7 +5483,7 @@ void WebGLRenderingContext::printWarningToConsole(const String& message)
     Document* document = canvas()->document();
     if (!document)
         return;
-    document->addConsoleMessage(HTMLMessageSource, WarningMessageLevel, message);
+    document->addConsoleMessage(RenderingMessageSource, WarningMessageLevel, message);
 }
 
 bool WebGLRenderingContext::validateFramebufferFuncParameters(const char* functionName, GC3Denum target, GC3Denum attachment)
index e61fc46..1a02644 100644 (file)
@@ -289,7 +289,7 @@ void XSSAuditor::init(Document* document)
             }
         }
         if (xssProtectionHeader == ContentSecurityPolicy::ReflectedXSSInvalid)
-            document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Error parsing header X-XSS-Protection: " + headerValue + ": "  + errorDetails + " at character position " + String::format("%u", errorPosition) + ". The default protections will be applied.");
+            document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Error parsing header X-XSS-Protection: " + headerValue + ": "  + errorDetails + " at character position " + String::format("%u", errorPosition) + ". The default protections will be applied.");
 
         m_xssProtection = combineXSSProtectionHeaderAndCSP(xssProtectionHeader, document->contentSecurityPolicy()->reflectedXSSDisposition());
         m_reportURL = xssProtectionReportURL; // FIXME: Combine the two report URLs in some reasonable way.
index 1ac1288..4a0fe3d 100644 (file)
@@ -61,7 +61,7 @@ void XSSAuditorDelegate::didBlockScript(const XSSInfo& xssInfo)
 
     // FIXME: Consider using a more helpful console message.
     DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to execute a JavaScript script. Source code of script found within request.\n")));
-    m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage);
+    m_document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
 
     if (xssInfo.m_didBlockEntirePage)
         m_document->frame()->loader()->stopAllLoaders();
@@ -84,7 +84,7 @@ void XSSAuditorDelegate::didBlockScript(const XSSInfo& xssInfo)
     }
 
     if (xssInfo.m_didBlockEntirePage) {
-        m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, String("Entire page will be blocked."));
+        m_document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, String("Entire page will be blocked."));
         m_document->frame()->navigationScheduler()->scheduleLocationChange(m_document->securityOrigin(), String("data:text/html,<p></p>"), blankURL());
     }
 }
index 54ed316..cfd6321 100644 (file)
@@ -137,11 +137,15 @@ void ConsoleMessage::autogenerateMetadata(bool canGenerateCallStack, ScriptState
 static TypeBuilder::Console::ConsoleMessage::Source::Enum messageSourceValue(MessageSource source)
 {
     switch (source) {
-    case HTMLMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Html;
     case XMLMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Xml;
     case JSMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Javascript;
     case NetworkMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Network;
     case ConsoleAPIMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Console_api;
+    case StorageMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Storage;
+    case AppCacheMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Appcache;
+    case RenderingMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Rendering;
+    case CSSMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Css;
+    case SecurityMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Security;
     case OtherMessageSource: return TypeBuilder::Console::ConsoleMessage::Source::Other;
     }
     return TypeBuilder::Console::ConsoleMessage::Source::Other;
index e87df36..e2447d1 100644 (file)
                 "type": "object",
                 "description": "Console message.",
                 "properties": [
-                    { "name": "source", "type": "string", "enum": ["html", "wml", "xml", "javascript", "network", "console-api", "other"], "description": "Message source." },
-                    { "name": "level", "type": "string", "enum": ["tip", "log", "warning", "error", "debug"], "description": "Message severity." },
+                    { "name": "source", "type": "string", "enum": ["xml", "javascript", "network", "console-api", "storage", "appcache", "rendering", "css", "security", "other"], "description": "Message source." },
+                    { "name": "level", "type": "string", "enum": ["log", "warning", "error", "debug"], "description": "Message severity." },
                     { "name": "text", "type": "string", "description": "Message text." },
                     { "name": "type", "type": "string", "optional": true, "enum": ["log", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "timing", "profile", "profileEnd"], "description": "Console message type." },
                     { "name": "url", "type": "string", "optional": true, "description": "URL of the message origin." },
index b5a7b98..fe2daff 100644 (file)
@@ -340,7 +340,7 @@ void FrameLoader::submitForm(PassRefPtr<FormSubmission> submission)
 
     if (isDocumentSandboxed(m_frame, SandboxForms)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-        m_frame->document()->addConsoleMessage(HTMLMessageSource, ErrorMessageLevel, "Blocked form submission to '" + submission->action().elidedString() + "' because the form's frame is sandboxed and the 'allow-forms' permission is not set.");
+        m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked form submission to '" + submission->action().elidedString() + "' because the form's frame is sandboxed and the 'allow-forms' permission is not set.");
         return;
     }
 
@@ -1414,7 +1414,7 @@ void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url)
     if (!frame)
         return;
 
-    frame->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Not allowed to load local resource: " + url);
+    frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Not allowed to load local resource: " + url);
 }
 
 const ResourceRequest& FrameLoader::initialRequest() const
@@ -3367,7 +3367,7 @@ Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadReque
     // Sandboxed frames cannot open new auxiliary browsing contexts.
     if (isDocumentSandboxed(openerFrame, SandboxPopups)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-        openerFrame->document()->addConsoleMessage(HTMLMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString() + "' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.");
+        openerFrame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString() + "' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.");
         return 0;
     }
 
index 186ce94..42adc7b 100644 (file)
@@ -295,7 +295,7 @@ void ImageLoader::notifyFinished(CachedResource* resource)
         errorEventSender().dispatchEventSoon(this);
 
         DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Cross-origin image load denied by Cross-Origin Resource Sharing policy.")));
-        m_element->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage);
+        m_element->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
 
         ASSERT(!m_hasPendingLoadEvent);
 
index 3722aa9..fae4e02 100644 (file)
@@ -411,7 +411,7 @@ void MainResourceLoader::responseReceived(CachedResource* resource, const Resour
         if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, r.url(), identifier())) {
             InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_documentLoader->frame(), documentLoader(), identifier(), r);
             String message = "Refused to display '" + r.url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
-            m_documentLoader->frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message, identifier());
+            m_documentLoader->frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, identifier());
 
             cancel();
             return;
index 4751412..e3eff75 100644 (file)
@@ -96,7 +96,7 @@ bool MixedContentChecker::canRunInsecureContent(SecurityOrigin* securityOrigin,
 void MixedContentChecker::logWarning(bool allowed, const String& action, const KURL& target) const
 {
     String message = makeString((allowed ? "" : "[blocked] "), "The page at ", m_frame->document()->url().elidedString(), " ", action, " insecure content from ", target.elidedString(), ".\n");
-    m_frame->document()->addConsoleMessage(HTMLMessageSource, WarningMessageLevel, message);
+    m_frame->document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message);
 }
 
 } // namespace WebCore
index 0ba636b..26bc8cb 100644 (file)
@@ -118,7 +118,7 @@ void TextTrackLoader::corsPolicyPreventedLoad()
 {
     DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Cross-origin text track load denied by Cross-Origin Resource Sharing policy.")));
     Document* document = static_cast<Document*>(m_scriptExecutionContext);
-    document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage);
+    document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
     m_state = Failed;
 }
 
index f6a7d24..43c8155 100644 (file)
@@ -475,7 +475,7 @@ void ApplicationCacheGroup::abort(Frame* frame)
     if (m_completionType != None)
         return;
 
-    frame->document()->addConsoleMessage(OtherMessageSource, DebugMessageLevel, "Application Cache download process was aborted.");
+    frame->document()->addConsoleMessage(NetworkMessageSource, DebugMessageLevel, "Application Cache download process was aborted.");
     cacheUpdateFailed();
 }
 
index 3560e92..4b4699b 100644 (file)
@@ -662,7 +662,7 @@ void CachedResourceLoader::printAccessDeniedMessage(const KURL& url) const
     else
         message = "Unsafe attempt to load URL " + url.elidedString() + " from frame with URL " + m_document->url().elidedString() + ". Domains, protocols and ports must match.\n";
 
-    frame()->document()->addConsoleMessage(OtherMessageSource, ErrorMessageLevel, message);
+    frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
 }
 
 void CachedResourceLoader::setAutoLoadImages(bool enable)
index f398c25..ea537c4 100644 (file)
@@ -88,9 +88,6 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
 {
     const char* sourceString;
     switch (source) {
-    case HTMLMessageSource:
-        sourceString = "HTML";
-        break;
     case XMLMessageSource:
         sourceString = "XML";
         break;
@@ -103,6 +100,21 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
     case ConsoleAPIMessageSource:
         sourceString = "CONSOLEAPI";
         break;
+    case StorageMessageSource:
+        sourceString = "STORAGE";
+        break;
+    case AppCacheMessageSource:
+        sourceString = "APPCACHE";
+        break;
+    case RenderingMessageSource:
+        sourceString = "RENDERING";
+        break;
+    case CSSMessageSource:
+        sourceString = "CSS";
+        break;
+    case SecurityMessageSource:
+        sourceString = "SECURITY";
+        break;
     case OtherMessageSource:
         sourceString = "OTHER";
         break;
index 810da1f..804a167 100644 (file)
 namespace WebCore {
 
 enum MessageSource {
-    HTMLMessageSource,
     XMLMessageSource,
     JSMessageSource,
     NetworkMessageSource,
     ConsoleAPIMessageSource,
+    StorageMessageSource,
+    AppCacheMessageSource,
+    RenderingMessageSource,
+    CSSMessageSource,
+    SecurityMessageSource,
     OtherMessageSource,
 };
 
index 39c917b..68c441b 100644 (file)
@@ -1815,7 +1815,7 @@ void ContentSecurityPolicy::reportMissingReportURI(const String& policy) const
 
 void ContentSecurityPolicy::logToConsole(const String& message, const String& contextURL, const WTF::OrdinalNumber& contextLine, ScriptState* state) const
 {
-    m_scriptExecutionContext->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt(), state);
+    m_scriptExecutionContext->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt(), state);
 }
 
 void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String& directiveText) const
index e8e011d..fffdcaf 100644 (file)
@@ -884,7 +884,7 @@ void DOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTarg
         if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrigin())) {
             String message = "Unable to post message to " + intendedTargetOrigin->toString() +
                              ". Recipient has origin " + document()->securityOrigin()->toString() + ".\n";
-            console()->addMessage(JSMessageSource, ErrorMessageLevel, message, stackTrace);
+            console()->addMessage(SecurityMessageSource, ErrorMessageLevel, message, stackTrace);
             return;
         }
     }
index 2c1efb6..63f965b 100644 (file)
@@ -56,7 +56,7 @@ void PointerLockController::requestPointerLock(Element* target)
 
     if (target->document()->isSandboxed(SandboxPointerLock)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-        target->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set.");
+        target->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set.");
         enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
         return;
     }
index f10e729..d69de9d 100644 (file)
@@ -135,7 +135,7 @@ void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
 static void reportMessage(Document* document, MessageLevel level, const String& message)
 {
     if (document->frame())
-        document->addConsoleMessage(JSMessageSource, level, message);
+        document->addConsoleMessage(RenderingMessageSource, level, message);
 }
 
 void SVGDocumentExtensions::reportWarning(const String& message)
index 4845721..744e302 100644 (file)
@@ -1,3 +1,13 @@
+2013-03-06  Dmitry Zvorygin  <zvorygin@chromium.org>
+
+        Introduce new message sources for logging.
+        https://bugs.webkit.org/show_bug.cgi?id=110968
+
+        Reviewed by Pavel Feldman.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        * WebView/WebUIDelegatePrivate.h:
+
 2013-03-05  Kent Tamura  <tkent@chromium.org>
 
         Rename WebCore/editing/visible_units.* to VisibleUnits.*
index 03f4c1f..9b0eff6 100644 (file)
 #import "NetscapePluginHostManager.h"
 #endif
 
-NSString *WebConsoleMessageHTMLMessageSource = @"HTMLMessageSource";
 NSString *WebConsoleMessageXMLMessageSource = @"XMLMessageSource";
 NSString *WebConsoleMessageJSMessageSource = @"JSMessageSource";
 NSString *WebConsoleMessageNetworkMessageSource = @"NetworkMessageSource";
 NSString *WebConsoleMessageConsoleAPIMessageSource = @"ConsoleAPIMessageSource";
+NSString *WebConsoleMessageStorageMessageSource = @"StorageMessageSource";
+NSString *WebConsoleMessageAppCacheMessageSource = @"AppCacheMessageSource";
+NSString *WebConsoleMessageRenderingMessageSource = @"RenderingMessageSource";
+NSString *WebConsoleMessageCSSMessageSource = @"CSSMessageSource";
+NSString *WebConsoleMessageSecurityMessageSource = @"SecurityMessageSource";
 NSString *WebConsoleMessageOtherMessageSource = @"OtherMessageSource";
 
 NSString *WebConsoleMessageDebugMessageLevel = @"DebugMessageLevel";
@@ -329,8 +333,6 @@ void WebChromeClient::setResizable(bool b)
 inline static NSString *stringForMessageSource(MessageSource source)
 {
     switch (source) {
-    case HTMLMessageSource:
-        return WebConsoleMessageHTMLMessageSource;
     case XMLMessageSource:
         return WebConsoleMessageXMLMessageSource;
     case JSMessageSource:
@@ -339,6 +341,16 @@ inline static NSString *stringForMessageSource(MessageSource source)
         return WebConsoleMessageNetworkMessageSource;
     case ConsoleAPIMessageSource:
         return WebConsoleMessageConsoleAPIMessageSource;
+    case StorageMessageSource:
+        return WebConsoleMessageStorageMessageSource;
+    case AppCacheMessageSource:
+        return WebConsoleMessageAppCacheMessageSource;
+    case RenderingMessageSource:
+        return WebConsoleMessageRenderingMessageSource;
+    case CSSMessageSource:
+        return WebConsoleMessageCSSMessageSource;
+    case SecurityMessageSource:
+        return WebConsoleMessageSecurityMessageSource;
     case OtherMessageSource:
         return WebConsoleMessageOtherMessageSource;
     }
index cc03463..dd6d5c9 100644 (file)
@@ -104,11 +104,15 @@ enum {
 };
 
 // Message Sources.
-extern NSString *WebConsoleMessageHTMLMessageSource;
 extern NSString *WebConsoleMessageXMLMessageSource;
 extern NSString *WebConsoleMessageJSMessageSource;
 extern NSString *WebConsoleMessageNetworkMessageSource;
 extern NSString *WebConsoleMessageConsoleAPIMessageSource;
+extern NSString *WebConsoleMessageStorageMessageSource;
+extern NSString *WebConsoleMessageAppCacheMessageSource;
+extern NSString *WebConsoleMessageRenderingMessageSource;
+extern NSString *WebConsoleMessageCSSMessageSource;
+extern NSString *WebConsoleMessageSecurityMessageSource;
 extern NSString *WebConsoleMessageOtherMessageSource;
 
 // Message Levels.
@@ -143,7 +147,7 @@ extern NSString *WebConsoleMessageErrorMessageLevel;
     @method webView:addMessageToConsole:withSource:
     @param webView The WebView sending the delegate method.
     @param message A dictionary representation of the console message.
-    @param source Where the message came from. See WebConsoleMessageHTMLMessageSource and other source types.
+    @param source Where the message came from. See WebConsoleMessageXMLMessageSource and other source types.
     @discussion The dictionary contains the following keys:
 
     <dl>
@@ -155,8 +159,8 @@ extern NSString *WebConsoleMessageErrorMessageLevel;
         <dd>If this came from a file, this is the URL to the file this message originates from.</dd>
         <dt>MessageSource</dt>
         <dd>
-            Where the message came from. HTML, XML, JavaScript, CSS, etc.
-            See WebConsoleMessageHTMLMessageSource and similar constants.
+            Where the message came from. XML, JavaScript, CSS, etc.
+            See WebConsoleMessageXMLMessageSource and similar constants.
         </dd>
         <dt>MessageLevel</dt>
         <dd>