Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 | 203 |
204 isPending: () => false, | 204 isPending: () => false, |
205 cancel: notImplemented, | 205 cancel: notImplemented, |
206 suspend: notImplemented, | 206 suspend: notImplemented, |
207 resume: notImplemented, | 207 resume: notImplemented, |
208 | 208 |
209 QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) | 209 QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) |
210 }; | 210 }; |
211 | 211 |
212 /** | 212 /** |
213 * Channel returning CSS data for the global stylesheet. | 213 * Channel returning CSS data for the global as well as site-specific stylesheet . |
kzar
2016/10/06 12:10:46
Nit: I guess this comment should be updated now it
Wladimir Palant
2016/10/06 12:27:28
Done.
| |
214 * @constructor | 214 * @constructor |
215 */ | 215 */ |
216 function StyleDataChannel(uri, loadInfo, domain) | 216 function StyleDataChannel(uri, loadInfo, domain) |
217 { | 217 { |
218 BaseChannel.call(this, uri, loadInfo); | 218 BaseChannel.call(this, uri, loadInfo); |
219 this._domain = domain; | 219 this._domain = domain; |
220 } | 220 } |
221 StyleDataChannel.prototype = { | 221 StyleDataChannel.prototype = { |
222 __proto__: BaseChannel.prototype, | 222 __proto__: BaseChannel.prototype, |
223 contentType: "text/css", | 223 contentType: "text/css", |
224 _domain: null, | 224 _domain: null, |
225 | 225 |
226 _getResponse: function() | 226 _getResponse: function() |
227 { | 227 { |
228 function escapeChar(match) | 228 function escapeChar(match) |
229 { | 229 { |
230 return "\\" + match.charCodeAt(0).toString(16) + " "; | 230 return "\\" + match.charCodeAt(0).toString(16) + " "; |
231 } | 231 } |
232 | 232 |
233 // Would be great to avoid sync messaging here but nsIStyleSheetService | 233 // Would be great to avoid sync messaging here but nsIStyleSheetService |
234 // insists on opening channels synchronously. | 234 // insists on opening channels synchronously. |
235 let [selectors, keys] = (this._domain ? | 235 let [selectors, keys] = (this._domain ? |
236 port.emitSync("getSelectorsForDomain", this._domain) : | 236 port.emitSync("getSelectorsForDomain", this._domain) : |
kzar
2016/10/06 12:10:46
Dumb question but how does getSelectorsForDomain a
Wladimir Palant
2016/10/06 12:27:28
This is the content process - we cannot require El
kzar
2016/10/06 13:02:32
Ah I see.
| |
237 port.emitSync("getUnconditionalSelectors")); | 237 port.emitSync("getUnconditionalSelectors")); |
238 | 238 |
239 let cssPrefix = "{-moz-binding: url(about:abp-elemhide?hit"; | 239 let cssPrefix = "{-moz-binding: url(about:abp-elemhide?hit"; |
240 let cssSuffix = "#dummy) !important;}\n"; | 240 let cssSuffix = "#dummy) !important;}\n"; |
241 let result = []; | 241 let result = []; |
242 | 242 |
243 for (let i = 0; i < selectors.length; i++) | 243 for (let i = 0; i < selectors.length; i++) |
244 { | 244 { |
245 let selector = selectors[i]; | 245 let selector = selectors[i]; |
246 let key = keys[i]; | 246 let key = keys[i]; |
(...skipping 22 matching lines...) Expand all Loading... | |
269 _getResponse: function() | 269 _getResponse: function() |
270 { | 270 { |
271 let window = Utils.getRequestWindow(this); | 271 let window = Utils.getRequestWindow(this); |
272 port.emitWithResponse("registerElemHideHit", { | 272 port.emitWithResponse("registerElemHideHit", { |
273 key: this.key, | 273 key: this.key, |
274 frames: getFrames(window), | 274 frames: getFrames(window), |
275 isPrivate: isPrivate(window) | 275 isPrivate: isPrivate(window) |
276 }).then(hit => | 276 }).then(hit => |
277 { | 277 { |
278 if (hit) | 278 if (hit) |
279 RequestNotifier.addNodeData(window.document, window.top, hit); | 279 RequestNotifier.addNodeData(window.document, window.top, hit); |
kzar
2016/10/06 13:02:32
(Doesn't storing all the details returned by regis
Wladimir Palant
2016/10/06 13:08:48
That's how the list of blockable items works - it
| |
280 }); | 280 }); |
281 return "<bindings xmlns='http://www.mozilla.org/xbl'/>"; | 281 return "<bindings xmlns='http://www.mozilla.org/xbl'/>"; |
282 } | 282 } |
283 }; | 283 }; |
284 | 284 |
285 let observer = { | 285 let observer = { |
286 QueryInterface: XPCOMUtils.generateQI([ | 286 QueryInterface: XPCOMUtils.generateQI([ |
287 Ci.nsIObserver, Ci.nsISupportsWeakReference | 287 Ci.nsIObserver, Ci.nsISupportsWeakReference |
288 ]), | 288 ]), |
289 | 289 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 else if (filter) | 382 else if (filter) |
383 { | 383 { |
384 RequestNotifier.addNodeData(window.document, window.top, { | 384 RequestNotifier.addNodeData(window.document, window.top, { |
385 contentType, docDomain, thirdParty, location, filter, filterType | 385 contentType, docDomain, thirdParty, location, filter, filterType |
386 }); | 386 }); |
387 } | 387 } |
388 }); | 388 }); |
389 } | 389 } |
390 }; | 390 }; |
391 observer.init(); | 391 observer.init(); |
LEFT | RIGHT |