OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 function getModuleGlobal(module) | 3 function getModuleGlobal(module) |
4 { | 4 { |
5 let result = Cu.getGlobalForObject(require(module)); | 5 let result = Cu.getGlobalForObject(require(module)); |
6 if (result == window) | 6 if (result == window) |
7 { | 7 { |
8 // Work-around for bug 736316 - getGlobalForObject gave us our own window | 8 // Work-around for bug 736316 - getGlobalForObject gave us our own window |
9 let {XPIProvider} = Cu.import("resource://gre/modules/XPIProvider.jsm", nu
ll); | 9 let {XPIProvider} = Cu.import("resource://gre/modules/XPIProvider.jsm", nu
ll); |
10 let addonID = "{0fa2149e-bb2c-4ac2-a8d3-479599819475}"; | 10 let addonID = "{0fa2149e-bb2c-4ac2-a8d3-479599819475}"; |
11 if (addonID in XPIProvider.bootstrapScopes) | 11 if (addonID in XPIProvider.bootstrapScopes) |
12 result = XPIProvider.bootstrapScopes[addonID]; | 12 result = XPIProvider.bootstrapScopes[addonID]; |
13 } | 13 } |
14 | 14 |
15 if ("require" in result) | 15 if ("require" in result) |
16 result = result.require.scopes[module]; | 16 result = result.require.scopes[module]; |
17 return result; | 17 return result; |
18 } | 18 } |
19 | 19 |
20 let {onWhitelistEntryAdded, onWhitelistEntryRemoved} = require("rules"); | 20 let {onWhitelistEntryAdded, onWhitelistEntryRemoved} = require("typoRules"); |
21 let rulesGlobal = getModuleGlobal("rules"); | 21 let rulesGlobal = getModuleGlobal("typoRules"); |
22 | 22 |
23 function saveRules() | 23 function saveRules() |
24 { | 24 { |
25 this._rulesBackup = rulesGlobal.rules; | 25 this._rulesBackup = rulesGlobal.rules; |
26 rulesGlobal.rules = {domain: {}}; | 26 rulesGlobal.rules = {domain: {}}; |
27 } | 27 } |
28 | 28 |
29 function restoreRules() | 29 function restoreRules() |
30 { | 30 { |
31 rulesGlobal.rules = this._rulesBackup; | 31 rulesGlobal.rules = this._rulesBackup; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 "o": { | 196 "o": { |
197 "o": { | 197 "o": { |
198 "f": { | 198 "f": { |
199 }, | 199 }, |
200 "g": " 1234" | 200 "g": " 1234" |
201 } | 201 } |
202 } | 202 } |
203 }, "Attempted to remove goo"); | 203 }, "Attempted to remove goo"); |
204 }); | 204 }); |
205 })(); | 205 })(); |
OLD | NEW |