From b432b8233d98df6aafb2382070cef2f63c239910 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Tue, 6 Sep 2011 21:10:28 -0400 Subject: [PATCH] initialize_first_buffer_type: workaround for missing scrollbar issue resolves http://bugs.conkeror.org/issue351 see also, https://bugzilla.mozilla.org/show_bug.cgi?id=656517 --- modules/buffer.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/buffer.js b/modules/buffer.js index a93894d..ecb0301 100644 --- a/modules/buffer.js +++ b/modules/buffer.js @@ -68,10 +68,7 @@ function buffer (window) { var element = create_XUL(window, "vbox"); element.setAttribute("flex", "1"); var browser = create_XUL(window, "browser"); - if (window.buffers.count == 0) - browser.setAttribute("type", "content-primary"); - else - browser.setAttribute("type", "content"); + browser.setAttribute("type", "content"); browser.setAttribute("flex", "1"); browser.setAttribute("autocompletepopup", "popup_autocomplete"); element.appendChild(browser); @@ -498,6 +495,20 @@ function buffer_initialize_window_early (window) { add_hook("window_initialize_early_hook", buffer_initialize_window_early); +/** + * initialize_first_buffer_type is a workaround for a XULRunner bug that + * first appeared in version 2.0, manifested as missing scrollbars in the + * first buffer of any window. It only affects content-primary browsers, + * and the workaround is to initialize the browser as type "content" then + * change it to content-primary after a delay. + */ +function initialize_first_buffer_type (window) { + window.buffers.current.browser.setAttribute("type", "content-primary"); +} + +add_hook("window_initialize_late_hook", initialize_first_buffer_type); + + define_buffer_local_hook("buffer_kill_before_hook", RUN_HOOK_UNTIL_FAILURE); function buffer_before_window_close (window) { var bs = window.buffers; -- 2.11.4.GIT