Title: [102688] trunk/Source/WebCore
Revision
102688
Author
[email protected]
Date
2011-12-13 10:20:21 -0800 (Tue, 13 Dec 2011)

Log Message

V8Proxy cleanup: replace custom logging methods with standard WebCore calls
https://bugs.webkit.org/show_bug.cgi?id=74220

Reviewed by Adam Barth.

* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::reportUnsafeAccessTo):
* bindings/v8/V8Proxy.h:
* bindings/v8/custom/V8CustomXPathNSResolver.cpp:
(WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102687 => 102688)


--- trunk/Source/WebCore/ChangeLog	2011-12-13 18:19:59 UTC (rev 102687)
+++ trunk/Source/WebCore/ChangeLog	2011-12-13 18:20:21 UTC (rev 102688)
@@ -1,3 +1,16 @@
+2011-12-13  Adam Klein  <[email protected]>
+
+        V8Proxy cleanup: replace custom logging methods with standard WebCore calls
+        https://bugs.webkit.org/show_bug.cgi?id=74220
+
+        Reviewed by Adam Barth.
+
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::reportUnsafeAccessTo):
+        * bindings/v8/V8Proxy.h:
+        * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+        (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+
 2011-12-13  Tor Arne Vestbø  <[email protected]>
 
         [Qt] Get rid of layering violations in includes

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (102687 => 102688)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-12-13 18:19:59 UTC (rev 102687)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-12-13 18:20:21 UTC (rev 102688)
@@ -33,7 +33,6 @@
 
 #include "CSSMutableStyleDeclaration.h"
 #include "CachedMetadata.h"
-#include "Console.h"
 #include "DateExtension.h"
 #include "Document.h"
 #include "DocumentLoader.h"
@@ -43,7 +42,6 @@
 #include "FrameLoaderClient.h"
 #include "IDBFactoryBackendInterface.h"
 #include "InspectorInstrumentation.h"
-#include "Page.h"
 #include "PlatformSupport.h"
 #include "ScriptSourceCode.h"
 #include "SecurityOrigin.h"
@@ -119,21 +117,6 @@
 typedef HashMap<void*, v8::Object*> DOMObjectMap;
 typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap;
 
-static void addMessageToConsole(Page* page, const String& message, const String& sourceID, unsigned lineNumber)
-{
-    ASSERT(page);
-    Console* console = page->mainFrame()->domWindow()->console();
-    console->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, lineNumber, sourceID);
-}
-
-void logInfo(Frame* frame, const String& message, const String& url)
-{
-    Page* page = frame->page();
-    if (!page)
-        return;
-    addMessageToConsole(page, message, url, 0);
-}
-
 void V8Proxy::reportUnsafeAccessTo(Frame* target)
 {
     ASSERT(target);
@@ -144,9 +127,6 @@
     Frame* source = V8Proxy::retrieveFrameForEnteredContext();
     if (!source)
         return;
-    Page* page = source->page();
-    if (!page)
-        return;
 
     Document* sourceDocument = source->document();
     if (!sourceDocument)
@@ -157,14 +137,10 @@
     String str = "Unsafe _javascript_ attempt to access frame with URL " + targetDocument->url().string() +
                  " from frame with URL " + sourceDocument->url().string() + ". Domains, protocols and ports must match.\n";
 
-    // Build a console message with fake source ID and line number.
-    const String kSourceID = "";
-    const int kLineNumber = 1;
-
     // NOTE: Safari prints the message in the target page, but it seems like
     // it should be in the source page. Even for delayed messages, we put it in
     // the source page.
-    addMessageToConsole(page, str, kSourceID, kLineNumber);
+    sourceDocument->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, str);
 }
 
 static void handleFatalErrorInV8()

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (102687 => 102688)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2011-12-13 18:19:59 UTC (rev 102687)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2011-12-13 18:20:21 UTC (rev 102688)
@@ -65,9 +65,6 @@
     class V8IsolatedContext;
     class WorldContextHandle;
 
-    // FIXME: use standard logging facilities in WebCore.
-    void logInfo(Frame*, const String& message, const String& url);
-
     // The following Batch structs and methods are used for setting multiple
     // properties on an ObjectTemplate, used from the generated bindings
     // initialization (ConfigureXXXTemplate). This greatly reduces the binary

Modified: trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp (102687 => 102688)


--- trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp	2011-12-13 18:19:59 UTC (rev 102687)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp	2011-12-13 18:20:21 UTC (rev 102688)
@@ -30,9 +30,12 @@
 #include "config.h"
 #include "V8CustomXPathNSResolver.h"
 
-#include "PlatformString.h"
+#include "ScriptCallStack.h"
+#include "ScriptExecutionContext.h"
 #include "V8Binding.h"
 #include "V8Proxy.h"
+#include "V8Utilities.h"
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -63,10 +66,8 @@
     }
 
     if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
-        if (V8Proxy* proxy = V8Proxy::retrieve()) {
-            if (Frame* frame = proxy->frame())
-                logInfo(frame, "XPathNSResolver does not have a lookupNamespaceURI method.", String());
-        }
+        if (ScriptExecutionContext* context = getScriptExecutionContext())
+            context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String(), 0);
         return String();
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to