Bug 418216 - "Back button greys when toolbar reset to default" [p=arenevier@fdn.fr (arno.) r=Enn sr=Neil a=blocking-firefox3+]
authorreed@reedloden.com
Sun, 24 Feb 2008 22:14:44 -0800
changeset 12191 66327523aa6345f0679257a717f682dd723b7a06
parent 12190 e77169593c7aec4f7ff349afc96cf41ff9805de2
child 12192 29142039ad9b4099ffb205bbcd112a801be19b44
push idunknown
push userunknown
push dateunknown
reviewersEnn, Neil, blocking-firefox3
bugs418216
milestone1.9b4pre
Bug 418216 - "Back button greys when toolbar reset to default" [p=arenevier@fdn.fr (arno.) r=Enn sr=Neil a=blocking-firefox3+]
content/xul/document/src/nsXULDocument.cpp
content/xul/document/test/Makefile.in
content/xul/document/test/test_bug418216.xul
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -702,16 +702,19 @@ nsXULDocument::SynchronizeBroadcastListe
     else {
         // Find out if the attribute is even present at all.
         nsCOMPtr<nsIAtom> name = do_GetAtom(aAttr);
 
         nsAutoString value;
         if (broadcaster->GetAttr(kNameSpaceID_None, name, value)) {
             listener->SetAttr(kNameSpaceID_None, name, value,
                               mInitialLayoutComplete);
+        } else {
+            listener->UnsetAttr(kNameSpaceID_None, name,
+                                mInitialLayoutComplete);
         }
 
 #if 0
         // XXX we don't fire the |onbroadcast| handler during initial
         // hookup: doing so would potentially run the |onbroadcast|
         // handler before the |onload| handler, which could define JS
         // properties that mask XBL properties, etc.
         ExecuteOnBroadcastHandlerFor(broadcaster, aListener, name);
--- a/content/xul/document/test/Makefile.in
+++ b/content/xul/document/test/Makefile.in
@@ -45,12 +45,13 @@ include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES	= \
 		test_bug311681.xul \
 		test_bug199692.xul \
 		test_bug391002.xul \
 		test_bug403868.xul \
 		test_bug414907.xul \
+		test_bug418216.xul \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/content/xul/document/test/test_bug418216.xul
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=418216
+-->
+<window title="Mozilla Bug 418216"
+  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <script type="application/javascript" src="/MochiKit/packed.js" />
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
+
+  <!-- test resuls are displayed in the html:body -->
+  <body xmlns="http://www.w3.org/1999/xhtml">
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=418216"
+     target="_blank">Mozilla Bug 418216</a>
+  </body>
+
+  <!-- test code goes here -->
+  <script type="application/javascript"><![CDATA[
+
+    /** Test for Bug 418216 **/
+  SimpleTest.waitForExplicitFinish();
+  function onload() {
+    var element = $("item");
+    $("container").removeChild($("item"));
+    $("broadcaster").removeAttribute("disabled");
+    $("container").appendChild(element);
+    is($("item").hasAttribute("disabled"), $("broadcaster").hasAttribute("disabled"));
+    SimpleTest.finish();
+  }
+
+
+
+
+  ]]></script>
+
+<box id="container">
+<textbox id="item">
+    <observes element="broadcaster" attribute="disabled"/>
+</textbox>
+</box>
+
+<broadcasterset>
+    <broadcaster id="broadcaster" disabled="true"/>
+</broadcasterset>
+
+</window>