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 227cb4f34aeb311e311d38d657846b2d80a60352..93197ae577fb5ecce742b6baa435e4eb87ee2e8f 100644 (file)
@@ -1,3 +1,39 @@
+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.
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 e7379cee516e12d43e2190c7ad8f77e1d5a25235..3a0103c2bcf8c2a7da3972c4597b1e64955622b7 100644 (file)
@@ -1,2 +1,2 @@
 if (window.layoutTestController)
-    layoutTestController.dumpAsWebArchive();
+    layoutTestController.dumpDOMAsWebArchive();
index 1005fdd540e139125e688ef6af6de2ee8f7487ba..4296f289d02373976045972af055d09b12ee47ac 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 1307275f300cde8d48c633d6782c7e51b3560c9f..6aa578599a37cd467ab5f8a1b19bc3cdac64d41b 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body background="resources/apple.gif">
index 6e0df598dec05da49312485fe978b541fac2e68e..8def5ff43b94aa09bf129a4771d17dbbd2a366f2 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 627dee9d5e9f41762faa9377b61fc61f344dfd61..f886ea721418fd54ae2abdb11506233ed2c9ca46 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 a0d5d530761ecd0a9b583f4d3c8a3bc3b40a7636..79dfabf9fc29e2f962e27ff16964712c87c92248 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <frameset rows="*">
index aa8f4bafd55eb0a6323683f2d08007c85891b5cb..667761b04ba917d51e0c87c234ed5841174660c8 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 a220114c7ea48c5319e258097d2d009074725eae..064e3da7af59e39d521992991a0f39da72debf1b 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index 9f924322824f5dc7259c244cc73da18bc1eda2b2..81c329cfad08587ff7acd9e8c75165e1f84c57f6 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 aaa31e5305bbb64eeb4ada405c969a6aa065c752..a2ebdd886b85b92b23572a13229b36cd3c9910c2 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index 92f88006326b6efd2c9a527ce61562eda36f3f19..ee1b3de643457a44e5ee77327015789fe73cfa9c 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 425c7b3c09834e487253119b09fb1de198e09b7c..367d5ba074a7c1c9dfbe2440a4ad469ee6d8e3a7 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 6d8a83e9d5718188856c80af781260fa3bc0b846..7d30dc7c54099502fc8f90db468f2740b2b8ee2b 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 c02de042e2a81563554054eb5588d5920de04a25..c134d8e5aef33db7c70d2fedb5dbee824b7bcf51 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index ab28a10193ae73ec85bf29e0f6ced3ac41b171d2..d1db287a1ca39d00db0af6b7f8ef3bbc957e4a22 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 9e7cbe492a6ea5e83652dde6a0525c69ec98e83f..e5b81b4bba4e13114b85513cca20613d6b1a4b4c 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 ee4d2e46e11aaa83f69b203fbbd16ffb895ee6aa..e26072a14baf6de31cac4b2f9cc691640e1f7913 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index e34578b9e3bb300dec03acfe2cf8b3008e86abe2..5f36d76639cf0ef6851058f372357b779d0b118d 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 4a8f75c94c5cb432d929163a3fe73f49e00e6da7..b8f58fba4311522154653586b129e53765f4dea5 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <script>
     if (window.layoutTestController)
-        layoutTestController.dumpAsWebArchive();
+        layoutTestController.dumpDOMAsWebArchive();
 </script>
 </head>
 <body>
index 66a39ce1b727199ac6f770dd9cce8b08a07066d0..e7371c41127bdb7b59c2158f37a5a05ce7d2f1ee 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 437171bf91eaa7a1692cb2aa94de3db572aa4f71..5e7edce88dd2a9ac7c4287ef96a80f85fc06c288 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 ff05459c45840082b0fe1d4f764f331431ba8d77..bf6129a0957735740b8644c67cf88dede822f76d 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 cc961e3e208b5008914d45d30a9ad30dbedfb251..9ff0141ffe39ecf977f5663d81f54a8e367d1c81 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;