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

Delta Between Two Patch Sets: chrome/content/frameScript.js

Issue 29332893: Issue 3431 - Element Hiding Helper shutdown fails (shutdown is not a function) (Closed)
Left Patch Set: Created Dec. 21, 2015, 12:16 p.m.
Right Patch Set: Fixed style Created Dec. 21, 2015, 7:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/content/actor.jsm ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 (function() 7 (function()
8 { 8 {
9 const Cu = Components.utils; 9 const Cu = Components.utils;
10 10
11 let rand = Components.stack.filename.replace(/.*\?/, ""); 11 let rand = Components.stack.filename.replace(/.*\?/, "");
12 let module = "chrome://elemhidehelper/content/actor.jsm?" + rand; 12 let module = "chrome://elemhidehelper/content/actor.jsm?" + rand;
13 let {shutdown, getNodeInfo, togglePreview, forgetNode} = Cu.import(module, {}) ; 13 let {shutdown, getNodeInfo, togglePreview, forgetNode} = Cu.import(module, {}) ;
14 14
15 addMessageListener("ElemHideHelper:Shutdown", onShutdown); 15 addMessageListener("ElemHideHelper:Shutdown", onShutdown);
16 addMessageListener("ElemHideHelper:GetNodeInfo", onGetNodeInfo); 16 addMessageListener("ElemHideHelper:GetNodeInfo", onGetNodeInfo);
17 addMessageListener("ElemHideHelper:Preview", onTogglePreview); 17 addMessageListener("ElemHideHelper:Preview", onTogglePreview);
18 18
19 function onShutdown() 19 function onShutdown()
20 { 20 {
21 shutdown(); 21 shutdown();
22 try { 22 try
23 {
23 Cu.unload(module); 24 Cu.unload(module);
24 } catch (e) { 25 }
saroyanm 2015/12/21 13:45:18 Nit: please move catch to it's own line to make it
Wladimir Palant 2015/12/21 19:01:59 Done.
26 catch (e)
27 {
25 Cu.reportError(e); 28 Cu.reportError(e);
26 } 29 }
27 30
28 removeMessageListener("ElemHideHelper:Shutdown", onShutdown); 31 removeMessageListener("ElemHideHelper:Shutdown", onShutdown);
29 removeMessageListener("ElemHideHelper:GetNodeInfo", onGetNodeInfo); 32 removeMessageListener("ElemHideHelper:GetNodeInfo", onGetNodeInfo);
30 removeMessageListener("ElemHideHelper:Preview", onTogglePreview); 33 removeMessageListener("ElemHideHelper:Preview", onTogglePreview);
31 } 34 }
32 35
33 function onGetNodeInfo(message) 36 function onGetNodeInfo(message)
34 { 37 {
35 let nodeInfo = getNodeInfo(message.objects.element); 38 let nodeInfo = getNodeInfo(message.objects.element);
36 nodeInfo.messageId = message.data; 39 nodeInfo.messageId = message.data;
37 sendAsyncMessage("ElemHideHelper:GetNodeInfo:Response", nodeInfo); 40 sendAsyncMessage("ElemHideHelper:GetNodeInfo:Response", nodeInfo);
38 } 41 }
39 42
40 function onTogglePreview(message) 43 function onTogglePreview(message)
41 { 44 {
42 togglePreview(message.data.nodeID, message.data.stylesheetData); 45 togglePreview(message.data.nodeID, message.data.stylesheetData);
43 if (message.data.forgetNode) 46 if (message.data.forgetNode)
44 forgetNode(message.data.nodeID); 47 forgetNode(message.data.nodeID);
45 } 48 }
46 })(); 49 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld