content/base/test/chrome/test_bug339494.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/chrome/test_bug339494.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=339494
     1.9 +-->
    1.10 +<window title="Mozilla Bug 339494"
    1.11 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.12 +  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.13 +
    1.14 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    1.15 +
    1.16 +<body  xmlns="http://www.w3.org/1999/xhtml">
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +  <xul:hbox id="d"/>
    1.21 +  <xul:hbox id="s"/>
    1.22 +</div>
    1.23 +<pre id="test">
    1.24 +</pre>
    1.25 +</body>
    1.26 +
    1.27 +<script class="testbody" type="application/javascript">
    1.28 +
    1.29 +/** Test for Bug 339494 **/
    1.30 +
    1.31 +  var d = document.getElementById("d");
    1.32 +  
    1.33 +  d.setAttribute("hhh", "testvalue");
    1.34 +
    1.35 +  document.addEventListener("DOMAttrModified", removeItAgain, false);
    1.36 +  d.removeAttribute("hhh");
    1.37 +  document.removeEventListener("DOMAttrModified", removeItAgain, false);
    1.38 +
    1.39 +  function removeItAgain()
    1.40 +  {
    1.41 +    ok(!d.hasAttribute("hhh"), "Value check 1",
    1.42 +       "There should be no value");
    1.43 +    isnot(d.getAttribute("hhh"), "testvalue", "Value check 2");
    1.44 +    document.removeEventListener("DOMAttrModified", removeItAgain, false);
    1.45 +    d.removeAttribute("hhh");
    1.46 +    ok(true, "Reachability", "We shouldn't have crashed");
    1.47 +  }
    1.48 +  
    1.49 +  var s = document.getElementById("s");
    1.50 +  
    1.51 +  s.setAttribute("ggg", "testvalue");
    1.52 +
    1.53 +  document.addEventListener("DOMAttrModified", compareVal, false);
    1.54 +  s.setAttribute("ggg", "othervalue");
    1.55 +  document.removeEventListener("DOMAttrModified", compareVal, false);
    1.56 +
    1.57 +  function compareVal()
    1.58 +  {
    1.59 +    ok(s.hasAttribute("ggg"), "Value check 3",
    1.60 +       "There should be a value");
    1.61 +    isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
    1.62 +    is(s.getAttribute("ggg"), "othervalue", "Value check 5");
    1.63 +  }
    1.64 +
    1.65 +</script>
    1.66 +
    1.67 +</window>

mercurial