| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of the URL Fixer, | 2 * This file is part of the URL Fixer, |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
| 4 * | 4 * |
| 5 * URL Fixer is free software: you can redistribute it and/or modify | 5 * URL Fixer 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 * URL Fixer is distributed in the hope that it will be useful, | 9 * URL Fixer 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 exports.getURLBar = (window) => "gURLBar" in window ? window.gURLBar : null; | 110 exports.getURLBar = (window) => "gURLBar" in window ? window.gURLBar : null; |
| 111 | 111 |
| 112 exports.getBrowser = (window) => "gBrowser" in window ? window.gBrowser : nu
ll; | 112 exports.getBrowser = (window) => "gBrowser" in window ? window.gBrowser : nu
ll; |
| 113 | 113 |
| 114 exports.applyToWindow = function(window, corrector) | 114 exports.applyToWindow = function(window, corrector) |
| 115 { | 115 { |
| 116 let urlbar = exports.getURLBar(window); | 116 let urlbar = exports.getURLBar(window); |
| 117 if (urlbar && urlbar.handleCommand && !functionHooks.has(window)) | 117 if (urlbar && urlbar.handleCommand && !functionHooks.has(window)) |
| 118 { | 118 { |
| 119 if (!urlbar.hasOwnProperty("handleCommand")) | 119 let hooked = (urlbar.hasOwnProperty("handleCommand") ? |
| 120 urlbar = Object.getPrototypeOf(urlbar); | 120 urlbar : Object.getPrototypeOf(urlbar)); |
| 121 | 121 |
| 122 // Handle new URLs being entered | 122 // Handle new URLs being entered |
| 123 let unhook = hook(urlbar, "handleCommand", function() | 123 let unhook = hook(hooked, "handleCommand", function() |
| 124 { | 124 { |
| 125 let correction = corrector(window, urlbar.value); | 125 let correction = corrector(window, urlbar.value); |
| 126 if (correction) | 126 if (correction) |
| 127 urlbar.value = correction; | 127 urlbar.value = correction; |
| 128 }); | 128 }); |
| 129 functionHooks.set(window, unhook); | 129 functionHooks.set(window, unhook); |
| 130 } | 130 } |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 exports.openInfobar = function(window, id, message, buttons, persistence) | 133 exports.openInfobar = function(window, id, message, buttons, persistence) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 break; | 374 break; |
| 375 } | 375 } |
| 376 default: | 376 default: |
| 377 { | 377 { |
| 378 exports.isKnownWindow = (window) => false; | 378 exports.isKnownWindow = (window) => false; |
| 379 break; | 379 break; |
| 380 } | 380 } |
| 381 } | 381 } |
| LEFT | RIGHT |