OLD | NEW |
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")) |
| 120 urlbar = Object.getPrototypeOf(urlbar); |
| 121 |
119 // Handle new URLs being entered | 122 // Handle new URLs being entered |
120 let unhook = hook(urlbar, "handleCommand", function() | 123 let unhook = hook(urlbar, "handleCommand", function() |
121 { | 124 { |
122 let correction = corrector(window, urlbar.value); | 125 let correction = corrector(window, urlbar.value); |
123 if (correction) | 126 if (correction) |
124 urlbar.value = correction; | 127 urlbar.value = correction; |
125 }); | 128 }); |
126 functionHooks.set(window, unhook); | 129 functionHooks.set(window, unhook); |
127 } | 130 } |
128 }; | 131 }; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 }; | 372 }; |
370 | 373 |
371 break; | 374 break; |
372 } | 375 } |
373 default: | 376 default: |
374 { | 377 { |
375 exports.isKnownWindow = (window) => false; | 378 exports.isKnownWindow = (window) => false; |
376 break; | 379 break; |
377 } | 380 } |
378 } | 381 } |
OLD | NEW |