Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: ext/background.js

Issue 29527610: Noissue - Add version check for runtime.openOptionsPage for Firefox for Android (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created Aug. 25, 2017, 9:19 a.m.
Right Patch Set: Remove check for 57.0a1 Created Aug. 25, 2017, 11:01 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 ext.showOptions = callback => 700 ext.showOptions = callback =>
701 { 701 {
702 let info = require("info"); 702 let info = require("info");
703 703
704 if ("openOptionsPage" in chrome.runtime && 704 if ("openOptionsPage" in chrome.runtime &&
705 // Some versions of Firefox for Android before version 57 do have a 705 // Some versions of Firefox for Android before version 57 do have a
706 // runtime.openOptionsPage but it doesn't do anything. 706 // runtime.openOptionsPage but it doesn't do anything.
707 // https://bugzilla.mozilla.org/show_bug.cgi?id=1364945 707 // https://bugzilla.mozilla.org/show_bug.cgi?id=1364945
708 (info.application != "fennec" || 708 (info.application != "fennec" ||
709 (parseInt(info.applicationVersion, 10) >= 57 && 709 parseInt(info.applicationVersion, 10) >= 57))
710 info.applicationVersion != "57.0a1")))
Manish Jethani 2017/08/25 09:20:53 This extra check here is specifically for the curr
711 { 710 {
712 if (!callback) 711 if (!callback)
713 { 712 {
714 chrome.runtime.openOptionsPage(); 713 chrome.runtime.openOptionsPage();
715 } 714 }
716 else 715 else
717 { 716 {
718 chrome.runtime.openOptionsPage(() => 717 chrome.runtime.openOptionsPage(() =>
719 { 718 {
720 if (chrome.runtime.lastError) 719 if (chrome.runtime.lastError)
721 return; 720 return;
722 721
723 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => 722 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs =>
724 { 723 {
725 if (tabs.length > 0) 724 if (tabs.length > 0)
726 { 725 {
727 if (tabs[0].status == "complete") 726 if (tabs[0].status == "complete")
728 callback(new Page(tabs[0])); 727 callback(new Page(tabs[0]));
729 else 728 else
730 afterTabLoaded(callback)(tabs[0]); 729 afterTabLoaded(callback)(tabs[0]);
731 } 730 }
732 }); 731 });
733 }); 732 });
734 } 733 }
735 } 734 }
736 else 735 else
737 { 736 {
738 // Edge does not yet support runtime.openOptionsPage (tested version 38) 737 // Edge does not yet support runtime.openOptionsPage (tested version 38)
739 // nor does Firefox for Android, 738 // nor does Firefox for Android before version 57,
740 // and so this workaround needs to stay for now. 739 // and so this workaround needs to stay for now.
741 // We are not using extension.getURL to get the absolute path here 740 // We are not using extension.getURL to get the absolute path here
742 // because of the Edge issue: 741 // because of the Edge issue:
743 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10 276332/ 742 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10 276332/
744 let open = win => 743 let open = win =>
745 { 744 {
746 let optionsUrl = "options.html"; 745 let optionsUrl = "options.html";
747 let queryInfo = {url: optionsUrl}; 746 let queryInfo = {url: optionsUrl};
748 747
749 // extension pages can't be accessed in incognito windows. In order to 748 // extension pages can't be accessed in incognito windows. In order to
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 ext.windows = { 790 ext.windows = {
792 create(createData, callback) 791 create(createData, callback)
793 { 792 {
794 chrome.windows.create(createData, createdWindow => 793 chrome.windows.create(createData, createdWindow =>
795 { 794 {
796 afterTabLoaded(callback)(createdWindow.tabs[0]); 795 afterTabLoaded(callback)(createdWindow.tabs[0]);
797 }); 796 });
798 } 797 }
799 }; 798 };
800 }()); 799 }());
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld