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

Unified Diff: options.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 9, 2017, 3:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ext/popup.js ('K') | « notification.js ('k') | popup.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -12,24 +12,31 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
+// Both Edge and Mozilla Web Extensions use the namespace
Manish Jethani 2017/10/09 15:49:41 This is a duplication of Ollie's change, will be m
Sebastian Noack 2017/10/09 16:05:37 See my comment on Ollie's review. I don't think we
Manish Jethani 2017/10/09 16:08:38 Yes, so I think I can do it as part of this change
Sebastian Noack 2017/10/09 16:14:19 s/desperate/separate/
Manish Jethani 2017/10/11 10:59:18 Done.
+// 'browser' instead of 'chrome'. Edge has chrome namespace defined,
+// in some cases, but only with one property: 'app'.
+if (typeof browser == "undefined" ||
+ typeof chrome != "undefined" && typeof chrome.extension != "undefined")
+ window.browser = chrome;
+
let iframe = document.getElementById("content");
iframe.onload = () =>
{
document.title = iframe.contentDocument.title;
};
-chrome.runtime.sendMessage({
+browser.runtime.sendMessage({
type: "app.get",
what: "application"
},
application =>
{
// Load the mobile version of the options page on Firefox for Android.
iframe.src = iframe.getAttribute("data-src-" + application) ||
iframe.getAttribute("data-src");
« ext/popup.js ('K') | « notification.js ('k') | popup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld