 Issue 29501607:
  Issue 5459 - Add support to show a notification based on the number of ads blocked  (Closed)
    
  
    Issue 29501607:
  Issue 5459 - Add support to show a notification based on the number of ads blocked  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 19 matching lines...) Expand all Loading... | |
| 30 // within the sandbox succeed even with data passed in from outside. | 30 // within the sandbox succeed even with data passed in from outside. | 
| 31 let globals = Object.assign({Array, JSON}, | 31 let globals = Object.assign({Array, JSON}, | 
| 32 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); | 32 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); | 
| 33 | 33 | 
| 34 let sandboxedRequire = createSandbox({globals}); | 34 let sandboxedRequire = createSandbox({globals}); | 
| 35 ( | 35 ( | 
| 36 {Prefs} = sandboxedRequire("./stub-modules/prefs"), | 36 {Prefs} = sandboxedRequire("./stub-modules/prefs"), | 
| 37 {Notification} = sandboxedRequire("../lib/notification") | 37 {Notification} = sandboxedRequire("../lib/notification") | 
| 38 ); | 38 ); | 
| 39 | 39 | 
| 40 sandboxedRequire("./stub-modules/utils"); | |
| 
Wladimir Palant
2017/08/22 07:54:58
This change seems unnecessary?
 
wspee
2017/08/23 10:12:20
Acknowledged.
 | |
| 41 | |
| 40 callback(); | 42 callback(); | 
| 41 }; | 43 }; | 
| 42 | 44 | 
| 43 function showNotifications(url) | 45 function showNotifications(url) | 
| 44 { | 46 { | 
| 45 let shownNotifications = []; | 47 let shownNotifications = []; | 
| 46 function showListener(notification) | 48 function showListener(notification) | 
| 47 { | 49 { | 
| 48 shownNotifications.push(notification); | 50 shownNotifications.push(notification); | 
| 49 Notification.markAsShown(notification.id); | 51 Notification.markAsShown(notification.id); | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 ["platform", "chromium", true], | 169 ["platform", "chromium", true], | 
| 168 ["platform", "gecko", false], | 170 ["platform", "gecko", false], | 
| 169 ["platformMinVersion", "12.0", true], | 171 ["platformMinVersion", "12.0", true], | 
| 170 ["platformMinVersion", "12", true], | 172 ["platformMinVersion", "12", true], | 
| 171 ["platformMinVersion", "11", true], | 173 ["platformMinVersion", "11", true], | 
| 172 ["platformMinVersion", "13", false], | 174 ["platformMinVersion", "13", false], | 
| 173 ["platformMinVersion", "12.1", false], | 175 ["platformMinVersion", "12.1", false], | 
| 174 ["platformMaxVersion", "12.0", true], | 176 ["platformMaxVersion", "12.0", true], | 
| 175 ["platformMaxVersion", "12", true], | 177 ["platformMaxVersion", "12", true], | 
| 176 ["platformMaxVersion", "13", true], | 178 ["platformMaxVersion", "13", true], | 
| 177 ["platformMaxVersion", "11", false] | 179 ["platformMaxVersion", "11", false], | 
| 180 ["blockedTotalMin", "11", false], | |
| 181 ["blockedTotalMin", "10", true], | |
| 182 ["blockedTotalMax", "10", true], | |
| 183 ["blockedTotalMax", "1", false], | |
| 184 ["locales", ["en-US"], true], | |
| 185 ["locales", ["en-US", "de-DE"], true], | |
| 186 ["locales", ["de-DE"], false], | |
| 187 ["locales", ["en-GB", "de-DE"], false] | |
| 178 ]) | 188 ]) | 
| 179 { | 189 { | 
| 180 exports.testTargetSelection[`${propName}=${value}`] = function(test) | 190 exports.testTargetSelection[`${propName}=${value}`] = function(test) | 
| 181 { | 191 { | 
| 182 let targetInfo = {}; | 192 let targetInfo = {}; | 
| 183 targetInfo[propName] = value; | 193 targetInfo[propName] = value; | 
| 184 | 194 | 
| 185 let information = { | 195 let information = { | 
| 186 id: 1, | 196 id: 1, | 
| 187 type: "information", | 197 type: "information", | 
| (...skipping 18 matching lines...) Expand all Loading... | |
| 206 ["extension", "adblockplus", false], | 216 ["extension", "adblockplus", false], | 
| 207 ["extensionMinVersion", "1.4", true], | 217 ["extensionMinVersion", "1.4", true], | 
| 208 ["extensionMinVersion", "1.5", false], | 218 ["extensionMinVersion", "1.5", false], | 
| 209 ["application", "chrome", true], | 219 ["application", "chrome", true], | 
| 210 ["application", "firefox", false], | 220 ["application", "firefox", false], | 
| 211 ["applicationMinVersion", "27", true], | 221 ["applicationMinVersion", "27", true], | 
| 212 ["applicationMinVersion", "28", false], | 222 ["applicationMinVersion", "28", false], | 
| 213 ["platform", "chromium", true], | 223 ["platform", "chromium", true], | 
| 214 ["platform", "gecko", false], | 224 ["platform", "gecko", false], | 
| 215 ["platformMinVersion", "12", true], | 225 ["platformMinVersion", "12", true], | 
| 216 ["platformMinVersion", "13", false] | 226 ["platformMinVersion", "13", false], | 
| 227 ["unkown", "unknown", false] | |
| 217 ])) | 228 ])) | 
| 218 { | 229 { | 
| 219 exports.testMultipleTargets[`${propName1}=${value1},${propName2}=${value2}`] = function(test) | 230 exports.testMultipleTargets[`${propName1}=${value1},${propName2}=${value2}`] = function(test) | 
| 220 { | 231 { | 
| 221 let targetInfo1 = {}; | 232 let targetInfo1 = {}; | 
| 222 targetInfo1[propName1] = value1; | 233 targetInfo1[propName1] = value1; | 
| 223 let targetInfo2 = {}; | 234 let targetInfo2 = {}; | 
| 224 targetInfo2[propName2] = value2; | 235 targetInfo2[propName2] = value2; | 
| 225 | 236 | 
| 226 let information = { | 237 let information = { | 
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 test.done(); | 526 test.done(); | 
| 516 }; | 527 }; | 
| 517 | 528 | 
| 518 exports.testMissingTranslation = function(test) | 529 exports.testMissingTranslation = function(test) | 
| 519 { | 530 { | 
| 520 let notification = {message: {"en-US": "en-US"}}; | 531 let notification = {message: {"en-US": "en-US"}}; | 
| 521 let texts = Notification.getLocalizedTexts(notification, "fr"); | 532 let texts = Notification.getLocalizedTexts(notification, "fr"); | 
| 522 test.equal(texts.message, "en-US"); | 533 test.equal(texts.message, "en-US"); | 
| 523 test.done(); | 534 test.done(); | 
| 524 }; | 535 }; | 
| OLD | NEW |