LayoutTests:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2007 15:01:10 +0000 (15:01 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2007 15:01:10 +0000 (15:01 +0000)
        Reviewed by Darin.

        - LayoutTests part of fix for http://bugs.webkit.org/show_bug.cgi?id=12463
          WebArchiver - attempt to insert nil exception when archive empty iframe

        Tests using both dumpDOMAsWebArchive() and dumpSourceAsWebArchive() were added
        for this bug since a similar fix was suggested for the DOM case which was not
        needed.  The remaining changes are related to renaming dumpAsWebArchive() to
        dumpDOMAsWebArchive().

        * webarchive/archive-empty-frame-dom-expected.txt: Added.
        * webarchive/archive-empty-frame-dom.html: Added.
        * webarchive/archive-empty-frame-source-expected.txt: Added.
        * webarchive/archive-empty-frame-source.html: Added.
        * webarchive/resources/dump-webarchive.js: Renamed dumpAsWebArchive() to dumpDOMAsWebArchive().
        * webarchive/test-body-background-expected.txt: Ditto.
        * webarchive/test-body-background.html: Ditto.
        * webarchive/test-duplicate-resources-expected.txt: Ditto.
        * webarchive/test-frameset-expected.txt: Ditto.
        * webarchive/test-frameset.html: Ditto.
        * webarchive/test-img-src-expected.txt: Ditto.
        * webarchive/test-img-src.html: Ditto.
        * webarchive/test-input-src-expected.txt: Ditto.
        * webarchive/test-input-src.html: Ditto.
        * webarchive/test-link-href-expected.txt: Ditto.
        * webarchive/test-link-href.html: Ditto.
        * webarchive/test-object-data-expected.txt: Ditto.
        * webarchive/test-object-data.html: Ditto.
        * webarchive/test-script-src-expected.txt: Ditto.
        * webarchive/test-table-background-expected.txt: Ditto.
        * webarchive/test-table-background.html: Ditto.
        * webarchive/test-td-background-expected.txt: Ditto.
        * webarchive/test-td-background.html: Ditto.

WebKit:

        Reviewed by Darin.

        - WebCore part of fix for http://bugs.webkit.org/show_bug.cgi?id=12463
          WebArchiver - attempt to insert nil exception when archive empty iframe

        When dealing with an iframe element with no src attribute, the element contains
        a src attribute in the DOM with a URL of "about:blank" and some HTML to implement
        the blank page.  In the original page source, however, the iframe element does
        not include a src attribute, which caused a nil archive to be returned for the
        childFrameArchive and thus caused the bug.  The fix is a simple nil check.

        Test: webarchive/archive-empty-frame-source.html

        * WebView/WebArchiver.mm:
        (+ (NSArray *)_subframeArchivesForFrame:(WebFrame *)frame): Don't add childFrameArchive
        to the subframeArchives array if it is nil.

WebKitTools:

        Reviewed by Darin.

        - WebKitTools part of fix for http://bugs.webkit.org/show_bug.cgi?id=12463
          WebArchiver - attempt to insert nil exception when archive empty iframe

        The dumpDOMAsWebArchive() test method uses the DOMDocument as a basis for creating
        a webarchive while the dumpSourceAsWebArchive() test method uses the original
        dataSource (page source) to create a webarchive.  Most tests currently use
        dumpDOMAsWebArchive() since this is what Safari does when saving a web page as a
        webarchive.

        * DumpRenderTree/DumpRenderTree.m: Renamed dumpAsWebArchive to dumpDOMAsWebArchive.
        Added dumpSourceAsWebArchive.
        (dump):
        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
        (-[LayoutTestController dumpDOMAsWebArchive]):
        (-[LayoutTestController dumpSourceAsWebArchive]):
        (runTest):

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

28 files changed:
LayoutTests/ChangeLog
LayoutTests/webarchive/archive-empty-frame-dom-expected.txt [new file with mode: 0644]
LayoutTests/webarchive/archive-empty-frame-dom.html [new file with mode: 0644]
LayoutTests/webarchive/archive-empty-frame-source-expected.txt [new file with mode: 0644]
LayoutTests/webarchive/archive-empty-frame-source.html [new file with mode: 0644]
LayoutTests/webarchive/resources/dump-webarchive.js
LayoutTests/webarchive/test-body-background-expected.txt
LayoutTests/webarchive/test-body-background.html
LayoutTests/webarchive/test-duplicate-resources-expected.txt
LayoutTests/webarchive/test-frameset-expected.txt
LayoutTests/webarchive/test-frameset.html
LayoutTests/webarchive/test-img-src-expected.txt
LayoutTests/webarchive/test-img-src.html
LayoutTests/webarchive/test-input-src-expected.txt
LayoutTests/webarchive/test-input-src.html
LayoutTests/webarchive/test-link-href-expected.txt
LayoutTests/webarchive/test-link-href.html
LayoutTests/webarchive/test-object-data-expected.txt
LayoutTests/webarchive/test-object-data.html
LayoutTests/webarchive/test-script-src-expected.txt
LayoutTests/webarchive/test-table-background-expected.txt
LayoutTests/webarchive/test-table-background.html
LayoutTests/webarchive/test-td-background-expected.txt
LayoutTests/webarchive/test-td-background.html
WebKit/ChangeLog
WebKit/WebView/WebArchiver.mm
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m

index 227cb4f..93197ae 100644 (file)
@@ -1,5 +1,41 @@
 2007-03-07  David Kilzer  <ddkilzer@webkit.org>
 
+        Reviewed by Darin.
+
+        - LayoutTests part of fix for http://bugs.webkit.org/show_bug.cgi?id=12463
+          WebArchiver - attempt to insert nil exception when archive empty iframe
+
+        Tests using both dumpDOMAsWebArchive() and dumpSourceAsWebArchive() were added
+        for this bug since a similar fix was suggested for the DOM case which was not
+        needed.  The remaining changes are related to renaming dumpAsWebArchive() to
+        dumpDOMAsWebArchive().
+
+        * webarchive/archive-empty-frame-dom-expected.txt: Added.
+        * webarchive/archive-empty-frame-dom.html: Added.
+        * webarchive/archive-empty-frame-source-expected.txt: Added.
+        * webarchive/archive-empty-frame-source.html: Added.
+        * webarchive/resources/dump-webarchive.js: Renamed dumpAsWebArchive() to dumpDOMAsWebArchive().
+        * webarchive/test-body-background-expected.txt: Ditto.
+        * webarchive/test-body-background.html: Ditto.
+        * webarchive/test-duplicate-resources-expected.txt: Ditto.
+        * webarchive/test-frameset-expected.txt: Ditto.
+        * webarchive/test-frameset.html: Ditto.
+        * webarchive/test-img-src-expected.txt: Ditto.
+        * webarchive/test-img-src.html: Ditto.
+        * webarchive/test-input-src-expected.txt: Ditto.
+        * webarchive/test-input-src.html: Ditto.
+        * webarchive/test-link-href-expected.txt: Ditto.
+        * webarchive/test-link-href.html: Ditto.
+        * webarchive/test-object-data-expected.txt: Ditto.
+        * webarchive/test-object-data.html: Ditto.
+        * webarchive/test-script-src-expected.txt: Ditto.
+        * webarchive/test-table-background-expected.txt: Ditto.
+        * webarchive/test-table-background.html: Ditto.
+        * webarchive/test-td-background-expected.txt: Ditto.
+        * webarchive/test-td-background.html: Ditto.
+
+2007-03-07  David Kilzer  <ddkilzer@webkit.org>
+
         Reviewed by Mitz.
 
         - fix http://bugs.webkit.org/show_bug.cgi?id=12992
diff --git a/LayoutTests/webarchive/archive-empty-frame-dom-expected.txt b/LayoutTests/webarchive/archive-empty-frame-dom-expected.txt
new file mode 100644 (file)
index 0000000..b2a0a9f
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>WebMainResource</key>
+       <dict>
+               <key>WebResourceData</key>
+               <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;&lt;html&gt;&lt;head&gt;
+&lt;title&gt;Empty iFrame causes archive exception&lt;/title&gt;
+&lt;script&gt;
+    if (window.layoutTestController)
+        layoutTestController.dumpDOMAsWebArchive();
+&lt;/script&gt;
+&lt;/head&gt;&lt;body&gt;
+
+&lt;p&gt;
+Here lies an `iframe` with no content/src:
+&lt;/p&gt;&lt;p&gt;
+
+&lt;iframe id="emptyFrame" style="width: 100%; height: 100px; border: solid 2px red;"&gt;&lt;/iframe&gt;
+
+
+
+&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+               <key>WebResourceFrameName</key>
+               <string></string>
+               <key>WebResourceMIMEType</key>
+               <string>text/html</string>
+               <key>WebResourceTextEncodingName</key>
+               <string>UTF-8</string>
+               <key>WebResourceURL</key>
+               <string>file:///LayoutTests/webarchive/archive-empty-frame-dom.html</string>
+       </dict>
+       <key>WebSubframeArchives</key>
+       <array>
+               <dict>
+                       <key>WebMainResource</key>
+                       <dict>
+                               <key>WebResourceData</key>
+                               <string>&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;</string>
+                               <key>WebResourceFrameName</key>
+                               <string>emptyFrame</string>
+                               <key>WebResourceMIMEType</key>
+                               <string>text/html</string>
+                               <key>WebResourceTextEncodingName</key>
+                               <string>UTF-8</string>
+                               <key>WebResourceURL</key>
+                               <string>about:blank</string>
+                       </dict>
+               </dict>
+       </array>
+</dict>
+</plist>
diff --git a/LayoutTests/webarchive/archive-empty-frame-dom.html b/LayoutTests/webarchive/archive-empty-frame-dom.html
new file mode 100644 (file)
index 0000000..41b683e
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Empty iFrame causes archive exception</title>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpDOMAsWebArchive();
+</script>
+</head>
+<body>
+
+<p>
+Here lies an `iframe` with no content/src:
+<p>
+
+<iframe id="emptyFrame" style="width: 100%; height: 100px; border: solid 2px red;">
+</iframe>
+
+</body>
+</html>
diff --git a/LayoutTests/webarchive/archive-empty-frame-source-expected.txt b/LayoutTests/webarchive/archive-empty-frame-source-expected.txt
new file mode 100644 (file)
index 0000000..70b148a
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>WebMainResource</key>
+       <dict>
+               <key>WebResourceData</key>
+               <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd"&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;Empty iFrame causes archive exception&lt;/title&gt;
+&lt;script&gt;
+    if (window.layoutTestController)
+        layoutTestController.dumpSourceAsWebArchive();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;
+Here lies an `iframe` with no content/src:
+&lt;p&gt;
+
+&lt;iframe id="emptyFrame" style="width: 100%; height: 100px; border: solid 2px red;"&gt;
+&lt;/iframe&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+</string>
+               <key>WebResourceFrameName</key>
+               <string></string>
+               <key>WebResourceMIMEType</key>
+               <string>text/html</string>
+               <key>WebResourceURL</key>
+               <string>file:///LayoutTests/webarchive/archive-empty-frame-source.html</string>
+       </dict>
+</dict>
+</plist>
diff --git a/LayoutTests/webarchive/archive-empty-frame-source.html b/LayoutTests/webarchive/archive-empty-frame-source.html
new file mode 100644 (file)
index 0000000..df3deeb
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Empty iFrame causes archive exception</title>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpSourceAsWebArchive();
+</script>
+</head>
+<body>
+
+<p>
+Here lies an `iframe` with no content/src:
+<p>
+
+<iframe id="emptyFrame" style="width: 100%; height: 100px; border: solid 2px red;">
+</iframe>
+
+</body>
+</html>
index e7379ce..3a0103c 100644 (file)
@@ -1,2 +1,2 @@
 if (window.layoutTestController)
-    layoutTestController.dumpAsWebArchive();
+    layoutTestController.dumpDOMAsWebArchive();
index 1005fdd..4296f28 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;body background="resources/apple.gif"&gt;
 
index 1307275..6aa5785 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body background="resources/apple.gif">
index 6e0df59..8def5ff 100644 (file)
                <dict>
                        <key>WebResourceData</key>
                        <string>if (window.layoutTestController)
-    layoutTestController.dumpAsWebArchive();
+    layoutTestController.dumpDOMAsWebArchive();
 </string>
                        <key>WebResourceMIMEType</key>
                        <string>application/x-javascript</string>
                        b3BYJG9iamVjdHNfEA9OU0tleWVkQXJjaGl2ZXISAAGGoNEICV8Q
                        E1dlYlJlc291cmNlUmVzcG9uc2WAAaQLDBscVSRudWxs1w0ODxAR
                        EhMUFRYXGBkVUiQyUiQzUiQ0UiQwViRjbGFzc1IkNVIkMYACgAAQ
-                       ThAHgAMjf+////////+AAF8QGGFwcGxpY2F0aW9uL3gtamF2YXNj
+                       URAHgAMjf+////////+AAF8QGGFwcGxpY2F0aW9uL3gtamF2YXNj
                        cmlwdNIdHh8gWCRjbGFzc2VzWiRjbGFzc25hbWWiICFdTlNVUkxS
                        ZXNwb25zZVhOU09iamVjdAgRGyQpMkRJTGJkaW9+gYSHipGUl5mb
                        nZ+hqqzHzNXg4/EAAAAAAAABAQAAAAAAAAAiAAAAAAAAAAAAAAAA
index 627dee9..f886ea7 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;frameset rows="*"&gt;&lt;frame src="resources/test-frame.html" name="myframe"&gt;&lt;/frameset&gt;&lt;/html&gt;</string>
                <key>WebResourceFrameName</key>
index a0d5d53..79dfabf 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <frameset rows="*">
index aa8f4ba..667761b 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;body&gt;
   &lt;img src="resources/apple.gif"&gt;
index a220114..064e3da 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index 9f92432..81c329c 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;body&gt;
 &lt;form&gt;
index aaa31e5..a2ebdd8 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index 92f8800..ee1b3de 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;link rel="stylesheet" href="resources/test-style.css" type="text/css"&gt;
 &lt;/head&gt;&lt;body&gt;
index 425c7b3..367d5ba 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 <link rel="stylesheet" href="resources/test-style.css" type="text/css">
 </head>
index 6d8a83e..7d30dc7 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;body&gt;
   &lt;object data="resources/apple.gif" type="image/gif"&gt;&lt;/object&gt;
index c02de04..c134d8e 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index ab28a10..d1db287 100644 (file)
@@ -25,7 +25,7 @@
                <dict>
                        <key>WebResourceData</key>
                        <string>if (window.layoutTestController)
-    layoutTestController.dumpAsWebArchive();
+    layoutTestController.dumpDOMAsWebArchive();
 </string>
                        <key>WebResourceMIMEType</key>
                        <string>application/x-javascript</string>
@@ -35,7 +35,7 @@
                        b3BYJG9iamVjdHNfEA9OU0tleWVkQXJjaGl2ZXISAAGGoNEICV8Q
                        E1dlYlJlc291cmNlUmVzcG9uc2WAAaQLDBscVSRudWxs1w0ODxAR
                        EhMUFRYXGBkVUiQyUiQzUiQ0UiQwViRjbGFzc1IkNVIkMYACgAAQ
-                       ThAHgAMjf+////////+AAF8QGGFwcGxpY2F0aW9uL3gtamF2YXNj
+                       URAHgAMjf+////////+AAF8QGGFwcGxpY2F0aW9uL3gtamF2YXNj
                        cmlwdNIdHh8gWCRjbGFzc2VzWiRjbGFzc25hbWWiICFdTlNVUkxS
                        ZXNwb25zZVhOU09iamVjdAgRGyQpMkRJTGJkaW9+gYSHipGUl5mb
                        nZ+hqqzHzNXg4/EAAAAAAAABAQAAAAAAAAAiAAAAAAAAAAAAAAAA
index 9e7cbe4..e5b81b4 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;body&gt;
   &lt;table background="resources/apple.gif" style="width: 52px; height: 64px;"&gt;
index ee4d2e4..e26072a 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index e34578b..5f36d76 100644 (file)
@@ -8,7 +8,7 @@
                <string>&lt;html&gt;&lt;head&gt;
 &lt;script&gt;
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 &lt;/script&gt;
 &lt;/head&gt;&lt;body&gt;
   &lt;table&gt;
index 4a8f75c..b8f58fb 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index 66a39ce..e7371c4 100644 (file)
@@ -1,3 +1,22 @@
+2007-03-07  Jim Correia  <jim.correia@pobox.com>
+
+        Reviewed by Darin.
+
+        - WebCore part of fix for http://bugs.webkit.org/show_bug.cgi?id=12463
+          WebArchiver - attempt to insert nil exception when archive empty iframe
+
+        When dealing with an iframe element with no src attribute, the element contains
+        a src attribute in the DOM with a URL of "about:blank" and some HTML to implement
+        the blank page.  In the original page source, however, the iframe element does
+        not include a src attribute, which caused a nil archive to be returned for the
+        childFrameArchive and thus caused the bug.  The fix is a simple nil check.
+
+        Test: webarchive/archive-empty-frame-source.html
+
+        * WebView/WebArchiver.mm:
+        (+ (NSArray *)_subframeArchivesForFrame:(WebFrame *)frame): Don't add childFrameArchive 
+        to the subframeArchives array if it is nil.
+
 2007-03-06  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Darin
index 437171b..5e7edce 100644 (file)
@@ -50,8 +50,11 @@ using namespace WebCore;
     NSEnumerator *enumerator = [[frame childFrames] objectEnumerator];
     NSMutableArray *subframeArchives = [NSMutableArray array];
     WebFrame *childFrame;
-    while ((childFrame = [enumerator nextObject]))
-        [subframeArchives addObject:[self archiveFrame:childFrame]];
+    while ((childFrame = [enumerator nextObject])) {
+        WebArchive *childFrameArchive = [self archiveFrame:childFrame];
+        if (childFrameArchive)
+            [subframeArchives addObject:childFrameArchive];
+    }
 
     return subframeArchives;
 }
index ff05459..bf6129a 100644 (file)
@@ -1,3 +1,24 @@
+2007-03-07  David Kilzer  <ddkilzer@webkit.org>
+
+        Reviewed by Darin.
+
+        - WebKitTools part of fix for http://bugs.webkit.org/show_bug.cgi?id=12463
+          WebArchiver - attempt to insert nil exception when archive empty iframe
+
+        The dumpDOMAsWebArchive() test method uses the DOMDocument as a basis for creating
+        a webarchive while the dumpSourceAsWebArchive() test method uses the original
+        dataSource (page source) to create a webarchive.  Most tests currently use
+        dumpDOMAsWebArchive() since this is what Safari does when saving a web page as a
+        webarchive.
+
+        * DumpRenderTree/DumpRenderTree.m: Renamed dumpAsWebArchive to dumpDOMAsWebArchive.
+        Added dumpSourceAsWebArchive.
+        (dump):
+        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
+        (-[LayoutTestController dumpDOMAsWebArchive]):
+        (-[LayoutTestController dumpSourceAsWebArchive]):
+        (runTest):
+
 2007-03-05  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Mark and Dave H.
index cc961e3..9ff0141 100644 (file)
@@ -125,7 +125,8 @@ static WebFrame *topLoadingFrame;     // !nil iff a load is in progress
 static BOOL waitToDump;     // TRUE if waitUntilDone() has been called, but notifyDone() has not yet been called
 
 static BOOL dumpAsText;
-static BOOL dumpAsWebArchive;
+static BOOL dumpDOMAsWebArchive;
+static BOOL dumpSourceAsWebArchive;
 static BOOL dumpSelectionRect;
 static BOOL dumpTitleChanges;
 static BOOL dumpBackForwardList;
@@ -640,9 +641,12 @@ static void dump(void)
         if (dumpAsText) {
             DOMElement *documentElement = [[frame DOMDocument] documentElement];
             result = [[(DOMElement *)documentElement innerText] stringByAppendingString:@"\n"];
-        } else if (dumpAsWebArchive) {
+        } else if (dumpDOMAsWebArchive) {
             WebArchive *webArchive = [[frame DOMDocument] webArchive];
             result = serializeWebArchiveToXML(webArchive);
+        } else if (dumpSourceAsWebArchive) {
+            WebArchive *webArchive = [[frame dataSource] webArchive];
+            result = serializeWebArchiveToXML(webArchive);
         } else {
             bool isSVGW3CTest = ([currentTest rangeOfString:@"svg/W3C-SVG-1.1"].length);
             if (isSVGW3CTest)
@@ -656,14 +660,16 @@ static void dump(void)
             const char *errorMessage;
             if (dumpAsText)
                 errorMessage = "[documentElement innerText]";
-            else if (dumpAsWebArchive)
+            else if (dumpDOMAsWebArchive)
                 errorMessage = "[[frame DOMDocument] webArchive]";
+            else if (dumpSourceAsWebArchive)
+                errorMessage = "[[frame dataSource] webArchive]";
             else
                 errorMessage = "[frame renderTreeAsExternalRepresentation]";
             printf("ERROR: nil result from %s", errorMessage);
         } else {
             fputs([result UTF8String], stdout);
-            if (!dumpAsText && !dumpAsWebArchive)
+            if (!dumpAsText && !dumpDOMAsWebArchive && !dumpSourceAsWebArchive)
                 dumpFrameScrollPosition(frame);
         }
 
@@ -704,7 +710,7 @@ static void dump(void)
     }
     
     if (dumpPixels) {
-        if (!dumpAsText && !dumpAsWebArchive) {
+        if (!dumpAsText && !dumpDOMAsWebArchive && !dumpSourceAsWebArchive) {
             // grab a bitmap from the view
             WebView* view = [frame webView];
             NSSize webViewSize = [view frame].size;
@@ -909,7 +915,8 @@ static void dump(void)
     if (aSelector == @selector(waitUntilDone)
             || aSelector == @selector(notifyDone)
             || aSelector == @selector(dumpAsText)
-            || aSelector == @selector(dumpAsWebArchive)
+            || aSelector == @selector(dumpDOMAsWebArchive)
+            || aSelector == @selector(dumpSourceAsWebArchive)
             || aSelector == @selector(dumpTitleChanges)
             || aSelector == @selector(dumpBackForwardList)
             || aSelector == @selector(dumpChildFrameScrollPositions)
@@ -1017,9 +1024,14 @@ static void dump(void)
     [[WebPreferences standardPreferences] setUserStyleSheetEnabled:flag];
 }
 
-- (void)dumpAsWebArchive
+- (void)dumpDOMAsWebArchive
+{
+    dumpDOMAsWebArchive = YES;
+}
+
+- (void)dumpSourceAsWebArchive
 {
-    dumpAsWebArchive = YES;
+    dumpSourceAsWebArchive = YES;
 }
 
 - (void)dumpSelectionRect
@@ -1223,7 +1235,8 @@ static void runTest(const char *pathOrURL)
     topLoadingFrame = nil;
     waitToDump = NO;
     dumpAsText = NO;
-    dumpAsWebArchive = NO;
+    dumpDOMAsWebArchive = NO;
+    dumpSourceAsWebArchive = NO;
     dumpChildFrameScrollPositions = NO;
     shouldDumpEditingCallbacks = NO;
     shouldDumpResourceLoadCallbacks = NO;