browser_resources_stylesheets_nested_iframes.js (1034B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that stylesheets are retrieved even if an iframe does not have a content document. 7 8 const TEST_URI = URL_ROOT_SSL + "stylesheets-nested-iframes.html"; 9 10 add_task(async function () { 11 const tab = await addTab(TEST_URI); 12 13 const { client, resourceCommand, targetCommand } = 14 await initResourceCommand(tab); 15 16 info("Check whether ResourceCommand gets existing stylesheet"); 17 const availableResources = []; 18 await resourceCommand.watchResources([resourceCommand.TYPES.STYLESHEET], { 19 onAvailable: resources => availableResources.push(...resources), 20 }); 21 22 // Bug 285395 limits the number of nested iframes to 10, and we have one stylesheet per document. 23 await waitFor(() => availableResources.length >= 10); 24 25 is( 26 availableResources.length, 27 10, 28 "Got the expected number of stylesheets, even with documentless iframes" 29 ); 30 31 targetCommand.destroy(); 32 await client.close(); 33 });