Bug 1306124 - Consistently emit the last rendered message in dom for jsterm.execute and with new-messages event;r=linclark

MozReview-Commit-ID: 5100HMmdTr2
This commit is contained in:
Brian Grinstead
2016-09-28 14:28:58 -07:00
parent acd6ee3a29
commit 8ea60d6962
3 changed files with 11 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ const FilterBar = React.createFactory(require("devtools/client/webconsole/new-co
const store = configureStore();
function NewConsoleOutputWrapper(parentNode, jsterm, toolbox, owner) {
this.parentNode = parentNode;
this.parentNode = parentNode;
this.jsterm = jsterm;
this.toolbox = toolbox;
@@ -68,6 +69,12 @@ NewConsoleOutputWrapper.prototype = {
dispatchMessagesClear: () => {
store.dispatch(actions.messagesClear());
},
getLastMessage: function() {
// Return the last message in the DOM as the message that was just dispatched. This may not
// always be correct in the case of filtered messages, but it's close enough for our tests.
let messageNodes = this.parentNode.querySelectorAll(".message");
return messageNodes[messageNodes.length - 1]
},
};
// Exports from this module