Bug 1341562 - fix CustomizableUI's overflow insertion to not break if buttons aren't where we expect them, r=jaws

MozReview-Commit-ID: Fs9IYC4bvL9

--HG--
extra : rebase_source : af948f85e4675b0e83abbe6e554646b13603111a
This commit is contained in:
Gijs Kruitbosch 2017-03-22 19:50:53 +00:00
Родитель 5a12fa89ac
Коммит 29bf378255
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -4215,7 +4215,10 @@ OverflowableToolbar.prototype = {
let inserted = false;
for (; beforeNodeIndex < placements.length; beforeNodeIndex++) {
let beforeNode = this._target.getElementsByAttribute("id", placements[beforeNodeIndex])[0];
if (beforeNode) {
// Unfortunately, XUL add-ons can mess with nodes after they are inserted,
// and this breaks the following code if the button isn't where we expect
// it to be (ie not a child of the target). In this case, ignore the node.
if (beforeNode && this._target == beforeNode.parentElement) {
this._target.insertBefore(child, beforeNode);
inserted = true;
break;