browser_styleeditor_fission_switch_target.js (1265B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 // Test switching for the top-level target. 6 7 const PARENT_PROCESS_URI = "about:robots"; 8 const CONTENT_PROCESS_URI = TEST_BASE_HTTPS + "simple.html"; 9 10 add_task(async function () { 11 // We use about:robots, because this page will run in the parent process. 12 // Navigating from about:robots to a regular content page will always trigger a target 13 // switch, with or without fission. 14 15 info("Open a page that runs in the parent process"); 16 const { ui } = await openStyleEditorForURL(PARENT_PROCESS_URI); 17 await waitUntil(() => ui.editors.length === 7); 18 ok(true, `Seven style sheets for ${PARENT_PROCESS_URI}`); 19 20 info("Navigate to a page that runs in the child process"); 21 await navigateToAndWaitForStyleSheets(CONTENT_PROCESS_URI, ui, 2); 22 // We also have to wait for the toolbox to complete the target switching 23 // in order to avoid pending requests during test teardown. 24 ok( 25 ui.editors.every( 26 editor => editor._resource.nodeHref == CONTENT_PROCESS_URI 27 ), 28 `Two sheets present for ${CONTENT_PROCESS_URI}` 29 ); 30 31 info("Wait until the editor is ready"); 32 await waitFor(() => ui.selectedEditor?.sourceEditor); 33 });