From: Jeremy Maitin-Shepard Date: Sat, 9 Feb 2013 23:11:09 +0000 (-0800) Subject: content-handler.js: fix incorrect call to get_buffer_from_frame X-Git-Tag: debian-1.0--pre-1+git160130-1~181 X-Git-Url: https://repo.or.cz/w/conkeror.git/commitdiff_plain/78f655c695ff3d7fd6da0bc3de3549259372997d content-handler.js: fix incorrect call to get_buffer_from_frame As a result, the fallback on get_recent_conkeror_window() was always being used, which resulted in non-working downloads in the case where the user has set browser_default_open_target = OPEN_NEW_WINDOW and the download link results in a new window being opened by Mozilla. Additionally, some error messages were added for cases that should not normally occur, so that other bugs in content-handler.js will be more easily noticed in the future. --- diff --git a/modules/content-handler.js b/modules/content-handler.js index 3f0aa8b..f1a938b 100644 --- a/modules/content-handler.js +++ b/modules/content-handler.js @@ -35,8 +35,10 @@ function content_handler_context (launcher, context) { Ci.nsIDOMWindow : Ci.nsIDOMWindowInternal) this.window = get_window_from_frame(this.frame); - this.buffer = get_buffer_from_frame(this.frame); + this.buffer = get_buffer_from_frame(this.window, this.frame); } catch (e) { + dumpln("Error: Failed to find buffer corresponding to content handler context"); + dump_error(e); this.window = get_recent_conkeror_window(); if (this.window) { this.buffer = this.window.buffers.current; @@ -223,6 +225,7 @@ download_helper.prototype = { show: function (launcher, context, reason) { var ctx = new content_handler_context(launcher, context); if (! ctx.window) { + dumpln("Warning: Aborting download because of lack of window"); ctx.abort(); //XXX: impolite; need better solution. return; }