summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_highlighter-06.js
blob: cfe48d9a02c393ae7cb4fb07553ae924d75cd4d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

// Test that the browser remembers the previous scroll position after reload, even with
// Inspector opened - Bug 1382341.
// NOTE: Using a real file instead data: URL since the bug won't happen on data: URL
const TEST_URI = URL_ROOT + "doc_inspector_highlighter_scroll.html";

add_task(async function() {
  const { inspector, testActor } = await openInspectorForURL(TEST_URI);

  await testActor.scrollIntoView("a");
  await selectAndHighlightNode("a", inspector);

  const markupLoaded = inspector.once("markuploaded");

  const y = await testActor.eval("window.pageYOffset");
  isnot(y, 0, "window scrolled vertically.");

  info("Reloading page.");
  await testActor.reload();

  info("Waiting for markupview to load after reload.");
  await markupLoaded;

  const newY = await testActor.eval("window.pageYOffset");
  is(y, newY, "window remember the previous scroll position.");
});