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 const Cc = Components.classes; | 7 const Cc = Components.classes; |
8 const Ci = Components.interfaces; | 8 const Ci = Components.interfaces; |
9 const Cr = Components.results; | 9 const Cr = Components.results; |
10 const Cu = Components.utils; | 10 const Cu = Components.utils; |
11 | 11 |
12 Cu.import("resource://gre/modules/Services.jsm"); | 12 Cu.import("resource://gre/modules/Services.jsm"); |
13 | 13 |
14 function abprequire(module) | 14 function abprequire(module) |
15 { | 15 { |
16 let result = {}; | 16 let result = {}; |
17 result.wrappedJSObject = result; | 17 result.wrappedJSObject = result; |
18 Services.obs.notifyObservers(result, "adblockplus-require", module); | 18 Services.obs.notifyObservers(result, "adblockplus-require", module); |
19 return result.exports; | 19 return result.exports; |
20 } | 20 } |
21 | 21 |
22 let {Policy} = abprequire("contentPolicy"); | 22 let {Policy} = abprequire("contentPolicy"); |
23 let {Filter} = abprequire("filterClasses"); | 23 let {Filter} = abprequire("filterClasses"); |
24 | 24 |
25 let origShouldAllow = Policy.shouldAllow; | 25 let origShouldAllow = Policy.shouldAllow; |
26 if (!origShouldAllow) | 26 if (!origShouldAllow) |
27 window.close(); | 27 window.close(); |
28 | 28 |
29 let currentData = null; | |
Thomas Greiner
2015/12/07 15:24:20
`currentData` is no longer used across multiple fu
Wladimir Palant
2015/12/07 15:37:55
Done.
| |
30 let processingQueue = []; | 29 let processingQueue = []; |
31 let notifier = null; | 30 let notifier = null; |
32 | 31 |
33 // Randomize URI to work around bug 719376 | 32 // Randomize URI to work around bug 719376 |
34 let stringBundle = Services.strings.createBundle("chrome://abpwatcher/locale/glo bal.properties?" + Math.random()); | 33 let stringBundle = Services.strings.createBundle("chrome://abpwatcher/locale/glo bal.properties?" + Math.random()); |
35 | 34 |
36 let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci. nsIClipboardHelper); | 35 let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci. nsIClipboardHelper); |
37 | 36 |
38 function init() | 37 function init() |
39 { | 38 { |
(...skipping 11 matching lines...) Expand all Loading... | |
51 setInterval(processQueue, 200); | 50 setInterval(processQueue, 200); |
52 } | 51 } |
53 | 52 |
54 function E(id) | 53 function E(id) |
55 { | 54 { |
56 return document.getElementById(id); | 55 return document.getElementById(id); |
57 } | 56 } |
58 | 57 |
59 function replacementShouldAllow({contentType, location, frames, isPrivate}) | 58 function replacementShouldAllow({contentType, location, frames, isPrivate}) |
60 { | 59 { |
61 let startTime = null; | 60 let startTime = Date.now(); |
62 try | 61 let currentData = { |
63 { | 62 type: contentType, |
64 currentData = { | 63 location: location, |
65 type: contentType, | 64 frames: frames, |
66 location: location, | 65 isPrivate: isPrivate |
67 frames: frames, | 66 }; |
68 isPrivate: isPrivate | |
69 }; | |
70 startTime = Date.now(); | |
71 } | |
72 catch(e) | |
73 { | |
74 Cu.reportError(e); | |
75 } | |
76 | |
77 let ret; | 67 let ret; |
68 | |
78 try | 69 try |
79 { | 70 { |
80 ret = origShouldAllow.apply(this, arguments); | 71 ret = origShouldAllow.apply(this, arguments); |
81 return ret; | 72 return ret; |
82 } | 73 } |
83 finally | 74 finally |
84 { | 75 { |
85 if (startTime !== null) | 76 if (startTime !== null) |
86 { | 77 { |
87 currentData.processingTime = (Date.now() - startTime); | 78 currentData.processingTime = (Date.now() - startTime); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 for (let i = 0; i < this.observers.length; i++) | 528 for (let i = 0; i < this.observers.length; i++) |
538 if (this.observers[i] == observer) | 529 if (this.observers[i] == observer) |
539 this.observers.splice(i--, 1); | 530 this.observers.splice(i--, 1); |
540 }, | 531 }, |
541 notifyObservers: function(operation, entry) | 532 notifyObservers: function(operation, entry) |
542 { | 533 { |
543 for each (let observer in this.observers) | 534 for each (let observer in this.observers) |
544 observer(this, operation, entry); | 535 observer(this, operation, entry); |
545 } | 536 } |
546 }; | 537 }; |
LEFT | RIGHT |