LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2006 16:25:37 +0000 (16:25 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2006 16:25:37 +0000 (16:25 +0000)
        Reviewed by Maciej.

        Adding tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8121
        REGRESSION: 404s are not displayed
        and http://bugzilla.opendarwin.org/show_bug.cgi?id=7739
        REGRESSION: Assertion failure loading acid2 test in -[WebCoreFrameBridge installInFrame:]

        In addition I tweaked the httpd conf file to allow us to exec perl CGI scripts.

        * http/conf/httpd.conf:
        * http/tests/misc/error404-expected.checksum: Added.
        * http/tests/misc/error404-expected.png: Added.
        * http/tests/misc/error404-expected.txt: Added.
        * http/tests/misc/error404.pl: Added.
        * http/tests/misc/iframe404-expected.checksum: Added.
        * http/tests/misc/iframe404-expected.png: Added.
        * http/tests/misc/iframe404-expected.txt: Added.
        * http/tests/misc/iframe404.html: Added.

WebCore:

        Reviewed by Maciej.

        Support for fixing http://bugzilla.opendarwin.org/show_bug.cgi?id=8121
        REGRESSION: 404s are not displayed

        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge currentForm]): Nuke redundant nil check.
        (-[WebCoreFrameBridge frameElement]): Tweak to not rely on our document, which
        gives a correct result even at the start of our loading process.
        * bindings/objc/DOM.mm:
        (-[DOMDocument _ownerElement]): Nuke redundant nil check.

WebKit:

        Reviewed by Maciej.

        fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8121
        REGRESSION: 404s are not displayed

        * WebView/WebMainResourceLoader.m:
        (-[WebMainResourceLoader continueAfterContentPolicy:response:]):
        Only cancel failed loads for object elements, not for frames or a whole page.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/http/conf/httpd.conf
LayoutTests/http/tests/misc/error404-expected.checksum [new file with mode: 0644]
LayoutTests/http/tests/misc/error404-expected.png [new file with mode: 0644]
LayoutTests/http/tests/misc/error404-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/error404.pl [new file with mode: 0755]
LayoutTests/http/tests/misc/iframe404-expected.checksum [new file with mode: 0644]
LayoutTests/http/tests/misc/iframe404-expected.png [new file with mode: 0644]
LayoutTests/http/tests/misc/iframe404-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/iframe404.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/objc/DOM.mm
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebKit/ChangeLog
WebKit/WebView/WebMainResourceLoader.m

index 294804b..cad44a8 100644 (file)
@@ -1,3 +1,24 @@
+2006-04-02  Trey Matteson  <trey@usa.net>
+
+        Reviewed by Maciej.
+
+        Adding tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8121
+        REGRESSION: 404s are not displayed
+        and http://bugzilla.opendarwin.org/show_bug.cgi?id=7739
+        REGRESSION: Assertion failure loading acid2 test in -[WebCoreFrameBridge installInFrame:]
+
+        In addition I tweaked the httpd conf file to allow us to exec perl CGI scripts.
+
+        * http/conf/httpd.conf:
+        * http/tests/misc/error404-expected.checksum: Added.
+        * http/tests/misc/error404-expected.png: Added.
+        * http/tests/misc/error404-expected.txt: Added.
+        * http/tests/misc/error404.pl: Added.
+        * http/tests/misc/iframe404-expected.checksum: Added.
+        * http/tests/misc/iframe404-expected.png: Added.
+        * http/tests/misc/iframe404-expected.txt: Added.
+        * http/tests/misc/iframe404.html: Added.
+
 2006-04-02  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Hyatt.
index be39fc9..78d5188 100644 (file)
@@ -609,7 +609,7 @@ ServerSignature On
     #
     # To use CGI scripts:
     #
-    AddHandler cgi-script .cgi
+    AddHandler cgi-script .cgi .pl
 
     #
     # To use server-parsed HTML files
diff --git a/LayoutTests/http/tests/misc/error404-expected.checksum b/LayoutTests/http/tests/misc/error404-expected.checksum
new file mode 100644 (file)
index 0000000..e50e3ec
--- /dev/null
@@ -0,0 +1 @@
+01c527308e0c6210afa97a8af6faaa4a
\ No newline at end of file
diff --git a/LayoutTests/http/tests/misc/error404-expected.png b/LayoutTests/http/tests/misc/error404-expected.png
new file mode 100644 (file)
index 0000000..ae52315
Binary files /dev/null and b/LayoutTests/http/tests/misc/error404-expected.png differ
diff --git a/LayoutTests/http/tests/misc/error404-expected.txt b/LayoutTests/http/tests/misc/error404-expected.txt
new file mode 100644 (file)
index 0000000..3efea36
--- /dev/null
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {TEXT} at (0,0) size 364x18
+        text run at (0,0) width 364: "This 404 error was intentionally generated by a test script."
diff --git a/LayoutTests/http/tests/misc/error404.pl b/LayoutTests/http/tests/misc/error404.pl
new file mode 100755 (executable)
index 0000000..7d52675
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+# Simple script to generate a 404 HTTP error
+
+print "Status: 404 Not Found\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+print "<html><body>";
+print "This 404 error was intentionally generated by a test script.";
+print "</html></body>";
diff --git a/LayoutTests/http/tests/misc/iframe404-expected.checksum b/LayoutTests/http/tests/misc/iframe404-expected.checksum
new file mode 100644 (file)
index 0000000..f9b4d6a
--- /dev/null
@@ -0,0 +1 @@
+aa2b0a4b48a9d7cdf86cfcf566f18af5
\ No newline at end of file
diff --git a/LayoutTests/http/tests/misc/iframe404-expected.png b/LayoutTests/http/tests/misc/iframe404-expected.png
new file mode 100644 (file)
index 0000000..563850a
Binary files /dev/null and b/LayoutTests/http/tests/misc/iframe404-expected.png differ
diff --git a/LayoutTests/http/tests/misc/iframe404-expected.txt b/LayoutTests/http/tests/misc/iframe404-expected.txt
new file mode 100644 (file)
index 0000000..263c903
--- /dev/null
@@ -0,0 +1,48 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {TEXT} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {A} at (0,0) size 60x18 [color=#0000EE]
+          RenderText {TEXT} at (53,0) size 60x18
+            text run at (53,0) width 60: "bug 8121"
+        RenderText {TEXT} at (113,0) size 289x18
+          text run at (113,0) width 289: ": REGRESSION: 404s are not displayed and "
+        RenderInline {A} at (0,0) size 60x18 [color=#0000EE]
+          RenderText {TEXT} at (402,0) size 60x18
+            text run at (402,0) width 60: "bug 7739"
+        RenderText {TEXT} at (462,0) size 772x36
+          text run at (462,0) width 310: ": REGRESSION: Assertion failure loading acid2"
+          text run at (0,18) width 298: "test in -[WebCoreFrameBridge installInFrame:]"
+      RenderBlock {P} at (0,52) size 784x36
+        RenderText {TEXT} at (0,0) size 774x36
+          text run at (0,0) width 163: "Here is an invalid iframe. "
+          text run at (163,0) width 611: "It should contain a 404 error message, not any green fallback text. Note this will only work if this"
+          text run at (0,18) width 149: "page is fetched via http."
+      RenderBlock (anonymous) at (0,104) size 784x180
+        RenderPartObject {IFRAME} at (0,0) size 548x180
+          layer at (0,0) size 548x180
+            RenderCanvas at (0,0) size 548x180
+          layer at (0,0) size 548x180
+            RenderBlock {HTML} at (0,0) size 548x180
+              RenderBody {BODY} at (8,8) size 532x164
+                RenderText {TEXT} at (0,0) size 364x18
+                  text run at (0,0) width 364: "This 404 error was intentionally generated by a test script."
+        RenderText {TEXT} at (0,0) size 0x0
+      RenderBlock {P} at (0,300) size 784x18
+        RenderText {TEXT} at (0,0) size 487x18
+          text run at (0,0) width 161: "Here is an invalid object. "
+          text run at (161,0) width 326: "It should be rendered with some green fallback text."
+      RenderBlock (anonymous) at (0,334) size 784x18
+        RenderInline {OBJECT} at (0,0) size 77x18
+          RenderText {TEXT} at (0,0) size 0x0
+          RenderInline {SPAN} at (0,0) size 77x18 [color=#008000]
+            RenderText {TEXT} at (0,0) size 77x18
+              text run at (0,0) width 77: "fallback text"
+          RenderText {TEXT} at (0,0) size 0x0
+        RenderText {TEXT} at (0,0) size 0x0
+        RenderText {TEXT} at (0,0) size 0x0
+        RenderText {TEXT} at (0,0) size 0x0
diff --git a/LayoutTests/http/tests/misc/iframe404.html b/LayoutTests/http/tests/misc/iframe404.html
new file mode 100644 (file)
index 0000000..686944d
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+<head>
+<title>Test for 404 errors in iframes and objects</title>
+</head>
+<body>
+
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=8121">bug 8121</a>:
+REGRESSION: 404s are not displayed
+and <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7739">bug 7739</a>:
+REGRESSION: Assertion failure loading acid2 test in -[WebCoreFrameBridge installInFrame:]</p>
+
+<p>Here is an invalid iframe.  It should contain a 404 error message, not any green fallback text.
+Note this will only work if this page is fetched via http.</p>
+<iframe src="error404.pl" width="70%" height="180">
+<span style="color:green">fallback text</span>
+</iframe>
+
+
+<p>Here is an invalid object.  It should be rendered with some green fallback text.</p>
+<object data="404error.pl" type="image/x-unsupported" width=100 height=100>
+<span style="color:green">fallback text</span>
+</object>
+
+</body>
+</html>
index 3492e60..8c0dbde 100644 (file)
@@ -1,3 +1,17 @@
+2006-04-02  Trey Matteson  <trey@usa.net>
+
+        Reviewed by Maciej.
+
+        Support for fixing http://bugzilla.opendarwin.org/show_bug.cgi?id=8121
+        REGRESSION: 404s are not displayed
+
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge currentForm]): Nuke redundant nil check.
+        (-[WebCoreFrameBridge frameElement]): Tweak to not rely on our document, which
+        gives a correct result even at the start of our loading process.
+        * bindings/objc/DOM.mm:
+        (-[DOMDocument _ownerElement]): Nuke redundant nil check.
+
 2006-04-02  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by Maciej.
index 6fea9c5..a730259 100644 (file)
@@ -1180,8 +1180,7 @@ static ListenerMap *listenerMap;
 
 - (DOMElement *)_ownerElement
 {
-    Element *element = [self _document]->ownerElement();
-    return element ? [DOMElement _elementWith:element] : nil;
+    return [DOMElement _elementWith:[self _document]->ownerElement()];
 }
 
 @end
index 230814a..9173816 100644 (file)
@@ -1145,8 +1145,7 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
 
 - (DOMElement *)currentForm
 {
-    HTMLFormElement *formElement = m_frame->currentForm();
-    return formElement ? [DOMElement _elementWith:formElement] : nil;
+    return [DOMElement _elementWith:m_frame->currentForm()];
 }
 
 - (NSArray *)controlsInForm:(DOMElement *)form
@@ -1336,7 +1335,12 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
 
 - (DOMHTMLElement *)frameElement
 {
-    return (DOMHTMLElement *)[[self DOMDocument] _ownerElement];
+    // Not [[self DOMDocument] _ownerElement], since our doc is not set up at the start of our own load.
+    // FIXME: There really is no guarantee this is an HTML element.
+    // For example, it could be something like an SVG foreign object element.
+    // Because of that, I believe the cast here is wrong and also the public API
+    // of WebKit might have to be changed.
+    return (DOMHTMLElement *)[DOMElement _elementWith:m_frame->ownerElement()];
 }
 
 - (NSAttributedString *)selectedAttributedString
index 2319446..ea124b1 100644 (file)
@@ -1,3 +1,14 @@
+2006-04-02  Trey Matteson  <trey@usa.net>
+
+        Reviewed by Maciej.
+
+        fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8121
+        REGRESSION: 404s are not displayed
+
+        * WebView/WebMainResourceLoader.m:
+        (-[WebMainResourceLoader continueAfterContentPolicy:response:]):
+        Only cancel failed loads for object elements, not for frames or a whole page.
+
 2006-04-02  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Hyatt.
index ed4b65d..e92d3ac 100644 (file)
@@ -33,6 +33,7 @@
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLResponse.h>
 
+#import <WebKit/DOMHTML.h>
 #import <WebKit/WebDataProtocol.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebDefaultPolicyDelegate.h>
         int status = [(NSHTTPURLResponse *)r statusCode];
         if (status < 200 || status >= 300) {
             // Handle <object> fallback for error cases.
+            DOMHTMLElement *hostElement = [[[self dataSource] webFrame] frameElement];
             [[[dataSource webFrame] _bridge] handleFallbackContent];
-            [self cancel];
+            if (hostElement && [hostElement isKindOfClass:[DOMHTMLObjectElement class]])
+                // object elements are no longer rendered after we fallback, so don't
+                // keep trying to process data from their load
+                [self cancel];
         }
     }