browser_inspector_highlighter-06.js (1227B)
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 5 "use strict"; 6 7 // Test that the browser remembers the previous scroll position after reload, even with 8 // Inspector opened - Bug 1382341. 9 // NOTE: Using a real file instead data: URL since the bug won't happen on data: URL 10 const TEST_URI = URL_ROOT + "doc_inspector_highlighter_scroll.html"; 11 12 add_task(async function () { 13 const { inspector } = await openInspectorForURL(TEST_URI); 14 15 await scrollContentPageNodeIntoView(gBrowser.selectedBrowser, "a"); 16 await selectAndHighlightNode("a", inspector); 17 18 const markupLoaded = inspector.once("markuploaded"); 19 20 const y = await getPageYOffset(); 21 isnot(y, 0, "window scrolled vertically."); 22 23 info("Reloading page."); 24 await reloadBrowser(); 25 26 info("Waiting for markupview to load after reload."); 27 await markupLoaded; 28 29 const newY = await getPageYOffset(); 30 is(y, newY, "window remember the previous scroll position."); 31 }); 32 33 async function getPageYOffset() { 34 return SpecialPowers.spawn( 35 gBrowser.selectedBrowser, 36 [], 37 () => content.pageYOffset 38 ); 39 }