From 8012a0f31ea59c9505868ad7e77a2a72a370c211 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Mon, 30 Jan 2012 15:29:09 -0500 Subject: [PATCH] tab-bar, new-tabs: set ordinal after adding new tab to tab bar This works around a bug in XULRunner 1.9.x whereby ordinals fail to be applied in some cases. A related, but slightly different issue is here: https://bugzilla.mozilla.org/show_bug.cgi?id=555987 It seems likely that the fix for the above bugzilla bug also fixed the bug we are seeing with tab-bar and new-tabs, because it only happens in XULRunner < 2.0. --- modules/new-tabs.js | 5 ++++- modules/tab-bar.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/new-tabs.js b/modules/new-tabs.js index 42006a4..6d30be5 100644 --- a/modules/new-tabs.js +++ b/modules/new-tabs.js @@ -129,7 +129,6 @@ function tab_bar_add_buffer (buffer, noupdate) { } }, false /* not capturing */); tab.setAttribute("selected", "false"); - tab.setAttribute("ordinal", ordinal); // Create the label to hold the buffer icon var image = create_XUL(buffer.window, "image"); @@ -167,6 +166,10 @@ function tab_bar_add_buffer (buffer, noupdate) { tabbar.element.appendChild(tab); buffer.tab = tab; tab_bar_update_buffer_title(buffer); + + // Note, XULRunner 1.9.x puts the tab in the wrong location if we set + // the ordinal before adding the tab to the tab-bar. + tab.setAttribute("ordinal", ordinal); } diff --git a/modules/tab-bar.js b/modules/tab-bar.js index b0c5061..33d0f7e 100644 --- a/modules/tab-bar.js +++ b/modules/tab-bar.js @@ -89,7 +89,6 @@ function tab_bar_add_buffer (b, noupdate) { tab.buffer.window.buffers.current = tab.buffer; }, false /* not capturing */); tab.setAttribute("selected", "false"); - tab.setAttribute("ordinal", ordinal); var image = create_XUL(b.window, "image"); image.setAttribute("class", "tab-icon"); if (b.icon != null) @@ -111,6 +110,10 @@ function tab_bar_add_buffer (b, noupdate) { t.element.appendChild(tab); b.tab = tab; tab_bar_update_buffer_title(b); + + // Note, XULRunner 1.9.x puts the tab in the wrong location if we set + // the ordinal before adding the tab to the tab-bar. + tab.setAttribute("ordinal", ordinal); } function tab_bar_kill_buffer (b) { -- 2.11.4.GIT