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

Side by Side Diff: options.js

Issue 29458601: Issue 5315 - Add support for Microsoft Edge (Closed)
Patch Set: Use messaging for CSS escaping Created July 17, 2017, 11:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« lib/filterComposer.js ('K') | « metadata.edge ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const addSubscription = wrapper({type: "subscriptions.add"}, 64 const addSubscription = wrapper({type: "subscriptions.add"},
65 "url", "title", "homepage"); 65 "url", "title", "homepage");
66 const toggleSubscription = wrapper({type: "subscriptions.toggle"}, 66 const toggleSubscription = wrapper({type: "subscriptions.toggle"},
67 "url", "keepInstalled"); 67 "url", "keepInstalled");
68 const updateSubscription = wrapper({type: "subscriptions.update"}, "url"); 68 const updateSubscription = wrapper({type: "subscriptions.update"}, "url");
69 const importRawFilters = wrapper({type: "filters.importRaw"}, 69 const importRawFilters = wrapper({type: "filters.importRaw"},
70 "text", "removeExisting"); 70 "text", "removeExisting");
71 const addFilter = wrapper({type: "filters.add"}, "text"); 71 const addFilter = wrapper({type: "filters.add"}, "text");
72 const getFilters = wrapper({type: "filters.get"}, "subscriptionUrl"); 72 const getFilters = wrapper({type: "filters.get"}, "subscriptionUrl");
73 const removeFilter = wrapper({type: "filters.remove"}, "text"); 73 const removeFilter = wrapper({type: "filters.remove"}, "text");
74 const escapeCSS = wrapper({type: "utils.escapeCSS"}, "CSS");
74 75
75 const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/; 76 const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/;
76 const statusMessages = new Map([ 77 const statusMessages = new Map([
77 ["synchronize_invalid_url", 78 ["synchronize_invalid_url",
78 "filters_subscription_lastDownload_invalidURL"], 79 "filters_subscription_lastDownload_invalidURL"],
79 ["synchronize_connection_error", 80 ["synchronize_connection_error",
80 "filters_subscription_lastDownload_connectionError"], 81 "filters_subscription_lastDownload_connectionError"],
81 ["synchronize_invalid_data", 82 ["synchronize_invalid_data",
82 "filters_subscription_lastDownload_invalidData"], 83 "filters_subscription_lastDownload_invalidData"],
83 ["synchronize_checksum_mismatch", 84 ["synchronize_checksum_mismatch",
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 let elt = new Option(); 527 let elt = new Option();
527 elt.text = text; 528 elt.text = text;
528 elt.value = text; 529 elt.value = text;
529 document.getElementById(boxId).appendChild(elt); 530 document.getElementById(boxId).appendChild(elt);
530 } 531 }
531 532
532 // Remove a filter string from a list box. 533 // Remove a filter string from a list box.
533 function removeFromListBox(boxId, text) 534 function removeFromListBox(boxId, text)
534 { 535 {
535 let list = document.getElementById(boxId); 536 let list = document.getElementById(boxId);
536 let selector = "option[value=" + CSS.escape(text) + "]"; 537 // Edge does not support CSS.escape yet:
537 for (let option of list.querySelectorAll(selector)) 538 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/101410 /
538 list.removeChild(option); 539 escapeCSS(text, escapedCSS =>
540 {
541 let selector = "option[value=" + escapedCSS + "]";
542 for (let option of list.querySelectorAll(selector))
543 list.removeChild(option);
544 });
539 } 545 }
540 546
541 function addWhitelistDomain(event) 547 function addWhitelistDomain(event)
542 { 548 {
543 event.preventDefault(); 549 event.preventDefault();
544 550
545 let domain = document.getElementById( 551 let domain = document.getElementById(
546 "newWhitelistDomain" 552 "newWhitelistDomain"
547 ).value.replace(/\s/g, ""); 553 ).value.replace(/\s/g, "");
548 document.getElementById("newWhitelistDomain").value = ""; 554 document.getElementById("newWhitelistDomain").value = "";
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 onFilterMessage(message.action, message.args[0]); 739 onFilterMessage(message.action, message.args[0]);
734 break; 740 break;
735 case "prefs.respond": 741 case "prefs.respond":
736 onPrefMessage(message.action, message.args[0]); 742 onPrefMessage(message.action, message.args[0]);
737 break; 743 break;
738 case "subscriptions.respond": 744 case "subscriptions.respond":
739 onSubscriptionMessage(message.action, message.args[0]); 745 onSubscriptionMessage(message.action, message.args[0]);
740 break; 746 break;
741 } 747 }
742 }); 748 });
OLDNEW
« lib/filterComposer.js ('K') | « metadata.edge ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld