WebKit/win:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Apr 2009 05:04:05 +0000 (05:04 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Apr 2009 05:04:05 +0000 (05:04 +0000)
        Reviewed by Jon Honeycutt.

        - implement DOMNode::nodeName()

        * DOMCoreClasses.cpp:
        (DOMNode::nodeName):

WebKitTools:

        Reviewed by Jon Honeycutt.

        - dump the node in the element dictionary in the action information
          passed to the policy delegate

        * DumpRenderTree/mac/PolicyDelegate.mm:
        (-[PolicyDelegate webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
        * DumpRenderTree/win/PolicyDelegate.cpp:
        (dumpPath):
        (PolicyDelegate::decidePolicyForNavigationAction):

LayoutTests:

        Reviewed by Jon Honeycutt.

        - updated result that shows the node in the element dictionary in the
          action information passed to the policy delegate

        * http/tests/security/feed-urls-from-remote-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/security/feed-urls-from-remote-expected.txt
WebKit/win/ChangeLog
WebKit/win/DOMCoreClasses.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/mac/PolicyDelegate.mm
WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp
WebKitTools/Scripts/bisect-builds

index 95be6be..8115ddf 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-21  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Jon Honeycutt.
+
+        - updated result that shows the node in the element dictionary in the
+          action information passed to the policy delegate
+
+        * http/tests/security/feed-urls-from-remote-expected.txt:
+
 2009-04-21  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Darin Adler.
index b7a9227..58ac2cc 100644 (file)
@@ -1,4 +1,4 @@
-Policy delegate: attempt to load feed://127.0.0.1:8000/security/resources/feed.xml with navigation type 'link clicked'
+Policy delegate: attempt to load feed://127.0.0.1:8000/security/resources/feed.xml with navigation type 'link clicked' originating from HTML > #document
 < rdar://problem/5329440> REGRESSION: Clicking links with the feed:// protocol in Safari 3 does nothing 
 This test is to see if a feed URL can be followed from a link on a page.
 
index ae280ef..25a5a5c 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-21  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Jon Honeycutt.
+
+        - implement DOMNode::nodeName()
+
+        * DOMCoreClasses.cpp:
+        (DOMNode::nodeName):
+
 2009-04-21  Steve Falkenburg  <sfalken@apple.com>
 
         Minor clean-ups to WebKitCreateInstance change.
index 19f076f..f4018c6 100644 (file)
@@ -101,10 +101,16 @@ HRESULT STDMETHODCALLTYPE DOMNode::QueryInterface(REFIID riid, void** ppvObject)
 // DOMNode --------------------------------------------------------------------
 
 HRESULT STDMETHODCALLTYPE DOMNode::nodeName( 
-    /* [retval][out] */ BSTR* /*result*/)
+    /* [retval][out] */ BSTR* result)
 {
-    ASSERT_NOT_REACHED();
-    return E_NOTIMPL;
+    if (!result)
+        return E_POINTER;
+
+    if (!m_node)
+        return E_FAIL;
+
+    *result = BString(m_node->nodeName()).release();
+    return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE DOMNode::nodeValue( 
index 2b0a8fd..5396b73 100644 (file)
@@ -1,3 +1,16 @@
+2009-04-21  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Jon Honeycutt.
+
+        - dump the node in the element dictionary in the action information
+          passed to the policy delegate
+
+        * DumpRenderTree/mac/PolicyDelegate.mm:
+        (-[PolicyDelegate webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
+        * DumpRenderTree/win/PolicyDelegate.cpp:
+        (dumpPath):
+        (PolicyDelegate::decidePolicyForNavigationAction):
+
 2009-04-21  Adam Roben  <aroben@apple.com>
 
         Windows build fix after r42726
index 64329b2..a3662a9 100644 (file)
 
 #import "DumpRenderTree.h"
 #import "LayoutTestController.h"
+#import <WebKit/DOMElement.h>
 #import <WebKit/WebPolicyDelegate.h>
+#import <WebKit/WebView.h>
 
 @interface NSURL (DRTExtras)
 - (NSString *)_drt_descriptionSuitableForTestResult;
 @end
 
+@interface DOMNode (dumpPath)
+- (NSString *)dumpPath;
+@end
+
 @implementation PolicyDelegate
 
 - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
         default:
             typeDescription = "illegal value";
     }
-    
-    printf("Policy delegate: attempt to load %s with navigation type '%s'\n", [[[request URL] _drt_descriptionSuitableForTestResult] UTF8String], typeDescription);
-    
+
+    NSString *message = [NSString stringWithFormat:@"Policy delegate: attempt to load %@ with navigation type '%s'", [[request URL] _drt_descriptionSuitableForTestResult], typeDescription];
+
+    if (DOMElement *originatingNode = [[actionInformation objectForKey:WebActionElementKey] objectForKey:WebElementDOMNodeKey])
+        message = [message stringByAppendingFormat:@" originating from %@", [originatingNode dumpPath]];
+
+    printf("%s\n", [message UTF8String]);
+
     if (permissiveDelegate)
         [listener use];
     else
index a6f8c40..596fd9e 100644 (file)
 
 using std::wstring;
 
+static wstring dumpPath(IDOMNode* node)
+{
+    ASSERT(node);
+
+    wstring result;
+
+    BSTR name;
+    if (FAILED(node->nodeName(&name)))
+        return result;
+    result.assign(name, SysStringLen(name));
+    SysFreeString(name);
+
+    COMPtr<IDOMNode> parent;
+    if (SUCCEEDED(node->parentNode(&parent)))
+        result += TEXT(" > ") + dumpPath(parent.get());
+
+    return result;
+}
+
 PolicyDelegate::PolicyDelegate()
     : m_refCount(1)
     , m_permissiveDelegate(false)
@@ -89,31 +108,43 @@ HRESULT STDMETHODCALLTYPE PolicyDelegate::decidePolicyForNavigationAction(
         navType = V_I4(&var);
     }
 
-    const char* typeDescription;
+    LPCTSTR typeDescription;
     switch (navType) {
         case WebNavigationTypeLinkClicked:
-            typeDescription = "link clicked";
+            typeDescription = TEXT("link clicked");
             break;
         case WebNavigationTypeFormSubmitted:
-            typeDescription = "form submitted";
+            typeDescription = TEXT("form submitted");
             break;
         case WebNavigationTypeBackForward:
-            typeDescription = "back/forward";
+            typeDescription = TEXT("back/forward");
             break;
         case WebNavigationTypeReload:
-            typeDescription = "reload";
+            typeDescription = TEXT("reload");
             break;
         case WebNavigationTypeFormResubmitted:
-            typeDescription = "form resubmitted";
+            typeDescription = TEXT("form resubmitted");
             break;
         case WebNavigationTypeOther:
-            typeDescription = "other";
+            typeDescription = TEXT("other");
             break;
         default:
-            typeDescription = "illegal value";
+            typeDescription = TEXT("illegal value");
     }
-    
-    printf("Policy delegate: attempt to load %S with navigation type '%s'\n", wurl.c_str(), typeDescription);
+
+    wstring message = TEXT("Policy delegate: attempt to load ") + wurl + TEXT(" with navigation type '") + typeDescription + TEXT("'");
+
+    VARIANT actionElementVar;
+    if (SUCCEEDED(actionInformation->Read(WebActionElementKey, &actionElementVar, 0))) {
+        COMPtr<IPropertyBag> actionElement(Query, V_UNKNOWN(&actionElementVar));
+        VARIANT originatingNodeVar;
+        if (SUCCEEDED(actionElement->Read(WebElementDOMNodeKey, &originatingNodeVar, 0))) {
+            COMPtr<IDOMNode> originatingNode(Query, V_UNKNOWN(&originatingNodeVar));
+            message += TEXT(" originating from ") + dumpPath(originatingNode.get());
+        }
+    }
+
+    printf("%S\n", message.c_str());
 
     SysFreeString(url);
 
index 45fdcc4..b1c319f 100755 (executable)
@@ -273,7 +273,7 @@ sub findSafariVersion($)
     while (<PLIST>) {
         if (m#^\s*<key>CFBundleShortVersionString</key>#) {
             $version = <PLIST>;
-            $version =~ s#^\s*<string>(.+)</string>\s*[\r\n]*#$1#;
+            $version =~ s#^\s*<string>([0-9.]+)[^<]*</string>\s*[\r\n]*#$1#;
         }
     }
     close(PLIST);