зеркало из https://github.com/mozilla/gecko-dev.git
Bug 414907 - "Bookmarks icon is missing text when in Customize Toolbar mode" (do not remove attributes after removing broadcaster) [p=arenevier@fdn.fr (arno.) r=Neil sr=jst a1.9=schrep]
This commit is contained in:
Родитель
9e301bd4f0
Коммит
fa6bbdba96
|
@ -664,8 +664,7 @@ CanBroadcast(PRInt32 aNameSpaceID, nsIAtom* aAttribute)
|
|||
void
|
||||
nsXULDocument::SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
|
||||
nsIDOMElement *aListener,
|
||||
const nsAString &aAttr,
|
||||
PRBool aAddingListener)
|
||||
const nsAString &aAttr)
|
||||
{
|
||||
nsCOMPtr<nsIContent> broadcaster = do_QueryInterface(aBroadcaster);
|
||||
nsCOMPtr<nsIContent> listener = do_QueryInterface(aListener);
|
||||
|
@ -685,14 +684,10 @@ nsXULDocument::SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
|
|||
if (! CanBroadcast(nameSpaceID, name))
|
||||
continue;
|
||||
|
||||
if (aAddingListener) {
|
||||
nsAutoString value;
|
||||
broadcaster->GetAttr(nameSpaceID, name, value);
|
||||
listener->SetAttr(nameSpaceID, name, attrName->GetPrefix(),
|
||||
value, mInitialLayoutComplete);
|
||||
} else {
|
||||
listener->UnsetAttr(nameSpaceID, name, mInitialLayoutComplete);
|
||||
}
|
||||
nsAutoString value;
|
||||
broadcaster->GetAttr(nameSpaceID, name, value);
|
||||
listener->SetAttr(nameSpaceID, name, attrName->GetPrefix(), value,
|
||||
mInitialLayoutComplete);
|
||||
|
||||
#if 0
|
||||
// XXX we don't fire the |onbroadcast| handler during
|
||||
|
@ -709,14 +704,10 @@ nsXULDocument::SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
|
|||
nsCOMPtr<nsIAtom> name = do_GetAtom(aAttr);
|
||||
|
||||
nsAutoString value;
|
||||
if (broadcaster->GetAttr(kNameSpaceID_None, name, value)
|
||||
&& aAddingListener) {
|
||||
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
|
||||
|
@ -813,7 +804,7 @@ nsXULDocument::AddBroadcastListenerFor(nsIDOMElement* aBroadcaster,
|
|||
|
||||
entry->mListeners.AppendElement(bl);
|
||||
|
||||
SynchronizeBroadcastListener(aBroadcaster, aListener, aAttr, PR_TRUE);
|
||||
SynchronizeBroadcastListener(aBroadcaster, aListener, aAttr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -848,7 +839,7 @@ nsXULDocument::RemoveBroadcastListenerFor(nsIDOMElement* aBroadcaster,
|
|||
PL_DHashTableOperate(mBroadcasterMap, aBroadcaster,
|
||||
PL_DHASH_REMOVE);
|
||||
|
||||
SynchronizeBroadcastListener(aBroadcaster, aListener, aAttr, PR_FALSE);
|
||||
SynchronizeBroadcastListener(aBroadcaster, aListener, aAttr);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -528,8 +528,7 @@ protected:
|
|||
void
|
||||
SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
|
||||
nsIDOMElement *aListener,
|
||||
const nsAString &aAttr,
|
||||
PRBool aAddingListener);
|
||||
const nsAString &aAttr);
|
||||
|
||||
static
|
||||
nsresult
|
||||
|
|
|
@ -49,6 +49,7 @@ _TEST_FILES = \
|
|||
test_bug199692.xul \
|
||||
test_bug391002.xul \
|
||||
test_bug403868.xul \
|
||||
test_bug414907.xul \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -34,15 +34,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391002
|
|||
$("btn1").setAttribute("command", "cmd2");
|
||||
is($("btn1").getAttribute("label"), $("cmd2").getAttribute("label"))
|
||||
|
||||
$("btn1").removeAttribute("command");
|
||||
is($("btn1").getAttribute("label"), "");
|
||||
|
||||
$("observes").setAttribute("element", "cmd2");
|
||||
is($("btn2").getAttribute("label"), $("cmd2").getAttribute("label"))
|
||||
|
||||
$("observes").removeAttribute("element");
|
||||
todo_is($("btn2").getAttribute("label"), "");
|
||||
|
||||
]]></script>
|
||||
</window>
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<?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=414907
|
||||
-->
|
||||
<window title="Mozilla Bug 414907"
|
||||
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"/>
|
||||
|
||||
<bindings xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<binding id="anon">
|
||||
<implementation>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var node = this.firstChild;
|
||||
this.palette = node;
|
||||
this.removeChild(node);
|
||||
]]>
|
||||
</constructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
||||
<!-- 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=414907"
|
||||
target="_blank">Mozilla Bug 414907</a>
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function onload() {
|
||||
is($("box").palette.getAttribute("label"), $("command").getAttribute("label"));
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
]]></script>
|
||||
|
||||
<command id="command" label="label"/>
|
||||
|
||||
<box id="box" style="-moz-binding:url('#anon');">
|
||||
<button observes="command"/>
|
||||
</box>
|
||||
|
||||
|
||||
|
||||
</window>
|
Загрузка…
Ссылка в новой задаче