error when closing buffer during page load fixed
commit70b650a2bded370bc2f2514083fd274d8aacb1ec
authorJohn Foerch <jjfoerch@earthlink.net>
Wed, 23 Sep 2009 03:39:56 +0000 (22 23:39 -0400)
committerJohn Foerch <jjfoerch@earthlink.net>
Wed, 23 Sep 2009 03:39:56 +0000 (22 23:39 -0400)
tree3aad007ae4f846fd53d64099eb4f7c6ca77bbc30
parentc54c6f34d9dd6c0a0d2b12d68608bafb93e81a77
error when closing buffer during page load fixed

  In buffer_container.kill_buffer, there is a line like the following,
which removes a buffer element from its buffer_container:

   this.container.removeChild(b.element);

  When the buffer in question has a webProgressListener, as the case with
content_buffer, that listener's onStateChange method gets called with
STATE_STOP and STATE_IS_NETWORK.  In other words, the page stops loading,
because the browser it is in is being destroyed.  This progress listener
in content_buffer responds to this particular message by trying to do
several things in the user interface, such as displaying a "Done" message
in the minibuffer.  But when the destruction of the buffer is what
triggers these events, the attempted UI actions result in errors like
this:

   Console error: [JavaScript Error: "this.container.selectedPanel is
   undefined" {file: "chrome://conkeror/content/buffer.js" line: 271}]
   Category: XPConnect JavaScript

  This patch stops those errors by introducing a new method to `buffer'
and `content_buffer' called `destructor'.  This destructor gets called
just before the offending removeChild, giving the content_buffer a chance
to remove its progress listener.
modules/buffer.js
modules/content-buffer.js