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

Side by Side Diff: include.postload.js

Issue 6438904399921152: Issue 1674 - Use String.trim() to strip leading and trailing whitespaces (Chrome/Opera/Safari) (Closed)
Patch Set: Created Dec. 8, 2014, 5:02 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
« no previous file with comments | « no previous file | options.js » ('j') | 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 657 }
658 } 658 }
659 if (!url) 659 if (!url)
660 return; 660 return;
661 661
662 // Default title to the URL 662 // Default title to the URL
663 if (!title) 663 if (!title)
664 title = url; 664 title = url;
665 665
666 // Trim spaces in title and URL 666 // Trim spaces in title and URL
667 title = title.replace(/^\s+/, "").replace(/\s+$/, ""); 667 title = title.trim();
668 url = url.replace(/^\s+/, "").replace(/\s+$/, ""); 668 url = url.trim();
669 if (!/^(https?|ftp):/.test(url)) 669 if (!/^(https?|ftp):/.test(url))
670 return; 670 return;
671 671
672 ext.backgroundPage.sendMessage({ 672 ext.backgroundPage.sendMessage({
673 type: "add-subscription", 673 type: "add-subscription",
674 title: title, 674 title: title,
675 url: url 675 url: url
676 }); 676 });
677 }, true); 677 }, true);
678 678
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 break; 764 break;
765 default: 765 default:
766 sendResponse({}); 766 sendResponse({});
767 break; 767 break;
768 } 768 }
769 }); 769 });
770 770
771 if (window == window.top) 771 if (window == window.top)
772 ext.backgroundPage.sendMessage({type: "report-html-page"}); 772 ext.backgroundPage.sendMessage({type: "report-html-page"});
773 } 773 }
OLDNEW
« no previous file with comments | « no previous file | options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld