LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 * running). | 146 * running). |
147 */ | 147 */ |
148 eventsPosted: 0, | 148 eventsPosted: 0, |
149 | 149 |
150 /** | 150 /** |
151 * Starts the initial scan of the window (will recurse into frames). | 151 * Starts the initial scan of the window (will recurse into frames). |
152 * @param {Window} wnd the window to be scanned | 152 * @param {Window} wnd the window to be scanned |
153 */ | 153 */ |
154 startScan: function(wnd) | 154 startScan: function(wnd) |
155 { | 155 { |
156 let currentThread = Services.tm.currentThread; | |
157 | |
158 let doc = wnd.document; | 156 let doc = wnd.document; |
159 let walker = doc.createTreeWalker(doc, Ci.nsIDOMNodeFilter.SHOW_ELEMENT, nul
l, false); | 157 let walker = doc.createTreeWalker(doc, Ci.nsIDOMNodeFilter.SHOW_ELEMENT, nul
l, false); |
160 | 158 |
161 let process = function() | 159 let process = function() |
162 { | 160 { |
163 if (!this.listener) | 161 if (!this.listener) |
164 return; | 162 return; |
165 | 163 |
166 let node = walker.currentNode; | 164 let node = walker.currentNode; |
167 let data = getEntry(nodeData, node); | 165 let data = getEntry(nodeData, node); |
(...skipping 11 matching lines...) Expand all Loading... |
179 | 177 |
180 this.eventsPosted--; | 178 this.eventsPosted--; |
181 if (!this.eventsPosted) | 179 if (!this.eventsPosted) |
182 { | 180 { |
183 this.scanComplete = true; | 181 this.scanComplete = true; |
184 this.notifyListener(wnd, null, null); | 182 this.notifyListener(wnd, null, null); |
185 } | 183 } |
186 } | 184 } |
187 }.bind(this); | 185 }.bind(this); |
188 | 186 |
189 // Process each node in a separate event on current thread to allow other | 187 // Process each node in a separate event to allow other events to process |
190 // events to process | |
191 this.eventsPosted++; | 188 this.eventsPosted++; |
192 Utils.runAsync(process); | 189 Utils.runAsync(process); |
193 } | 190 } |
194 }; | 191 }; |
195 | 192 |
196 RequestNotifier.storeSelection = function(/**Window*/ wnd, /**String*/ selection
) | 193 RequestNotifier.storeSelection = function(/**Window*/ wnd, /**String*/ selection
) |
197 { | 194 { |
198 setEntry(windowSelection, wnd.document, selection); | 195 setEntry(windowSelection, wnd.document, selection); |
199 }; | 196 }; |
200 RequestNotifier.getSelection = function(/**Window*/ wnd) /**String*/ | 197 RequestNotifier.getSelection = function(/**Window*/ wnd) /**String*/ |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 if (typeof existingData == "undefined") | 364 if (typeof existingData == "undefined") |
368 { | 365 { |
369 existingData = {}; | 366 existingData = {}; |
370 setEntry(nodeData, node, existingData); | 367 setEntry(nodeData, node, existingData); |
371 } | 368 } |
372 | 369 |
373 // Add this request to the node data | 370 // Add this request to the node data |
374 existingData[this.type + " " + this.location] = this; | 371 existingData[this.type + " " + this.location] = this; |
375 } | 372 } |
376 }; | 373 }; |
LEFT | RIGHT |