| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 let EXPORTED_SYMBOLS = ["shutdown", "getNodeInfo", "togglePreview", | 7 let EXPORTED_SYMBOLS = ["shutdown", "getNodeInfo", "togglePreview", |
| 8 "forgetNode"]; | 8 "forgetNode"]; |
| 9 | 9 |
| 10 const Ci = Components.interfaces; | 10 const Ci = Components.interfaces; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 DebuggerServer.addTabActor(actor, name); | 28 DebuggerServer.addTabActor(actor, name); |
| 29 | 29 |
| 30 let shutdown = (function() | 30 let shutdown = (function() |
| 31 { | 31 { |
| 32 let executed = false; | 32 let executed = false; |
| 33 return function() | 33 return function() |
| 34 { | 34 { |
| 35 if (!executed) | 35 if (!executed) |
| 36 DebuggerServer.removeTabActor(actor); | 36 { |
| 37 executed = true; | 37 executed = true; |
| 38 try | |
| 39 { | |
| 40 DebuggerServer.removeTabActor(actor); | |
| 41 } | |
| 42 catch (e) | |
| 43 { | |
| 44 // The call above will throw in the content process despite succeeding, | |
| 45 // see https://bugzilla.mozilla.org/show_bug.cgi?id=1189780. | |
| 46 Cu.reportError(e); | |
| 47 } | |
| 48 } | |
| 38 } | 49 } |
| 39 })(); | 50 })(); |
| 40 | 51 |
| 41 function Actor(connection, tabActor) | 52 function Actor(connection, tabActor) |
| 42 { | 53 { |
| 43 } | 54 } |
| 44 | 55 |
| 45 Actor.prototype = { | 56 Actor.prototype = { |
| 46 requestTypes: { | 57 requestTypes: { |
| 47 nodeinfo: function(request, connection) | 58 nodeinfo: function(request, connection) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 context.document.documentElement.appendChild(context.style); | 146 context.document.documentElement.appendChild(context.style); |
| 136 } | 147 } |
| 137 context.style.textContent = stylesheetData; | 148 context.style.textContent = stylesheetData; |
| 138 } | 149 } |
| 139 else | 150 else |
| 140 { | 151 { |
| 141 try | 152 try |
| 142 { | 153 { |
| 143 if (context.style && context.style.parentNode) | 154 if (context.style && context.style.parentNode) |
| 144 context.style.parentNode.removeChild(context.style); | 155 context.style.parentNode.removeChild(context.style); |
| 156 context.style = null; | |
| 145 } | 157 } |
| 146 catch (e) | 158 catch (e) |
| 147 { | 159 { |
| 148 // If the window was closed (reloaded) we end up with dead object | 160 // If the window was closed (reloaded) we end up with a dead object |
| 149 // reference (https://bugzilla.mozilla.org/show_bug.cgi?id=695480). Just | 161 // reference (https://bugzilla.mozilla.org/show_bug.cgi?id=695480). Just |
| 150 // ignore this case, we don't need to do anything. | 162 // forget this node then. |
|
Thomas Greiner
2015/07/31 12:48:03
If the context is no longer valid anyway, what abo
Wladimir Palant
2015/07/31 14:40:04
Done.
| |
| 163 forgetNode(nodeID); | |
| 151 } | 164 } |
| 152 context.style = null; | |
| 153 } | 165 } |
| 154 } | 166 } |
| 155 | 167 |
| 156 function forgetNode(nodeID) | 168 function forgetNode(nodeID) |
| 157 { | 169 { |
| 158 nodes.delete(nodeID); | 170 nodes.delete(nodeID); |
| 159 } | 171 } |
| LEFT | RIGHT |