Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/child/commands.js

Issue 29366556: Issue 2879 - Make "view source in separate window" command work again (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Patch Set: Created Dec. 1, 2016, 11:03 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/aardvark.js ('K') | « lib/aardvark.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
{
« lib/aardvark.js ('K') | « lib/aardvark.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld