dom/events/test/test_bug391568.xhtml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <?xml version="1.0"?>
     2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xbl="http://www.mozilla.org/xbl">
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=391568
     5 -->
     6 <head>
     7   <title>Test for Bug 391568</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    10   <script>
    11     var constructorFired = 0;
    12   </script>
    13   <xbl:bindings>
    14     <xbl:binding id="test">
    15       <xbl:content><span>
    16         (anonumous content)
    17         <span><xbl:children/></span>
    18         (anonumous content)</span>
    19       </xbl:content>
    21       <xbl:implementation>
    22         <xbl:constructor>
    23           var win = XPCNativeWrapper.unwrap(window);
    24           ++win.constructorFired;
    25           document.getAnonymousNodes(this)[0].addEventListener(
    26             "DOMCharacterDataModified", 
    27             function(evt) {
    28               ++win.characterdatamodified;
    29             },
    30             true);
    31         </xbl:constructor>
    32       </xbl:implementation>
    33     </xbl:binding>
    34   </xbl:bindings>
    35 </head>
    36 <body>
    37 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391568">Mozilla Bug 391568</a>
    38 <p id="display"></p>
    39 <div id="content">
    40   <span style="-moz-binding: url(#test);"><span id="real1">(real content)</span></span>
    41   <span style="-moz-binding: url(#test);"><span id="real2">(real content)</span></span>
    42 </div>
    43 <pre id="test">
    44 <script class="testbody" type="text/javascript">
    45 <![CDATA[
    47 /** Test for Bug 391568 **/
    49 var characterdatamodified = 0;
    51 document.getElementById('real1').addEventListener(
    52   "DOMCharacterDataModified", 
    53   function(evt) {},
    54   true);
    56 function testListeners() {
    57   if (constructorFired < 2) {
    58     setTimeout(testListeners, 0);
    59     return;
    60   }
    61   document.getElementById('real1').firstChild.data = "(real content 2)";
    62   ok(characterdatamodified == 1,
    63      "There is a DOMCharacterDataModified listener in anonymous content which didn't get called (1)!");
    64   document.getElementById('real2').firstChild.data = "(real content 2)";
    65   ok(characterdatamodified == 2,
    66      "There is a DOMCharacterDataModified listener in anonymous content which didn't get called (2)!");
    67   SimpleTest.finish();
    68 }
    70 SimpleTest.waitForExplicitFinish();
    71 addLoadEvent(testListeners);
    72 ]]>
    73 </script>
    74 </pre>
    75 </body>
    76 </html>

mercurial