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

Delta Between Two Patch Sets: background.js

Issue 29338764: Issue 3842 - Split up the logic updating the icon and context menu (Closed)
Left Patch Set: Don't revalidate when multiple filter changes occur at the same time Created March 21, 2016, 10:44 a.m.
Right Patch Set: Rebased Created March 22, 2016, 8:26 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 | lib/filterComposer.js » ('j') | 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (filter.collapse != null) 116 if (filter.collapse != null)
117 return filter.collapse; 117 return filter.collapse;
118 118
119 blocked = true; 119 blocked = true;
120 } 120 }
121 } 121 }
122 122
123 return blocked && Prefs.hidePlaceholders; 123 return blocked && Prefs.hidePlaceholders;
124 }); 124 });
125 125
126 port.on("get-domain-enabled-state", function(msg, sender)
127 {
128 return {enabled: !checkWhitelisted(sender.page)};
129 });
130
131 port.on("forward", function(msg, sender) 126 port.on("forward", function(msg, sender)
132 { 127 {
133 var targetPage; 128 var targetPage;
134 if (msg.targetPageId) 129 if (msg.targetPageId)
135 targetPage = ext.getPage(msg.targetPageId); 130 targetPage = ext.getPage(msg.targetPageId);
136 else 131 else
137 targetPage = sender.page; 132 targetPage = sender.page;
138 133
139 if (targetPage) 134 if (targetPage)
140 { 135 {
141 msg.payload.sender = sender.page.id; 136 msg.payload.sender = sender.page.id;
142 if (msg.expectsResponse) 137 if (msg.expectsResponse)
143 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload)); 138 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload));
144 targetPage.sendMessage(msg.payload); 139 targetPage.sendMessage(msg.payload);
145 } 140 }
146 }); 141 });
147 142
148 // update icon when page changes location 143 // update icon when page changes location
149 ext.pages.onLoading.addListener(function(page) 144 ext.pages.onLoading.addListener(function(page)
150 { 145 {
151 page.sendMessage({type: "composer.content.finished"}); 146 page.sendMessage({type: "composer.content.finished"});
152 showNextNotificationForUrl(page.url); 147 showNextNotificationForUrl(page.url);
153 }); 148 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld