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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 test.equal(getDomain("example.com"), "example.com"); | 175 test.equal(getDomain("example.com"), "example.com"); |
176 test.equal(getDomain("mail.example.com"), "example.com"); | 176 test.equal(getDomain("mail.example.com"), "example.com"); |
177 test.equal(getDomain("secure.mail.example.com"), "example.com"); | 177 test.equal(getDomain("secure.mail.example.com"), "example.com"); |
178 | 178 |
179 // Cascading offsets. | 179 // Cascading offsets. |
180 | 180 |
181 // If these sanity checks fail, look for other examles of cascading offsets | 181 // If these sanity checks fail, look for other examles of cascading offsets |
182 // from the public suffix list. | 182 // from the public suffix list. |
183 test.equal( | 183 test.equal( |
| 184 typeof publicSuffixes[ |
| 185 "images.example.s3.dualstack.us-east-1.amazonaws.com" |
| 186 ], |
| 187 "undefined" |
| 188 ); |
| 189 test.equal( |
184 typeof publicSuffixes["example.s3.dualstack.us-east-1.amazonaws.com"], | 190 typeof publicSuffixes["example.s3.dualstack.us-east-1.amazonaws.com"], |
185 "undefined" | 191 "undefined" |
186 ); | 192 ); |
187 test.equal(publicSuffixes["s3.dualstack.us-east-1.amazonaws.com"], 1); | 193 test.equal(publicSuffixes["s3.dualstack.us-east-1.amazonaws.com"], 1); |
188 test.equal(typeof publicSuffixes["dualstack.us-east-1.amazonaws.com"], | 194 test.equal(typeof publicSuffixes["dualstack.us-east-1.amazonaws.com"], |
189 "undefined"); | 195 "undefined"); |
190 test.equal(typeof publicSuffixes["example.us-east-1.amazonaws.com"], | 196 test.equal(typeof publicSuffixes["example.us-east-1.amazonaws.com"], |
191 "undefined"); | 197 "undefined"); |
192 test.equal(publicSuffixes["us-east-1.amazonaws.com"], 1); | 198 test.equal(publicSuffixes["us-east-1.amazonaws.com"], 1); |
193 test.equal(typeof publicSuffixes["example.amazonaws.com"], "undefined"); | 199 test.equal(typeof publicSuffixes["example.amazonaws.com"], "undefined"); |
194 test.equal(typeof publicSuffixes["amazonaws.com"], "undefined"); | 200 test.equal(typeof publicSuffixes["amazonaws.com"], "undefined"); |
195 | 201 |
| 202 test.equal(getDomain("images.example.s3.dualstack.us-east-1.amazonaws.com"), |
| 203 "example.s3.dualstack.us-east-1.amazonaws.com"); |
196 test.equal(getDomain("example.s3.dualstack.us-east-1.amazonaws.com"), | 204 test.equal(getDomain("example.s3.dualstack.us-east-1.amazonaws.com"), |
197 "example.s3.dualstack.us-east-1.amazonaws.com"); | 205 "example.s3.dualstack.us-east-1.amazonaws.com"); |
198 test.equal(getDomain("s3.dualstack.us-east-1.amazonaws.com"), | 206 test.equal(getDomain("s3.dualstack.us-east-1.amazonaws.com"), |
199 "s3.dualstack.us-east-1.amazonaws.com"); | 207 "s3.dualstack.us-east-1.amazonaws.com"); |
200 test.equal(getDomain("dualstack.us-east-1.amazonaws.com"), | 208 test.equal(getDomain("dualstack.us-east-1.amazonaws.com"), |
201 "dualstack.us-east-1.amazonaws.com"); | 209 "dualstack.us-east-1.amazonaws.com"); |
202 test.equal(getDomain("example.us-east-1.amazonaws.com"), | 210 test.equal(getDomain("example.us-east-1.amazonaws.com"), |
203 "example.us-east-1.amazonaws.com"); | 211 "example.us-east-1.amazonaws.com"); |
204 test.equal(getDomain("us-east-1.amazonaws.com"), "us-east-1.amazonaws.com"); | 212 test.equal(getDomain("us-east-1.amazonaws.com"), "us-east-1.amazonaws.com"); |
205 test.equal(getDomain("example.amazonaws.com"), "amazonaws.com"); | 213 test.equal(getDomain("example.amazonaws.com"), "amazonaws.com"); |
206 test.equal(getDomain("amazonaws.com"), "amazonaws.com"); | 214 test.equal(getDomain("amazonaws.com"), "amazonaws.com"); |
207 | 215 |
208 // Edge case. | 216 // Edge case. |
209 test.equal(getDomain(""), ""); | 217 test.equal(getDomain(""), ""); |
210 | 218 |
211 test.done(); | 219 test.done(); |
212 }; | 220 }; |
LEFT | RIGHT |