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

Unified Diff: mobile-options.js

Issue 29573735: Issue 4580 - Replace ext.backgroundPage.sendMessage with runtime.sendMessage (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created Oct. 11, 2017, 3:37 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/content.js ('K') | « i18n.js ('k') | no next file » | 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
@@ -71,28 +71,28 @@
}
/* Extension interactions */
function getInstalled()
{
return new Promise((resolve, reject) =>
{
- ext.backgroundPage.sendMessage(
+ chrome.runtime.sendMessage(
{type: "subscriptions.get", downloadable: true},
resolve
);
});
}
function getAcceptableAdsUrl()
{
return new Promise((resolve, reject) =>
{
- ext.backgroundPage.sendMessage(
+ chrome.runtime.sendMessage(
{type: "prefs.get", key: "subscriptions_exceptionsurl"},
resolve
);
});
}
function getRecommendedAds()
{
@@ -112,22 +112,22 @@
url: element.getAttribute("url")
};
});
});
}
function installSubscription(url, title)
{
- ext.backgroundPage.sendMessage({type: "subscriptions.add", url, title});
+ chrome.runtime.sendMessage({type: "subscriptions.add", url, title});
}
function uninstallSubscription(url)
{
- ext.backgroundPage.sendMessage({type: "subscriptions.remove", url});
+ chrome.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)
{
- ext.backgroundPage.sendMessage(
+ chrome.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);
- ext.backgroundPage.sendMessage({
+ chrome.runtime.sendMessage({
type: "app.listen",
filter: ["addSubscription", "showPageOptions"]
});
- ext.backgroundPage.sendMessage({
+ chrome.runtime.sendMessage({
type: "filters.listen",
filter: ["added", "removed"]
});
- ext.backgroundPage.sendMessage({
+ chrome.runtime.sendMessage({
type: "subscriptions.listen",
filter: ["added", "disabled", "removed", "title"]
});
/* Initialization */
populateLists();
« ext/content.js ('K') | « i18n.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld