| 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-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 | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 (function(global) | 18 (function(global) | 
| 19 { | 19 { | 
|  | 20   const Cu = Components.utils; | 
|  | 21 | 
|  | 22   let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | 
|  | 23 | 
| 20   if (!global.ext) | 24   if (!global.ext) | 
| 21     global.ext = {}; | 25     global.ext = {}; | 
| 22 | 26 | 
| 23   var wrapperSymbol = Symbol("ext-wrapper"); | 27   var wrapperSymbol = Symbol("ext-wrapper"); | 
| 24 | 28 | 
| 25   function wrapFrames(frames) | 29   function wrapFrames(frames) | 
| 26   { | 30   { | 
| 27     if (!frames.length) | 31     if (!frames.length) | 
| 28       return null; | 32       return null; | 
| 29 | 33 | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 75       this._port.on("ext_message", wrapper); | 79       this._port.on("ext_message", wrapper); | 
| 76     }, | 80     }, | 
| 77 | 81 | 
| 78     removeListener: function(listener) | 82     removeListener: function(listener) | 
| 79     { | 83     { | 
| 80       if (listener[wrapperSymbol]) | 84       if (listener[wrapperSymbol]) | 
| 81         this._port.off("ext_message", listener[wrapperSymbol]); | 85         this._port.off("ext_message", listener[wrapperSymbol]); | 
| 82     } | 86     } | 
| 83   }; | 87   }; | 
| 84 | 88 | 
|  | 89   let pageName = "global"; | 
|  | 90   if (typeof location !== "undefined") | 
|  | 91     pageName = location.pathname.replace(/.*\//, "").replace(/\..*?$/, ""); | 
|  | 92 | 
|  | 93   let stringBundle = Services.strings.createBundle( | 
|  | 94     "chrome://adblockplus/locale/" + pageName + ".properties?" + Math.random()); | 
|  | 95 | 
|  | 96   global.ext.i18n = { | 
|  | 97     getMessage(key, args) | 
|  | 98     { | 
|  | 99       try { | 
|  | 100         return stringBundle.GetStringFromName(key); | 
|  | 101       } | 
|  | 102       catch(e) | 
|  | 103       { | 
|  | 104         // Don't report errors for special strings, these are expected to be | 
|  | 105         // missing. | 
|  | 106         if (key[0] != "@") | 
|  | 107           Cu.reportError(e); | 
|  | 108         return ""; | 
|  | 109       } | 
|  | 110     } | 
|  | 111   }; | 
|  | 112 | 
| 85   if (typeof exports == "object") | 113   if (typeof exports == "object") | 
| 86     exports = global.ext; | 114     exports = global.ext; | 
| 87 })(this); | 115 })(this); | 
| OLD | NEW | 
|---|