Index: lib/child/commands.js |
=================================================================== |
--- a/lib/child/commands.js |
+++ b/lib/child/commands.js |
@@ -11,22 +11,24 @@ let {getNodeInfo} = require("./nodeInfo" |
let { |
state, selectElement, setAnchorElement, stopSelection |
} = require("./selection"); |
let {getParentElement} = require("./utils"); |
messageManager.addMessageListener("ElemHideHelper:Command", onCommand); |
messageManager.addMessageListener("ElemHideHelper:SerializeSelected", |
serializeSelected); |
+messageManager.addMessageListener("ElemHideHelper:GetHTML", getHTML); |
onShutdown.add(() => |
{ |
messageManager.removeMessageListener("ElemHideHelper:Command", onCommand); |
messageManager.removeMessageListener("ElemHideHelper:SerializeSelected", |
serializeSelected); |
+ messageManager.removeMessageListener("ElemHideHelper:GetHTML", getHTML); |
}); |
function onCommand(message) |
{ |
let command = message.data; |
if (typeof exports[command] == "function") |
exports[command](); |
} |
@@ -66,16 +68,25 @@ function serializeNode(node) |
function serializeSelected(message) |
{ |
messageManager.sendAsyncMessage("ElemHideHelper:Response", { |
messageId: message.data.messageId, |
serialized: serializeNode(state.selectedElement) |
}); |
} |
+function getHTML(message) |
+{ |
+ messageManager.sendAsyncMessage("ElemHideHelper:Response", { |
+ messageId: message.data.messageId, |
+ html: state.selectedElement.outerHTML, |
+ baseURI: state.selectedElement.baseURI |
+ }); |
+} |
+ |
function quit() |
{ |
stopSelection(); |
} |
exports.quit = quit; |
function select() |
{ |