<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>16743</bug_id>
          
          <creation_ts>2008-01-05 13:58:32 -0800</creation_ts>
          <short_desc>Acid3 expects NodeIterator.nextNode to forward exceptions from the filter</short_desc>
          <delta_ts>2019-02-06 09:02:54 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>4714</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>16744</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Seidel (no email)">eric</reporter>
          <assigned_to name="Darin Adler">darin</assigned_to>
          <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>ian</cc>
    
    <cc>mjs</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66295</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-01-05 13:58:32 -0800</bug_when>
    <thetext>Test 5: FAIL (method [object NodeIterator].nextNode() didn&apos;t forward exception)

    // DOM Traversal
    function () {
      // test 5: NodeFilters and Exceptions
      var doc = getTestDocument();
      var iteration = 0;
      var exception = &quot;Roses&quot;;
      var test = function(node) {
        iteration += 1;
        switch (iteration) {
          case 1, 3, 4, 6, 7, 8, 9, 12: throw exception;
          case 2, 5, 10, 11: return true;
          default: throw 0;
        };
      };
      var check = function(o, method) {
        var ok = false;
        try {
          o[method]();
        } catch (e) {
          if (e === exception)
            ok = true;
        }
        assert(ok, &quot;method &quot; + o + &quot;.&quot; + method + &quot;() didn&apos;t forward exception&quot;);
      };
      var i = doc.createNodeIterator(doc.documentElement, 0xFFFFFFFF, test, true);
      check(i, &quot;nextNode&quot;); // 1
      assert(i.nextNode() == doc.documentElement, &quot;i.nextNode() didn&apos;t return the right node&quot;); // 2
      check(i, &quot;previousNode&quot;); // 3
      var w = document.createTreeWalker(doc.documentElement, 0xFFFFFFFF, test, true);
      check(w, &quot;nextNode&quot;); // 4
      assert(w.nextNode() == doc.documentElement.firstChild, &quot;w.nextNode() didn&apos;t return the right node&quot;); // 5
      check(w, &quot;previousNode&quot;); // 6
      check(w, &quot;firstChild&quot;); // 7
      check(w, &quot;lastChild&quot;); // 8
      check(w, &quot;nextSibling&quot;); // 9
      assert(w.previousSibling() == null, &quot;w.previousSibling() didn&apos;t return the right node&quot;); // 10
      assert(w.nextSibling() == null, &quot;w.nextSibling() didn&apos;t return the right node&quot;); // 11
      check(w, &quot;previousSibling&quot;); // 12
      return 1;
    },</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66391</commentid>
    <comment_count>1</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-06 13:25:44 -0800</bug_when>
    <thetext>Our traversal functions are so broken, this is only the tip of the iceberg. But it&apos;s straightforward to fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66396</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-01-06 14:17:35 -0800</bug_when>
    <thetext>If you&apos;d like to check in a test case which demonstrates the total brokeness (with lots of FAILs), that&apos;s fine by me. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66463</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-07 10:20:26 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; If you&apos;d like to check in a test case which demonstrates the total brokeness
&gt; (with lots of FAILs), that&apos;s fine by me. :)

Sure, I&apos;ll try to find the time to do that.

In the past, I had decided it was pointless to worry about these rarely-used classes, which is why I didn&apos;t bother.

The design is fairly tricky -- there are all sorts of edge cases because of the involvement of the filter function and the fact that it can manipulate the very tree its filtering, so writing a test is a bit challenging.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66553</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-08 09:36:01 -0800</bug_when>
    <thetext>This is an unusual requirement. There&apos;s nowhere else in the DOM where we expect exceptions to propagate through the DOM. This causes problems for the language-independent DOM -- it&apos;s not necessarily simple to propagate exceptions from any binding language through the DOM.

Are we sure this is a requirement? It&apos;s not hard for me to implement, but I&apos;m worried it&apos;s not the right thing to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66560</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-08 10:30:08 -0800</bug_when>
    <thetext>This code is incorrect JavaScript:

        switch (iteration) {
          case 1, 3, 4, 6, 7, 8, 9, 12: throw exception;
          case 2, 5, 10, 11: return true;
          default: throw 0;
        };

Those cases are only for the values 12 and 11. It needs to be changed to this:

    switch (iteration) {
        case 1: case 3: case 4: case 6: case 7: case 8: case 9: case 12: throw &quot;Roses&quot;;
        case 2: case 5: case 10: case 11: return true;
        default: throw 0;
    }

CC&apos;ing Hixie so he sees this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66561</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-08 10:43:24 -0800</bug_when>
    <thetext>I found another error in the test:

      assert(w.previousSibling() == null, &quot;w.previousSibling() didn&apos;t return the right node&quot;); // 10

The above line will not call the filter, because there&apos;s no node to filter (it&apos;s null). So this does not increment the iteration count. I don&apos;t know what the contents of the test document are, so I&apos;m not sure about the validity of the next two test steps. I had to change them for my test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66576</commentid>
    <comment_count>7</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-08 13:04:08 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 4714 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66610</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2008-01-08 19:49:26 -0800</bug_when>
    <thetext>I tried to fix the test, let me know if i missed something.
Thanks for the help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1502866</commentid>
    <comment_count>9</comment_count>
    <who name="Lucas Forschler">lforschler</who>
    <bug_when>2019-02-06 09:02:54 -0800</bug_when>
    <thetext>Mass moving XML DOM bugs to the &quot;DOM&quot; Component.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>