| 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-2015 Eyeo GmbH |    3  * Copyright (C) 2006-2015 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  522       if (label != origLabel) |  522       if (label != origLabel) | 
|  523         element.setAttribute(attr, label); |  523         element.setAttribute(attr, label); | 
|  524       if (accesskey != "") |  524       if (accesskey != "") | 
|  525         element.setAttribute("accesskey", accesskey); |  525         element.setAttribute("accesskey", accesskey); | 
|  526  |  526  | 
|  527       // Labels forward changes of the accessKey property to their control, only |  527       // Labels forward changes of the accessKey property to their control, only | 
|  528       // set it for actual controls. |  528       // set it for actual controls. | 
|  529       if (element.localName != "label") |  529       if (element.localName != "label") | 
|  530         element.accessKey = accesskey; |  530         element.accessKey = accesskey; | 
|  531     } |  531     } | 
 |  532   }, | 
 |  533  | 
 |  534   /** | 
 |  535    * Adds a message handler that will respond to both synchronous and | 
 |  536    * asynchonous messages. | 
 |  537    * @param {string} messageName  name of the message to listen to | 
 |  538    * @param {Function} handler  handler to be called with the message data. The | 
 |  539    *                            return value will be sent back to the child. | 
 |  540    */ | 
 |  541   addChildMessageListener: function(messageName, handler) | 
 |  542   { | 
 |  543     let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] | 
 |  544                            .getService(Ci.nsIMessageListenerManager); | 
 |  545     let wrapper = (message) => { | 
 |  546       let {callbackID, data} = message.data; | 
 |  547       let response = undefined; | 
 |  548       try | 
 |  549       { | 
 |  550         response = handler(data); | 
 |  551       } | 
 |  552       catch (e) | 
 |  553       { | 
 |  554         Cu.reportError(e); | 
 |  555       } | 
 |  556  | 
 |  557       if (callbackID) | 
 |  558       { | 
 |  559         let target = message.target.QueryInterface(Ci.nsIMessageSender); | 
 |  560         target.sendAsyncMessage("AdblockPlus:Response", { | 
 |  561           callbackID, | 
 |  562           response | 
 |  563         }); | 
 |  564       } | 
 |  565       else | 
 |  566         return response; | 
 |  567     }; | 
 |  568     messageManager.addMessageListener(messageName, wrapper); | 
 |  569     onShutdown.add(() => messageManager.removeMessageListener(messageName, wrapp
     er)); | 
|  532   } |  570   } | 
|  533 }; |  571 }; | 
|  534  |  572  | 
|  535 /** |  573 /** | 
|  536  * A cache with a fixed capacity, newer entries replace entries that have been |  574  * A cache with a fixed capacity, newer entries replace entries that have been | 
|  537  * stored first. |  575  * stored first. | 
|  538  * @constructor |  576  * @constructor | 
|  539  */ |  577  */ | 
|  540 function Cache(/**Integer*/ size) |  578 function Cache(/**Integer*/ size) | 
|  541 { |  579 { | 
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  782     Cu.reportError(e); |  820     Cu.reportError(e); | 
|  783     // Expected, ctypes isn't supported in Gecko 1.9.2 |  821     // Expected, ctypes isn't supported in Gecko 1.9.2 | 
|  784     return null; |  822     return null; | 
|  785   } |  823   } | 
|  786 }); |  824 }); | 
|  787  |  825  | 
|  788 if ("@mozilla.org/messenger/headerparser;1" in Cc) |  826 if ("@mozilla.org/messenger/headerparser;1" in Cc) | 
|  789   XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
     ger/headerparser;1", "nsIMsgHeaderParser"); |  827   XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen
     ger/headerparser;1", "nsIMsgHeaderParser"); | 
|  790 else |  828 else | 
|  791   Utils.headerParser = null; |  829   Utils.headerParser = null; | 
| OLD | NEW |