@@ -320,6 +320,27 @@ const manifestUpdateHash = sha1(JSON.stringify(manifestUpdate));
320
320
expect ( await makeRequest ( scope , '/foo.txt' ) ) . toEqual ( 'this is foo v2' ) ;
321
321
} ) ;
322
322
323
+ async_it ( 'handles empty client ID' , async ( ) => {
324
+ const navRequest = ( url : string , clientId : string | null ) =>
325
+ makeRequest ( scope , url , clientId , {
326
+ headers : { Accept : 'text/plain, text/html, text/css' } ,
327
+ mode : 'navigate' ,
328
+ } ) ;
329
+
330
+ // Initialize the SW.
331
+ expect ( await navRequest ( '/foo/file1' , '' ) ) . toEqual ( 'this is foo' ) ;
332
+ expect ( await navRequest ( '/bar/file2' , null ) ) . toEqual ( 'this is foo' ) ;
333
+ await driver . initialized ;
334
+
335
+ // Update to a new version.
336
+ scope . updateServerState ( serverUpdate ) ;
337
+ expect ( await driver . checkForUpdate ( ) ) . toEqual ( true ) ;
338
+
339
+ // Correctly handle navigation requests, even if `clientId` is null/empty.
340
+ expect ( await navRequest ( '/foo/file1' , '' ) ) . toEqual ( 'this is foo v2' ) ;
341
+ expect ( await navRequest ( '/bar/file2' , null ) ) . toEqual ( 'this is foo v2' ) ;
342
+ } ) ;
343
+
323
344
async_it ( 'checks for updates on restart' , async ( ) => {
324
345
expect ( await makeRequest ( scope , '/foo.txt' ) ) . toEqual ( 'this is foo' ) ;
325
346
await driver . initialized ;
0 commit comments