Bug 17253 - parser does not create nodes inside <iframe> (test 4 in Acid3 'ignoring whitespace during NodeIterator walk' fails)
Summary: parser does not create nodes inside <iframe> (test 4 in Acid3 'ignoring white...
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Dave Hyatt
Keywords: HasReduction
Depends on:
Blocks: Acid3
  Show dependency treegraph
Reported: 2008-02-09 01:34 PST by Eric Seidel (no email)
Modified: 2008-02-10 14:30 PST (History)
3 users (show)

See Also:

possible test case? (FF and Opera fail too) (356 bytes, text/html)
2008-02-09 02:02 PST, Eric Seidel (no email)
no flags Details
Remove the special skipMode behavior for iframes. (1.27 KB, patch)
2008-02-10 12:49 PST, Dave Hyatt
hyatt: review-
Details | Formatted Diff | Diff
Treat <iframe> like <title> and <textarea>, since that's what it is really supposed to be like. (7.09 KB, patch)
2008-02-10 13:04 PST, Dave Hyatt
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-02-09 01:34:39 PST
Acid3 test ignoring whitespace during NodeIterator walk fails

Test 4: expected: null, got: [object HTMLIFrameElement] - expectation 21 failed

This will need further reduction.

    function () {
      // test 4: ignoring whitespace text nodes with node iterators
      var count = 0;
      var expect = function(node1, node2) {
        count += 1;
        assertEquals(node1, node2, "expectation " + count + " failed");
      var allButWS = function (node) {
        if (node.nodeType == 3 && node.data.match(/^\s*$/))
          return 2;
        return 1;
      var i = document.createNodeIterator(document.body, 0x01 | 0x04 | 0x08 | 0x10 | 0x20, allButWS, true);
      // now walk the document body and make sure everything is in the right place
      expect(i.nextNode(), document.body); // 1
      expect(i.nextNode(), document.getElementsByTagName('h1')[0]);
      expect(i.nextNode(), document.getElementsByTagName('h1')[0].firstChild);
      expect(i.nextNode(), document.getElementsByTagName('div')[0]);
      expect(i.nextNode(), document.getElementById('bucket1'));
      expect(i.nextNode(), document.getElementById('bucket2'));
      expect(i.nextNode(), document.getElementById('bucket3'));
      expect(i.nextNode(), document.getElementById('bucket4'));
      expect(i.nextNode(), document.getElementById('bucket5'));
      expect(i.nextNode(), document.getElementById('bucket6')); // 10
      expect(i.nextNode(), document.getElementById('result'));
      expect(i.nextNode(), document.getElementById('score'));
      expect(i.nextNode(), document.getElementById('score').firstChild);
      expect(i.nextNode(), document.getElementById('slash'));
      expect(i.nextNode(), document.getElementById('slash').firstChild);
      expect(i.nextNode(), document.getElementById('slash').nextSibling);
      expect(i.nextNode(), document.getElementById('slash').nextSibling.firstChild);
      expect(i.nextNode(), document.getElementsByTagName('map')[0]);
      expect(i.nextNode(), document.getElementsByTagName('area')[0]);
      expect(i.nextNode(), document.getElementsByTagName('iframe')[0]); // 20
      expect(i.nextNode(), document.getElementsByTagName('iframe')[0].firstChild);
      expect(i.nextNode(), document.getElementsByTagName('iframe')[1]);
      expect(i.nextNode(), document.getElementsByTagName('iframe')[1].firstChild);
      expect(i.nextNode(), document.getElementsByTagName('iframe')[2]);
      expect(i.nextNode(), document.forms[0]);
      expect(i.nextNode(), document.forms.form.elements[0]);
      expect(i.nextNode(), document.getElementsByTagName('table')[0]);
      expect(i.nextNode(), document.getElementsByTagName('tbody')[0]);
      expect(i.nextNode(), document.getElementsByTagName('tr')[0]);
      expect(i.nextNode(), document.getElementsByTagName('td')[0]);
      expect(i.nextNode(), document.getElementsByTagName('td')[0].getElementsByTagName('p')[0]);
      expect(i.nextNode(), document.getElementById('instructions'));
      expect(i.nextNode(), document.getElementById('instructions').firstChild);
      expect(i.nextNode().nodeName, "SPAN");
      expect(i.nextNode().nodeName, "#text");
      expect(i.nextNode(), document.links[1]);
      expect(i.nextNode(), document.links[1].firstChild);
      expect(i.nextNode(), document.getElementById('instructions').lastChild);
      expect(i.nextNode(), null);
      // walk it backwards for good measure
      expect(i.previousNode(), document.getElementById('instructions').lastChild);
      expect(i.previousNode(), document.links[1].firstChild);
      expect(i.previousNode(), document.links[1]);
      expect(i.previousNode().nodeName, "#text");
      expect(i.previousNode().nodeName, "SPAN");
      expect(i.previousNode(), document.getElementById('instructions').firstChild);
      expect(i.previousNode(), document.getElementById('instructions'));
      expect(i.previousNode(), document.getElementsByTagName('td')[0].getElementsByTagName('p')[0]);
      expect(i.previousNode(), document.getElementsByTagName('td')[0]);
      expect(i.previousNode(), document.getElementsByTagName('tr')[0]);
      expect(i.previousNode(), document.getElementsByTagName('tbody')[0]);
      expect(i.previousNode(), document.getElementsByTagName('table')[0]);
      expect(i.previousNode(), document.forms.form.elements[0]);
      expect(i.previousNode(), document.forms[0]);
      expect(i.previousNode(), document.getElementsByTagName('iframe')[2]);
      expect(i.previousNode(), document.getElementsByTagName('iframe')[1].firstChild);
      expect(i.previousNode(), document.getElementsByTagName('iframe')[1]);
      expect(i.previousNode(), document.getElementsByTagName('iframe')[0].firstChild);
      expect(i.previousNode(), document.getElementsByTagName('iframe')[0]); // 20
      expect(i.previousNode(), document.getElementsByTagName('area')[0]);
      expect(i.previousNode(), document.getElementsByTagName('map')[0]);
      expect(i.previousNode(), document.getElementById('slash').nextSibling.firstChild);
      expect(i.previousNode(), document.getElementById('slash').nextSibling);
      expect(i.previousNode(), document.getElementById('slash').firstChild);
      expect(i.previousNode(), document.getElementById('slash'));
      expect(i.previousNode(), document.getElementById('score').firstChild);
      expect(i.previousNode(), document.getElementById('score'));
      expect(i.previousNode(), document.getElementById('result'));
      expect(i.previousNode(), document.getElementById('bucket6'));
      expect(i.previousNode(), document.getElementById('bucket5'));
      expect(i.previousNode(), document.getElementById('bucket4'));
      expect(i.previousNode(), document.getElementById('bucket3'));
      expect(i.previousNode(), document.getElementById('bucket2'));
      expect(i.previousNode(), document.getElementById('bucket1'));
      expect(i.previousNode(), document.getElementsByTagName('div')[0]);
      expect(i.previousNode(), document.getElementsByTagName('h1')[0].firstChild);
      expect(i.previousNode(), document.getElementsByTagName('h1')[0]);
      expect(i.previousNode(), document.body);
      expect(i.previousNode(), null);
      return 1;
Comment 1 Eric Seidel (no email) 2008-02-09 02:02:37 PST
Created attachment 19015 [details]
possible test case? (FF and Opera fail too)
Comment 2 Darin Adler 2008-02-09 07:19:00 PST
I added Hixie to the CC list because I thought this was a bug in the test. But I'm not so sure now. I'll investigate this some soon.
Comment 3 Darin Adler 2008-02-10 12:27:24 PST
The failure remaining seems to have nothing to do with NodeIterator.

The problem is that this is an <iframe> with a src that fails to load. At some point, when the load fails, presumably we are supported to fall back and display the fallback content instead as we do with <object>.

I don't know what the test does to ensure that it doesn't try to run *before* the <iframe> has tried and failed to load its src, but I'm presuming it does something. If it doesn't then there could be an Acid3 bug.

Then we have to make sure that the error from the server is treated as a failure. And make sure we do fallback. As far as I can tell we don't even try to do fallback for <iframe>. In fact, until now I had been under the impression that <iframe> was supposed to fall back only for browsers that don't support <iframe>, not for missing resources.
Comment 4 Dave Hyatt 2008-02-10 12:30:01 PST
This is news to me.  I had no idea <iframe> was supposed to do this.

Comment 5 Dave Hyatt 2008-02-10 12:31:15 PST
Are you sure this isn't just a bug where the fallback content is always supposed to be present in the DOM?
Comment 6 Dave Hyatt 2008-02-10 12:49:22 PST
Created attachment 19046 [details]
Remove the special skipMode behavior for iframes.
Comment 7 Dave Hyatt 2008-02-10 12:52:29 PST
Comment on attachment 19046 [details]
Remove the special skipMode behavior for iframes.

Never mind. It's more complicated than this.  We need to enter a special "CDATA parsing mode" according to HTML5.  What is inside the <iframe> should be treated as simple text.
Comment 8 Dave Hyatt 2008-02-10 13:04:35 PST
Created attachment 19047 [details]
Treat <iframe> like <title> and <textarea>, since that's what it is really supposed to be like.
Comment 9 Dave Hyatt 2008-02-10 14:30:24 PST
Fixed in r30127.