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

Unified Diff: composer.postload.js

Issue 29374674: Issue 4864 - Start using ESLint for adblockpluschrome (Closed)
Patch Set: Use var for ext declarations again Created Feb. 8, 2017, 9:02 a.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
Index: composer.postload.js
diff --git a/composer.postload.js b/composer.postload.js
index 6b87f0ba5e2a4cc61e1c9eb0e1c4a98099966a3b..72ff69028dca922a08d81cdc6600e1c390312cfb 100644
--- a/composer.postload.js
+++ b/composer.postload.js
@@ -15,6 +15,8 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+/* globals checkCollapse, elemhide, getURLsFromElement, typeMap */
Sebastian Noack 2017/02/09 01:04:50 As mentioned in the other review for the base ESLi
kzar 2017/02/20 10:27:30 We're not making the situation worse by documentin
Sebastian Noack 2017/03/29 17:14:07 JavaScript is a dynamic language, which comes with
kzar 2017/03/30 07:20:39 As discussed in IRC sounds good. I've opened https
+
"use strict";
// The page ID for the popup filter selection dialog (top frame only).
@@ -43,8 +45,7 @@ let lastRightClickEventIsMostRecent = false;
function getFiltersForElement(element, callback)
{
let src = element.getAttribute("src");
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "composer.getFilters",
tagName: element.localName,
id: element.id,
@@ -52,7 +53,7 @@ function getFiltersForElement(element, callback)
style: element.getAttribute("style"),
classes: Array.prototype.slice.call(element.classList),
urls: getURLsFromElement(element),
- mediatype: typeMap[element.localName],
+ mediatype: typeMap.get(element.localName),
baseURL: document.location.href
},
response =>
@@ -71,8 +72,9 @@ function getBlockableElementOrAncestor(element, callback)
// We can't handle non-HTML (like SVG) elements, as well as
// <area> elements (see below). So fall back to the parent element.
if (!(element instanceof HTMLElement) || element.localName == "area")
+ {
element = element.parentElement;
-
+ }
// If image maps are used mouse events occur for the <area> element.
// But we have to block the image associated with the <map> element.
else if (element.localName == "map")
@@ -388,21 +390,15 @@ function elementPicked(event)
if (currentlyPickingElement)
stopPickingElement();
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "composer.openDialog"
},
popupId =>
{
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "forward",
targetPageId: popupId,
- payload:
- {
- type: "composer.dialog.init",
- filters: filters
- }
+ payload: {type: "composer.dialog.init", filters}
});
// Only the top frame keeps a record of the popup window's ID,
@@ -413,14 +409,9 @@ function elementPicked(event)
}
else
{
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "forward",
- payload:
- {
- type: "composer.content.dialogOpened",
- popupId: popupId
- }
+ payload: {type: "composer.content.dialogOpened", popupId}
});
}
});
@@ -461,8 +452,7 @@ function deactivateBlockElement()
if (blockelementPopupId != null)
{
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "forward",
targetPageId: blockelementPopupId,
payload:
@@ -504,8 +494,7 @@ if (document instanceof HTMLDocument)
lastRightClickEvent = event;
lastRightClickEventIsMostRecent = true;
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "forward",
payload:
{
@@ -520,9 +509,11 @@ if (document instanceof HTMLDocument)
{
case "composer.content.getState":
if (window == window.top)
+ {
sendResponse({
active: currentlyPickingElement || blockelementPopupId != null
});
+ }
break;
case "composer.content.startPickingElement":
if (window == window.top)
@@ -572,8 +563,7 @@ if (document instanceof HTMLDocument)
// to be careful here. (This is not perfect, but best we can do.)
if (window == window.top && blockelementPopupId == msg.popupId)
{
- ext.backgroundPage.sendMessage(
- {
+ ext.backgroundPage.sendMessage({
type: "forward",
payload:
{

Powered by Google App Engine
This is Rietveld