@@ -109,6 +109,14 @@ test('the post-settle verdict reports the declared canonical too, and an indexab
109109 assert . equal ( fine . declaredCanonical , undefined ) ;
110110} ) ;
111111
112+ test ( 'a SITEMAP target whose canonical names another URL is serialized, and still reports where it points' , async ( ) => {
113+ const listed = await render ( '/canonical-elsewhere' , { } , true ) ;
114+ await listed . close ( ) ;
115+ assert . equal ( listed . isIndexable , false ) ;
116+ assert . match ( listed . html ?? '' , / < l i n k r e l = " c a n o n i c a l " / , 'a listed URL is captured anyway' ) ;
117+ assert . equal ( listed . declaredCanonical , `${ base } /other` ) ;
118+ } ) ;
119+
112120// A 404's settle is skipped BY THE BAIL, not by the `status >= 400` abort: that abort only stops
113121// subresource interception, so `goto` still resolves and the page would otherwise settle in full.
114122// An earlier review argued the opposite (that `goto` rejects, making this arm dead code); this test
@@ -197,7 +205,6 @@ test('indexVerdict: the shared verdict both paths use', () => {
197205 assert . deepEqual ( indexVerdict ( { canonicalHref : 'https://x.test/other' , noindex : true } , page , false ) , {
198206 isIndexable : false ,
199207 reason : 'noindex' ,
200- declaredCanonical : 'https://x.test/other' ,
201208 } ) ;
202209} ) ;
203210
@@ -237,10 +244,20 @@ test('indexVerdict: a canonical naming another URL is reported, resolved against
237244 indexVerdict ( { canonicalHref : '/product/prd-1/new-slug.jsp#top' , noindex : false } , page , false ) . declaredCanonical ,
238245 'https://x.test/product/prd-1/new-slug.jsp'
239246 ) ;
240- // A noindex page that also names another canonical still says where it points.
247+ // Only a canonical verdict reports it: a noindex page's canonical is not something to adopt a target from.
248+ assert . equal (
249+ 'declaredCanonical' in indexVerdict ( { canonicalHref : 'https://x.test/other' , noindex : true } , page , false ) ,
250+ false
251+ ) ;
252+ // A web URL of a keyable length, or nothing.
253+ assert . equal (
254+ 'declaredCanonical' in indexVerdict ( { canonicalHref : 'ftp://x.test/other' , noindex : false } , page , false ) ,
255+ false
256+ ) ;
241257 assert . equal (
242- indexVerdict ( { canonicalHref : 'https://x.test/other' , noindex : true } , page , false ) . declaredCanonical ,
243- 'https://x.test/other'
258+ 'declaredCanonical' in
259+ indexVerdict ( { canonicalHref : `https://x.test/${ 'a' . repeat ( 3000 ) } ` , noindex : false } , page , false ) ,
260+ false
244261 ) ;
245262 // A strict variant names this document re-spelled: reported too, it is still the origin's spelling.
246263 assert . equal (
0 commit comments