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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 _applyChanges() | 336 _applyChanges() |
337 { | 337 { |
338 if ("iconPath" in this._changes) | 338 if ("iconPath" in this._changes) |
339 { | 339 { |
340 // Firefox for Android displays the browser action not as an icon but | 340 // Firefox for Android displays the browser action not as an icon but |
341 // as a menu item. There is no icon, but such an option may be added in | 341 // as a menu item. There is no icon, but such an option may be added in |
342 // the future. | 342 // the future. |
343 // https://bugzilla.mozilla.org/show_bug.cgi?id=1331746 | 343 // https://bugzilla.mozilla.org/show_bug.cgi?id=1331746 |
344 if ("setIcon" in chrome.browserAction) | 344 if ("setIcon" in chrome.browserAction) |
345 { | 345 { |
346 chrome.browserAction.setIcon({ | 346 try |
347 tabId: this._tabId, | 347 { |
348 path: { | 348 chrome.browserAction.setIcon({ |
349 16: this._changes.iconPath.replace("$size", "16"), | 349 tabId: this._tabId, |
350 19: this._changes.iconPath.replace("$size", "19"), | 350 path: { |
351 20: this._changes.iconPath.replace("$size", "20"), | 351 16: this._changes.iconPath.replace("$size", "16"), |
352 32: this._changes.iconPath.replace("$size", "32"), | 352 19: this._changes.iconPath.replace("$size", "19"), |
353 38: this._changes.iconPath.replace("$size", "38"), | 353 20: this._changes.iconPath.replace("$size", "20"), |
354 40: this._changes.iconPath.replace("$size", "40") | 354 32: this._changes.iconPath.replace("$size", "32"), |
355 } | 355 38: this._changes.iconPath.replace("$size", "38"), |
356 }); | 356 40: this._changes.iconPath.replace("$size", "40") |
| 357 } |
| 358 }); |
| 359 } |
| 360 catch (e) |
| 361 { |
| 362 // Edge throws if passed icon sizes different than 19,20,38,40px. |
| 363 chrome.browserAction.setIcon({ |
| 364 tabId: this._tabId, |
| 365 path: { |
| 366 19: this._changes.iconPath.replace("$size", "19"), |
| 367 20: this._changes.iconPath.replace("$size", "20"), |
| 368 38: this._changes.iconPath.replace("$size", "38"), |
| 369 40: this._changes.iconPath.replace("$size", "40") |
| 370 } |
| 371 }); |
| 372 } |
357 } | 373 } |
358 } | 374 } |
359 | 375 |
360 if ("badgeText" in this._changes) | 376 if ("badgeText" in this._changes) |
361 { | 377 { |
362 // There is no badge on Firefox for Android; the browser action is | 378 // There is no badge on Firefox for Android; the browser action is |
363 // simply a menu item. | 379 // simply a menu item. |
364 if ("setBadgeText" in chrome.browserAction) | 380 if ("setBadgeText" in chrome.browserAction) |
365 { | 381 { |
366 chrome.browserAction.setBadgeText({ | 382 chrome.browserAction.setBadgeText({ |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 ext.windows = { | 793 ext.windows = { |
778 create(createData, callback) | 794 create(createData, callback) |
779 { | 795 { |
780 chrome.windows.create(createData, createdWindow => | 796 chrome.windows.create(createData, createdWindow => |
781 { | 797 { |
782 afterTabLoaded(callback)(createdWindow.tabs[0]); | 798 afterTabLoaded(callback)(createdWindow.tabs[0]); |
783 }); | 799 }); |
784 } | 800 } |
785 }; | 801 }; |
786 }()); | 802 }()); |
OLD | NEW |