[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 15:09:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 58fafb87905cb0e9ab75250caa23b8a5d0764bba
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 28 16:13:58 2010 +0000

    Don't append a newline to the test output if the frame has no document element in WebKitTestRunner
    
    Fixes <http://webkit.org/b/48526> Extra trailing newline when running
    plugins/document-open.html in WebKitTestRunner
    
    Reviewed by Anders Carlsson.
    
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
    (WTR::toJS): Added. Turns a UTF-8 C string into a JSStringRef.
    (WTR::hasDocumentElement): Added. Uses the JSC API to figure out
    whether the frame has a document element.
    (WTR::dumpFrameText): Match DRT by bailing (rather than appending an
    empty string and a newline) if the frame has no document element.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70780 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index ea64005..a9aa92e 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,22 @@
 2010-10-28  Adam Roben  <aroben at apple.com>
 
+        Don't append a newline to the test output if the frame has no document
+        element in WebKitTestRunner
+
+        Fixes <http://webkit.org/b/48526> Extra trailing newline when running
+        plugins/document-open.html in WebKitTestRunner
+
+        Reviewed by Anders Carlsson.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::toJS): Added. Turns a UTF-8 C string into a JSStringRef.
+        (WTR::hasDocumentElement): Added. Uses the JSC API to figure out
+        whether the frame has a document element.
+        (WTR::dumpFrameText): Match DRT by bailing (rather than appending an
+        empty string and a newline) if the frame has no document element.
+
+2010-10-28  Adam Roben  <aroben at apple.com>
+
         Skip npn-invalidate-rect-invalidates-window.html on headless XP
         machines
 
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 884ee0b..d852dd2 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -377,8 +377,38 @@ void InjectedBundlePage::dumpAllFrameScrollPositions()
     dumpDescendantFrameScrollPositions(frame);
 }
 
+static JSRetainPtr<JSStringRef> toJS(const char* string)
+{
+    return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString(string));
+}
+
+static bool hasDocumentElement(WKBundleFrameRef frame)
+{
+    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
+    JSObjectRef globalObject = JSContextGetGlobalObject(context);
+
+    JSValueRef documentValue = JSObjectGetProperty(context, globalObject, toJS("document").get(), 0);
+    if (!documentValue)
+        return false;
+
+    ASSERT(JSValueIsObject(context, documentValue));
+    JSObjectRef document = JSValueToObject(context, documentValue, 0);
+
+    JSValueRef documentElementValue = JSObjectGetProperty(context, document, toJS("documentElement").get(), 0);
+    if (!documentElementValue)
+        return false;
+
+    return JSValueToBoolean(context, documentElementValue);
+}
+
 static void dumpFrameText(WKBundleFrameRef frame)
 {
+    // If the frame doesn't have a document element, its inner text will be an empty string, so
+    // we'll end up just appending a single newline below. But DumpRenderTree doesn't append
+    // anything in this case, so we shouldn't either.
+    if (!hasDocumentElement(frame))
+        return;
+
     WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame));
     InjectedBundle::shared().os() << text << "\n";
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list