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

Delta Between Two Patch Sets: js/desktop-options.js

Issue 29730617: Issue 6510 - Configure notification opens options page incorrectly (Closed)
Left Patch Set: Created March 22, 2018, 3:27 p.m.
Right Patch Set: Created March 22, 2018, 8:35 p.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 | « css/desktop-options.scss ('k') | no next file » | 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-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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 1346
1347 function getSubscriptionFilters(subscription) 1347 function getSubscriptionFilters(subscription)
1348 { 1348 {
1349 return browser.runtime.sendMessage({ 1349 return browser.runtime.sendMessage({
1350 type: "filters.get", 1350 type: "filters.get",
1351 subscriptionUrl: subscription.url}); 1351 subscriptionUrl: subscription.url});
1352 } 1352 }
1353 1353
1354 function hidePref(key, value) 1354 function hidePref(key, value)
1355 { 1355 {
1356 let element = getPrefElement(key); 1356 const element = getPrefElement(key);
a.giammarchi 2018/03/22 18:43:28 let is OK, but why not `const` here ?
saroyanm 2018/03/22 20:43:21 Done.
1357 if (element) 1357 if (element)
1358 element.setAttribute("aria-hidden", value); 1358 element.setAttribute("aria-hidden", value);
1359 } 1359 }
1360 1360
1361 function getPrefElement(key) 1361 function getPrefElement(key)
1362 { 1362 {
1363 return document.querySelector("[data-pref='" + key + "']"); 1363 return document.querySelector("[data-pref='" + key + "']");
a.giammarchi 2018/03/22 18:43:28 out of curiosity: are keys always sanitized or som
saroyanm 2018/03/22 20:43:21 They can contain, I don't think we are sanitizing
1364 } 1364 }
1365 1365
1366 function getPref(key, callback) 1366 function getPref(key, callback)
1367 { 1367 {
1368 let checkPref = getPref.checks[key] || getPref.checkNone; 1368 let checkPref = getPref.checks[key] || getPref.checkNone;
1369 checkPref((isActive) => 1369 checkPref((isActive) =>
1370 { 1370 {
1371 if (!isActive) 1371 if (!isActive)
1372 { 1372 {
1373 hidePref(key, !isActive); 1373 hidePref(key, !isActive);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 case "app.respond": 1449 case "app.respond":
1450 switch (message.action) 1450 switch (message.action)
1451 { 1451 {
1452 case "addSubscription": 1452 case "addSubscription":
1453 let subscription = message.args[0]; 1453 let subscription = message.args[0];
1454 let dialog = E("dialog-content-predefined"); 1454 let dialog = E("dialog-content-predefined");
1455 dialog.querySelector("h3").textContent = subscription.title || ""; 1455 dialog.querySelector("h3").textContent = subscription.title || "";
1456 dialog.querySelector(".url").textContent = subscription.url; 1456 dialog.querySelector(".url").textContent = subscription.url;
1457 openDialog("predefined"); 1457 openDialog("predefined");
1458 break; 1458 break;
1459 case "focusSection": 1459 case "focusSection":
saroyanm 2018/03/22 16:15:53 We used to set the tab view to the notifications -
1460 let section = message.args[0]; 1460 let section = message.args[0];
1461 if (section == "notifications") 1461 if (section == "notifications")
1462 { 1462 {
1463 section = "advanced"; 1463 section = "advanced";
1464 let elem = getPrefElement("notifications_ignoredcategories"); 1464 const elem = getPrefElement("notifications_ignoredcategories");
1465 elem.classList.add("highlight-animate"); 1465 elem.classList.add("highlight-animate");
a.giammarchi 2018/03/22 18:43:28 so, in hidePref you check if elem is there before
saroyanm 2018/03/22 20:43:21 Not necessarily, because "notifications_ignoredcat
1466 elem.querySelector("button").focus(); 1466 elem.querySelector("button").focus();
1467 } 1467 }
1468 1468
1469 selectTabItem(section, document.body, false); 1469 selectTabItem(section, document.body, false);
1470 break; 1470 break;
1471 } 1471 }
1472 break; 1472 break;
1473 case "filters.respond": 1473 case "filters.respond":
1474 onFilterMessage(message.action, message.args[0]); 1474 onFilterMessage(message.action, message.args[0]);
1475 break; 1475 break;
(...skipping 21 matching lines...) Expand all
1497 "ui_warn_tracking"] 1497 "ui_warn_tracking"]
1498 }); 1498 });
1499 port.postMessage({ 1499 port.postMessage({
1500 type: "subscriptions.listen", 1500 type: "subscriptions.listen",
1501 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1501 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1502 "title", "downloadStatus", "downloading"] 1502 "title", "downloadStatus", "downloading"]
1503 }); 1503 });
1504 1504
1505 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1505 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1506 window.addEventListener("hashchange", onHashChange, false); 1506 window.addEventListener("hashchange", onHashChange, false);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld