Title: [102794] trunk/Source/WebCore
Revision
102794
Author
k...@google.com
Date
2011-12-14 10:03:32 -0800 (Wed, 14 Dec 2011)

Log Message

Unreviewed, rolling out r102688.
http://trac.webkit.org/changeset/102688
https://bugs.webkit.org/show_bug.cgi?id=74220

Under the hypothesis that it might be the cause of
browser_tests and ui_tests crashes on Chromium canaries --
will reland if not.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102793 => 102794)


--- trunk/Source/WebCore/ChangeLog	2011-12-14 17:48:26 UTC (rev 102793)
+++ trunk/Source/WebCore/ChangeLog	2011-12-14 18:03:32 UTC (rev 102794)
@@ -1,3 +1,21 @@
+2011-12-14  Kenneth Russell  <k...@google.com>
+
+        Unreviewed, rolling out r102688.
+        http://trac.webkit.org/changeset/102688
+        https://bugs.webkit.org/show_bug.cgi?id=74220
+
+        Under the hypothesis that it might be the cause of
+        browser_tests and ui_tests crashes on Chromium canaries --
+        will reland if not.
+
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::addMessageToConsole):
+        (WebCore::logInfo):
+        (WebCore::V8Proxy::reportUnsafeAccessTo):
+        * bindings/v8/V8Proxy.h:
+        * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+        (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+
 2011-12-14  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: DatabaseTableView should escape table name.

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (102793 => 102794)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-12-14 17:48:26 UTC (rev 102793)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-12-14 18:03:32 UTC (rev 102794)
@@ -33,6 +33,7 @@
 
 #include "CSSMutableStyleDeclaration.h"
 #include "CachedMetadata.h"
+#include "Console.h"
 #include "DateExtension.h"
 #include "Document.h"
 #include "DocumentLoader.h"
@@ -42,6 +43,7 @@
 #include "FrameLoaderClient.h"
 #include "IDBFactoryBackendInterface.h"
 #include "InspectorInstrumentation.h"
+#include "Page.h"
 #include "PlatformSupport.h"
 #include "ScriptSourceCode.h"
 #include "SecurityOrigin.h"
@@ -117,6 +119,21 @@
 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);
@@ -127,6 +144,9 @@
     Frame* source = V8Proxy::retrieveFrameForEnteredContext();
     if (!source)
         return;
+    Page* page = source->page();
+    if (!page)
+        return;
 
     Document* sourceDocument = source->document();
     if (!sourceDocument)
@@ -137,10 +157,14 @@
     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.
-    sourceDocument->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, str);
+    addMessageToConsole(page, str, kSourceID, kLineNumber);
 }
 
 static void handleFatalErrorInV8()

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (102793 => 102794)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2011-12-14 17:48:26 UTC (rev 102793)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2011-12-14 18:03:32 UTC (rev 102794)
@@ -65,6 +65,9 @@
     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 (102793 => 102794)


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

Reply via email to