OLD | NEW |
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const Cr = Components.results; | 78 const Cr = Components.results; |
79 const Cu = Components.utils; | 79 const Cu = Components.utils; |
80 | 80 |
81 Cu.import.resources = new Map(); | 81 Cu.import.resources = new Map(); |
82 | 82 |
83 Cu.import.resources.set("XPCOMUtils", { | 83 Cu.import.resources.set("XPCOMUtils", { |
84 generateQI() {} | 84 generateQI() {} |
85 }); | 85 }); |
86 | 86 |
87 // | 87 // |
88 // Fake nsIFile implementation for our I/O | |
89 // | |
90 | |
91 function FakeFile(path) | |
92 { | |
93 this.path = path; | |
94 } | |
95 FakeFile.prototype = | |
96 { | |
97 get leafName() | |
98 { | |
99 return this.path; | |
100 }, | |
101 set leafName(value) | |
102 { | |
103 this.path = value; | |
104 }, | |
105 append(path) | |
106 { | |
107 this.path += path; | |
108 }, | |
109 clone() | |
110 { | |
111 return new FakeFile(this.path); | |
112 }, | |
113 get parent() | |
114 { | |
115 return {create() {}}; | |
116 }, | |
117 normalize() {} | |
118 }; | |
119 | |
120 // | |
121 // Services.jsm module emulation | 88 // Services.jsm module emulation |
122 // | 89 // |
123 | 90 |
124 Cu.import.resources.set("Services", { | 91 Cu.import.resources.set("Services", { |
125 obs: { | 92 obs: { |
126 addObserver() {}, | 93 addObserver() {}, |
127 removeObserver() {} | 94 removeObserver() {} |
128 }, | 95 }, |
129 vc: { | 96 vc: { |
130 compare(v1, v2) | 97 compare(v1, v2) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 status: -1, | 209 status: -1, |
243 notificationCallbacks: {}, | 210 notificationCallbacks: {}, |
244 loadFlags: 0, | 211 loadFlags: 0, |
245 INHIBIT_CACHING: 0, | 212 INHIBIT_CACHING: 0, |
246 VALIDATE_ALWAYS: 0, | 213 VALIDATE_ALWAYS: 0, |
247 QueryInterface() | 214 QueryInterface() |
248 { | 215 { |
249 return this; | 216 return this; |
250 } | 217 } |
251 }; | 218 }; |
OLD | NEW |