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

Unified Diff: mobile-options.js

Issue 29573083: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Add polyfill.js to README.md Created Oct. 17, 2017, 12:35 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
« no previous file with comments | « mobile-options.html ('k') | polyfill.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mobile-options.js
===================================================================
--- a/mobile-options.js
+++ b/mobile-options.js
@@ -15,17 +15,17 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
/* globals getDocLink */
"use strict";
{
- const {getMessage} = chrome.i18n;
+ const {getMessage} = browser.i18n;
const dialogSubscribe = "subscribe";
const idAcceptableAds = "acceptableAds";
const idRecommended = "subscriptions-recommended";
let whitelistFilter = null;
let promisedAcceptableAdsUrl = getAcceptableAdsUrl();
/* Utility functions */
@@ -71,28 +71,28 @@
}
/* Extension interactions */
function getInstalled()
{
return new Promise((resolve, reject) =>
{
- chrome.runtime.sendMessage(
+ browser.runtime.sendMessage(
{type: "subscriptions.get", downloadable: true},
resolve
);
});
}
function getAcceptableAdsUrl()
{
return new Promise((resolve, reject) =>
{
- chrome.runtime.sendMessage(
+ browser.runtime.sendMessage(
{type: "prefs.get", key: "subscriptions_exceptionsurl"},
resolve
);
});
}
function getRecommendedAds()
{
@@ -112,22 +112,22 @@
url: element.getAttribute("url")
};
});
});
}
function installSubscription(url, title)
{
- chrome.runtime.sendMessage({type: "subscriptions.add", url, title});
+ browser.runtime.sendMessage({type: "subscriptions.add", url, title});
}
function uninstallSubscription(url)
{
- chrome.runtime.sendMessage({type: "subscriptions.remove", url});
+ browser.runtime.sendMessage({type: "subscriptions.remove", url});
}
/* Actions */
function setFilter({disabled, text}, action)
{
if (!whitelistFilter || text != whitelistFilter)
return;
@@ -285,17 +285,17 @@
});
}
document.addEventListener("change", onChange);
function toggleWhitelistFilter(toggle)
{
if (whitelistFilter)
{
- chrome.runtime.sendMessage(
+ browser.runtime.sendMessage(
{
type: (toggle.checked) ? "filters.remove" : "filters.add",
text: whitelistFilter
},
(errors) =>
{
if (errors.length < 1)
return;
@@ -408,27 +408,27 @@
break;
}
break;
}
}
}
ext.onMessage.addListener(onMessage);
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "app.listen",
filter: ["addSubscription", "showPageOptions"]
});
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "filters.listen",
filter: ["added", "removed"]
});
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "subscriptions.listen",
filter: ["added", "disabled", "removed", "title"]
});
/* Initialization */
populateLists();
« no previous file with comments | « mobile-options.html ('k') | polyfill.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld