Bug 361785 - adoptNode as needed.

JavaScript Debugger only.
r=rginda
This commit is contained in:
silver%warwickcompsoc.co.uk 2006-12-19 21:00:10 +00:00
parent ffc51bbca3
commit fc56d4b31e
2 changed files with 32 additions and 3 deletions

View File

@ -263,7 +263,7 @@ function cmgr_instkey (parentElem, command)
return;
}
var key = document.createElement ("key");
var key = parentElem.ownerDocument.createElement ("key");
key.setAttribute ("id", "key:" + command.name);
key.setAttribute ("oncommand", "dispatch('" + command.name +
"', {isInteractive: true});");

View File

@ -1663,7 +1663,7 @@ function ss_hookDisplay (e)
if (sessionView.messageCount == console.prefs["sessionView.maxHistory"])
sessionView.outputTBody.removeChild(sessionView.outputTBody.firstChild);
sessionView.outputTBody.appendChild(msgRow);
sessionView.outputTBody.appendChild(sessionView.adoptNode(msgRow));
sessionView.scrollDown();
}
@ -1763,7 +1763,9 @@ function ss_syncframe ()
if (this.outputTable.firstChild)
this.outputTable.removeChild (this.outputTable.firstChild);
this.outputTable.appendChild (this.outputTBody);
// Make sure the entire table body belongs to the right document.
this.adoptNode(this.outputTBody, this.outputDocument);
this.outputTable.appendChild(this.outputTBody);
this.scrollDown();
}
@ -1774,6 +1776,33 @@ function ss_scroll()
this.outputWindow.scrollTo(0, this.outputDocument.height);
}
console.views.session.adoptNode =
function ss_adoptnode(node, doc)
{
// Assume the node is about to added as a session message, so use that doc.
if (typeof doc == "undefined")
doc = this.outputTBody.ownerDocument;
try
{
doc.adoptNode(node);
}
catch(ex)
{
dd(formatException(ex));
var err = ex.name;
// TypeError from before adoptNode was added; NOT_IMPL after.
if ((err == "TypeError") || (err == "NS_ERROR_NOT_IMPLEMENTED"))
console.views.session.adoptNode = ss_adoptnode_noop;
}
return node;
}
function ss_adoptnode_noop(node, doc)
{
return node;
}
console.views.session.onShow =
function ss_show ()
{