 Issue 29595598:
  Issue 5967 - Don't rely on URLSearchParams() constructor to accept a sequence  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockplusui/
    
  
    Issue 29595598:
  Issue 5967 - Don't rely on URLSearchParams() constructor to accept a sequence  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockplusui/| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 for (let i = 0; i < uuid.length; i++) | 396 for (let i = 0; i < uuid.length; i++) | 
| 397 { | 397 { | 
| 398 let component = uuid[i].toString(16); | 398 let component = uuid[i].toString(16); | 
| 399 while (component.length < 4) | 399 while (component.length < 4) | 
| 400 component = "0" + component; | 400 component = "0" + component; | 
| 401 uuidString += component; | 401 uuidString += component; | 
| 402 if (i >= 1 && i <= 4) | 402 if (i >= 1 && i <= 4) | 
| 403 uuidString += "-"; | 403 uuidString += "-"; | 
| 404 } | 404 } | 
| 405 | 405 | 
| 406 // Passing a sequence to URLSearchParams() constructor only works starting | |
| 407 // with Firefox 53, add values "manually" for now. | |
| 406 let params = new URLSearchParams(); | 408 let params = new URLSearchParams(); | 
| 407 for (let [param, value] of [ | 409 for (let [param, value] of [ | 
| 
kzar
2017/11/03 10:12:02
I can't remember, does array parameter destructuri
 
kzar
2017/11/03 10:12:03
Maybe add a comment explaining this is a workaroun
 
Wladimir Palant
2017/11/03 10:45:41
It does. That's part of the reason why we require
 | |
| 408 ["version", 1], | 410 ["version", 1], | 
| 409 ["guid", uuidString], | 411 ["guid", uuidString], | 
| 410 ["lang", reportData.getElementsByTagName("adblock-plus")[0] | 412 ["lang", reportData.getElementsByTagName("adblock-plus")[0] | 
| 411 .getAttribute("locale")] | 413 .getAttribute("locale")] | 
| 412 ]) | 414 ]) | 
| 413 { | 415 { | 
| 414 params.append(param, value); | 416 params.append(param, value); | 
| 415 } | 417 } | 
| 416 | 418 | 
| 417 let url = "https://reports.adblockplus.org/submitReport?" + params; | 419 let url = "https://reports.adblockplus.org/submitReport?" + params; | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 progress.value = event.loaded; | 509 progress.value = event.loaded; | 
| 508 } | 510 } | 
| 509 }); | 511 }); | 
| 510 request.send(serializeReportData()); | 512 request.send(serializeReportData()); | 
| 511 } | 513 } | 
| 512 | 514 | 
| 513 function leaveSendPage() | 515 function leaveSendPage() | 
| 514 { | 516 { | 
| 515 closeMe(); | 517 closeMe(); | 
| 516 } | 518 } | 
| LEFT | RIGHT |