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

Side by Side Diff: lib/child/commands.js

Issue 29402624: Issue 5097, issue 5099 - Only retrieve element source from the process actually selecting (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper/
Patch Set: Created April 4, 2017, 6 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This Source Code is subject to the terms of the Mozilla Public License 2 * This Source Code is subject to the terms of the Mozilla Public License
3 * version 2.0 (the "License"). You can obtain a copy of the License at 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 "use strict"; 7 "use strict";
8 8
9 let messageManager = require("messageManager"); 9 let messageManager = require("messageManager");
10 let {getNodeInfo} = require("./nodeInfo"); 10 let {getNodeInfo} = require("./nodeInfo");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 type: node.nodeType == node.TEXT_NODE ? "text" : "comment", 60 type: node.nodeType == node.TEXT_NODE ? "text" : "comment",
61 text: node.textContent 61 text: node.textContent
62 }; 62 };
63 break; 63 break;
64 } 64 }
65 return result; 65 return result;
66 } 66 }
67 67
68 function serializeSelected(message) 68 function serializeSelected(message)
69 { 69 {
70 if (!state.selectedElement)
71 return;
72
70 messageManager.sendAsyncMessage("ElemHideHelper:Response", { 73 messageManager.sendAsyncMessage("ElemHideHelper:Response", {
71 messageId: message.data.messageId, 74 messageId: message.data.messageId,
72 serialized: serializeNode(state.selectedElement) 75 serialized: serializeNode(state.selectedElement)
73 }); 76 });
74 } 77 }
75 78
76 function getHTML(message) 79 function getHTML(message)
77 { 80 {
81 if (!state.selectedElement)
82 return;
83
78 messageManager.sendAsyncMessage("ElemHideHelper:Response", { 84 messageManager.sendAsyncMessage("ElemHideHelper:Response", {
79 messageId: message.data.messageId, 85 messageId: message.data.messageId,
80 html: state.selectedElement.outerHTML, 86 html: state.selectedElement.outerHTML,
81 baseURI: state.selectedElement.baseURI 87 baseURI: state.selectedElement.baseURI
82 }); 88 });
83 } 89 }
84 90
85 function quit() 91 function quit()
86 { 92 {
87 stopSelection(); 93 stopSelection();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 counter: 0, 199 counter: 0,
194 element: state.selectedElement, 200 element: state.selectedElement,
195 origVisibility: state.selectedElement.style.visibility, 201 origVisibility: state.selectedElement.style.visibility,
196 timer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer) 202 timer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
197 }; 203 };
198 204
199 blinkState.timer.initWithCallback(doBlink, 250, 205 blinkState.timer.initWithCallback(doBlink, 250,
200 Ci.nsITimer.TYPE_REPEATING_SLACK); 206 Ci.nsITimer.TYPE_REPEATING_SLACK);
201 } 207 }
202 exports.blinkElement = blinkElement; 208 exports.blinkElement = blinkElement;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld