3 var idna
= Cc
["@mozilla.org/network/idn-service;1"].getService(
8 var file
= do_get_file("data/test_psl.txt");
9 var uri
= Services
.io
.newFileURI(file
);
11 Services
.scriptloader
.loadSubScript(uri
.spec
, srvScope
);
14 // Exported to the loaded script
15 /* exported checkPublicSuffix */
16 function checkPublicSuffix(host
, expectedSuffix
) {
17 var actualSuffix
= null;
19 actualSuffix
= Services
.eTLD
.getBaseDomainFromHost(host
);
22 e
.result
!= Cr
.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS
&&
23 e
.result
!= Cr
.NS_ERROR_ILLEGAL_VALUE
28 // The EffectiveTLDService always gives back punycoded labels.
29 // The test suite wants to get back what it put in.
31 actualSuffix
!== null &&
32 expectedSuffix
!== null &&
33 /(^|\.)xn--/.test(actualSuffix
) &&
34 !/(^|\.)xn--/.test(expectedSuffix
)
36 actualSuffix
= idna
.convertACEtoUTF8(actualSuffix
);
38 Assert
.equal(actualSuffix
, expectedSuffix
);