browser_inspector_reload-02.js (1826B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 // A test to ensure reloading a page doesn't break the inspector. 7 8 // Reload should reselect the currently selected markup view element. 9 // This should work even when an element whose selector is inaccessible 10 // is selected (bug 1038651). 11 const TEST_URI = 12 'data:text/xml,<?xml version="1.0" standalone="no"?>' + 13 '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"' + 14 ' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + 15 '<svg width="4cm" height="4cm" viewBox="0 0 400 400"' + 16 ' xmlns="http://www.w3.org/2000/svg" version="1.1">' + 17 " <title>Example triangle01- simple example of a path</title>" + 18 " <desc>A path that draws a triangle</desc>" + 19 ' <rect x="1" y="1" width="398" height="398"' + 20 ' fill="none" stroke="blue" />' + 21 ' <path d="M 100 100 L 300 100 L 200 300 z"' + 22 ' fill="red" stroke="blue" stroke-width="3" />' + 23 "</svg>"; 24 25 add_task(async function () { 26 const { inspector } = await openInspectorForURL(TEST_URI); 27 28 const markupLoaded = inspector.once("markuploaded"); 29 30 info("Reloading page."); 31 await navigateTo(TEST_URI); 32 33 info("Waiting for markupview to load after reload."); 34 await markupLoaded; 35 36 const svgFront = await getNodeFront("svg", inspector); 37 is(inspector.selection.nodeFront, svgFront, "<svg> selected after reload."); 38 39 info("Selecting a node to see that inspector still works."); 40 await selectNode("rect", inspector); 41 42 info("Reloading page."); 43 await navigateTo(TEST_URI); 44 45 const rectFront = await getNodeFront("rect", inspector); 46 is(inspector.selection.nodeFront, rectFront, "<rect> selected after reload."); 47 });