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

Side by Side Diff: lib/url.js

Issue 29808581: Noissue - Use destructuring (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created June 15, 2018, 5:47 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 | 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-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 16 matching lines...) Expand all
27 * and "data:" URLs) it falls back to the parent frame. 27 * and "data:" URLs) it falls back to the parent frame.
28 * 28 *
29 * @param {?Frame} frame 29 * @param {?Frame} frame
30 * @param {URL} [originUrl] 30 * @param {URL} [originUrl]
31 * @return {string} 31 * @return {string}
32 */ 32 */
33 exports.extractHostFromFrame = (frame, originUrl) => 33 exports.extractHostFromFrame = (frame, originUrl) =>
34 { 34 {
35 for (; frame; frame = frame.parent) 35 for (; frame; frame = frame.parent)
36 { 36 {
37 let hostname = frame.url.hostname; 37 let {hostname} = frame.url;
38 if (hostname) 38 if (hostname)
39 return hostname; 39 return hostname;
40 } 40 }
41 41
42 return originUrl ? originUrl.hostname : ""; 42 return originUrl ? originUrl.hostname : "";
43 }; 43 };
44 44
45 function isDomain(hostname) 45 function isDomain(hostname)
46 { 46 {
47 // No hostname or IPv4 address, also considering hexadecimal octets. 47 // No hostname or IPv4 address, also considering hexadecimal octets.
(...skipping 18 matching lines...) Expand all
66 documentHost = documentHost.replace(/\.+$/, ""); 66 documentHost = documentHost.replace(/\.+$/, "");
67 67
68 if (requestHost == documentHost) 68 if (requestHost == documentHost)
69 return false; 69 return false;
70 70
71 if (!isDomain(requestHost) || !isDomain(documentHost)) 71 if (!isDomain(requestHost) || !isDomain(documentHost))
72 return true; 72 return true;
73 73
74 return getDomain(requestHost) != getDomain(documentHost); 74 return getDomain(requestHost) != getDomain(documentHost);
75 }; 75 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld