mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1688067 - [devtools] Repurpose refreshTab as reloadBrowser and use in browser_toolbox_error_count_reset_on_navigation.js r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D124168
This commit is contained in:
parent
2ff758e8ee
commit
df5701fd64
@ -158,7 +158,7 @@ async function closeAboutDevtoolsToolbox(
|
||||
async function reloadAboutDebugging(tab) {
|
||||
info("reload about:debugging");
|
||||
|
||||
await refreshTab(tab);
|
||||
await reloadBrowser(tab.linkedBrowser);
|
||||
const browser = tab.linkedBrowser;
|
||||
const document = browser.contentDocument;
|
||||
const window = browser.contentWindow;
|
||||
|
@ -44,7 +44,7 @@ add_task(async function() {
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
await waitForSource(dbg, "inline-cache.html");
|
||||
info("Reload tab to ensure debugger finds script");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
let pageValue = await getPageValue(tab);
|
||||
is(pageValue, "let x = 1;", "Content loads from network, has doc value 1");
|
||||
await waitForSource(dbg, "inline-cache.html");
|
||||
@ -64,7 +64,7 @@ add_task(async function() {
|
||||
makeChanges();
|
||||
|
||||
info("Reload inside debugger with toolbox caching disabled (attempt 1)");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
pageValue = await getPageValue(tab);
|
||||
is(pageValue, "let x = 2;", "Content loads from network, has doc value 2");
|
||||
await waitForLoadedSource(dbg, "inline-cache.html");
|
||||
@ -79,7 +79,7 @@ add_task(async function() {
|
||||
makeChanges();
|
||||
|
||||
info("Reload inside debugger with toolbox caching disabled (attempt 2)");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
pageValue = await getPageValue(tab);
|
||||
is(pageValue, "let x = 3;", "Content loads from network, has doc value 3");
|
||||
await waitForLoadedSource(dbg, "inline-cache.html");
|
||||
@ -101,7 +101,7 @@ add_task(async function() {
|
||||
// document contents.
|
||||
|
||||
info("Reload inside debugger with toolbox caching enabled (attempt 1)");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
pageValue = await getPageValue(tab);
|
||||
is(pageValue, "let x = 4;", "Content loads from network, has doc value 4");
|
||||
await waitForLoadedSource(dbg, "inline-cache.html");
|
||||
@ -115,7 +115,7 @@ add_task(async function() {
|
||||
makeChanges();
|
||||
|
||||
info("Reload inside debugger with toolbox caching enabled (attempt 2)");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
pageValue = await getPageValue(tab);
|
||||
is(pageValue, "let x = 5;", "Content loads from network, has doc value 5");
|
||||
await waitForLoadedSource(dbg, "inline-cache.html");
|
||||
|
@ -44,7 +44,7 @@ add_task(async function() {
|
||||
const toolbox = await openNewTabAndToolbox(IFRAME_TEST_URI, "webconsole");
|
||||
|
||||
info("Reload the test page, which will trigger the debugger statement in the iframe");
|
||||
const pausedReload = refreshTab();
|
||||
const pausedReload = reloadBrowser();
|
||||
|
||||
const dbg = await assertDebuggerIsHighlightedAndPaused(toolbox);
|
||||
const source = findSource(dbg, IFRAME_TEST_COM_URI);
|
||||
@ -64,7 +64,7 @@ add_task(async function() {
|
||||
const toolbox = await openNewTabAndToolbox(IFRAME_TEST_URI, "webconsole");
|
||||
|
||||
info("Reload the test page, which will trigger the debugger statement in the iframe");
|
||||
const pausedReload = refreshTab();
|
||||
const pausedReload = reloadBrowser();
|
||||
|
||||
const dbg = await assertDebuggerIsHighlightedAndPaused(toolbox);
|
||||
const topLevelThread= toolbox.commands.targetCommand.targetFront.threadFront.actorID;
|
||||
|
@ -35,7 +35,7 @@ add_task(async function() {
|
||||
// Reload the page. The sjs ensures that a different source file
|
||||
// will be loaded.
|
||||
sourceSeen = waitForSourceLoad(toolbox, JS_URL);
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await sourceSeen;
|
||||
|
||||
info(
|
||||
|
@ -59,7 +59,7 @@ add_task(async function() {
|
||||
info(
|
||||
"Reload the page and check that the error icon has the expected content"
|
||||
);
|
||||
tab.linkedBrowser.reload();
|
||||
await reloadBrowser();
|
||||
|
||||
await waitFor(
|
||||
() => getErrorIconCount(toolbox) === expectedErrorCount,
|
||||
@ -70,7 +70,7 @@ add_task(async function() {
|
||||
info(
|
||||
"Navigate to an error-less page and check that the error icon is hidden"
|
||||
);
|
||||
navigateTo(`data:text/html;charset=utf8,No errors`);
|
||||
await navigateTo(`data:text/html;charset=utf8,No errors`);
|
||||
await waitFor(
|
||||
() => !getErrorIcon(toolbox),
|
||||
"Error count is cleared on navigation"
|
||||
|
@ -29,7 +29,7 @@ add_task(async function() {
|
||||
cbx.scrollIntoView();
|
||||
cbx.click();
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
data = await register();
|
||||
is(data.success, true, "Register should success");
|
||||
@ -41,7 +41,7 @@ add_task(async function() {
|
||||
info("Workers should be turned back off when we closes the toolbox");
|
||||
await toolbox.destroy();
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
data = await register();
|
||||
is(data.success, false, "Register should fail with security error");
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ add_task(async function() {
|
||||
|
||||
info("Reload the page");
|
||||
const onMarkupLoaded = waitForMarkupLoaded(inspector);
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await onMarkupLoaded;
|
||||
|
||||
info("Test that the box model view works on the reloaded page");
|
||||
|
@ -77,7 +77,7 @@ add_task(async function() {
|
||||
);
|
||||
|
||||
const onReloaded = inspector.once("reloaded");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
info("Wait for inspector to be reloaded after page reload");
|
||||
await onReloaded;
|
||||
|
||||
|
@ -136,7 +136,7 @@ add_task(async function() {
|
||||
!state.grids[3].highlighted &&
|
||||
state.grids[3].disabled
|
||||
);
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await onStateRestored;
|
||||
await onGridListRestored;
|
||||
|
||||
|
@ -18,7 +18,7 @@ add_task(async function() {
|
||||
info("Selecting the UL node");
|
||||
await clickContainer("ul", inspector);
|
||||
info("Reloading the page with the UL node selected will expand its children");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await inspector.markup._waitForChildren();
|
||||
|
||||
info("Click on the 'show all nodes' button in the UL's list of children");
|
||||
|
@ -17,7 +17,7 @@ add_task(async function() {
|
||||
info("Check that the markup-view shows the expected nodes before reload");
|
||||
await checkMarkupView(inspector);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
info("Check that the markup-view shows the expected nodes after reload");
|
||||
await checkMarkupView(inspector);
|
||||
|
@ -82,7 +82,7 @@ add_task(async function() {
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
|
||||
info("Test autocompletion after page navigation");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
});
|
||||
|
||||
|
@ -48,7 +48,7 @@ add_task(async function() {
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
|
||||
info("Test autocompletion after page navigation");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
});
|
||||
|
||||
|
@ -51,7 +51,7 @@ add_task(async function() {
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
|
||||
info("Test autocompletion after page navigation");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
});
|
||||
|
||||
|
@ -60,7 +60,7 @@ add_task(async function() {
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
|
||||
info("Test autocompletion after page navigation");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await runAutocompletionTest(toolbox, inspector, view);
|
||||
});
|
||||
|
||||
|
@ -35,7 +35,7 @@ add_task(async function() {
|
||||
ok(view.popup && view.popup.isOpen, "Popup should be opened");
|
||||
|
||||
info("Reloading the page");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
ok(!(view.popup && view.popup.isOpen), "Popup should be closed");
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ add_task(async function() {
|
||||
info("Close the toolbox before reloading the tab.");
|
||||
await gDevTools.closeToolboxForTab(tab);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
info(
|
||||
"Check that the flexbox highlighter can be displayed after reloading the page."
|
||||
|
@ -51,7 +51,7 @@ add_task(async function() {
|
||||
info("Reload the page, expect the highlighter to be displayed once again");
|
||||
const onRestored = waitForHighlighterTypeRestored(HIGHLIGHTER_TYPE);
|
||||
const onReloaded = inspector.once("reloaded");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
info("Wait for inspector to be reloaded after page reload");
|
||||
await onReloaded;
|
||||
info("Wait for the highlighter to be restored");
|
||||
|
@ -28,7 +28,7 @@ add_task(async function() {
|
||||
info("Close the toolbox before reloading the tab");
|
||||
await gDevTools.closeToolboxForTab(gBrowser.selectedTab);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
info(
|
||||
"Check that the grid highlighter can be displayed after reloading the page"
|
||||
|
@ -58,7 +58,7 @@ add_task(async function() {
|
||||
const onRestored = waitForHighlighterTypeRestored(HIGHLIGHTER_TYPE);
|
||||
|
||||
const onReloaded = inspector.once("reloaded");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
info("Wait for inspector to be reloaded after page reload");
|
||||
await onReloaded;
|
||||
|
||||
|
@ -39,7 +39,7 @@ add_task(async function() {
|
||||
ok(true, "Small viewport media query inspected");
|
||||
|
||||
info("Reload the current page");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await selectNode("div", inspector);
|
||||
|
||||
info("Resize window so the media query for large viewports applies");
|
||||
|
@ -30,7 +30,7 @@ add_task(async function() {
|
||||
"The modifications are stored as expected"
|
||||
);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
is(
|
||||
view.store.userProperties.map.size,
|
||||
|
@ -21,7 +21,7 @@ add_task(async function() {
|
||||
isnot(y, 0, "window scrolled vertically.");
|
||||
|
||||
info("Reloading page.");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
info("Waiting for markupview to load after reload.");
|
||||
await markupLoaded;
|
||||
|
@ -63,7 +63,7 @@ this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
||||
);
|
||||
is(startWindows.length, 1);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
// Update the front as we may have switched to a new target and a new memory front
|
||||
front = panel.panelWin.gStore.getState().front;
|
||||
|
@ -13,7 +13,7 @@ add_task(async function() {
|
||||
const REQUEST =
|
||||
"http://example.com/browser/devtools/client/netmonitor/test/request_0";
|
||||
|
||||
const { tab, monitor } = await initNetMonitor(URL, {
|
||||
const { monitor } = await initNetMonitor(URL, {
|
||||
requestCount: 1,
|
||||
});
|
||||
|
||||
@ -27,7 +27,7 @@ add_task(async function() {
|
||||
const allRequestsVisible = waitUntil(
|
||||
() => document.querySelectorAll(".request-list-item").length == 2
|
||||
);
|
||||
await refreshTab(tab);
|
||||
await reloadBrowser();
|
||||
await allRequestsVisible;
|
||||
|
||||
const onStackTracesVisible = waitUntil(
|
||||
|
@ -30,7 +30,7 @@ addRDMTaskWithPreAndPost(
|
||||
info("Reload the current page");
|
||||
const onNewRoot = inspector.once("new-root");
|
||||
const onRuleViewRefreshed = inspector.once("rule-view-refreshed");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await onNewRoot;
|
||||
await inspector.markup._waitForChildren();
|
||||
await onRuleViewRefreshed;
|
||||
|
@ -443,24 +443,15 @@ var removeTab = async function(tab) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Refresh the provided tab.
|
||||
* @param {Object} tab The tab to be refreshed. Defaults to the currently selected tab.
|
||||
* @return Promise<undefined> resolved when the tab is successfully refreshed.
|
||||
* Alias for navigateTo which will reuse the current URI of the provided browser
|
||||
* to trigger a navigation.
|
||||
*/
|
||||
var refreshTab = async function(tab = gBrowser.selectedTab) {
|
||||
info("Refreshing tab.");
|
||||
// Use navigateTo if there is a toolbox opened, and wait for panels to update after reload.
|
||||
// Otherwise only wait for the tab's document to be loaded.
|
||||
const isKnownTab = TabDescriptorFactory.isKnownTab(tab);
|
||||
if (isKnownTab) {
|
||||
await navigateTo(tab.linkedBrowser.currentURI.spec);
|
||||
} else {
|
||||
const finished = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.reloadTab(tab);
|
||||
await finished;
|
||||
}
|
||||
info("Tab finished refreshing.");
|
||||
};
|
||||
async function reloadBrowser({
|
||||
browser = gBrowser.selectedBrowser,
|
||||
isErrorPage = false,
|
||||
} = {}) {
|
||||
return navigateTo(browser.currentURI.spec, { browser, isErrorPage });
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate the currently selected tab to a new URL and wait for it to load.
|
||||
|
@ -71,7 +71,7 @@ async function testNavigation() {
|
||||
await waitUntil(() => hasCookieData("foo", "bar"));
|
||||
|
||||
// reload the current page, and check again
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
// wait for storage tree refresh, and check host
|
||||
info("Waiting for storage tree to refresh and show correct host…");
|
||||
await waitUntil(() => isInTree(doc, ["cookies", "http://example.net"]));
|
||||
|
@ -64,7 +64,7 @@ async function testNavigation(shallCleanup = false) {
|
||||
// navigating. See Bug 1273802
|
||||
|
||||
// reload the current tab, and check again
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
// wait for storage tree refresh, and check host
|
||||
info("Checking storage tree…");
|
||||
await waitUntil(() => isInTree(doc, ["indexedDB", "http://example.net"]));
|
||||
|
@ -58,7 +58,7 @@ async function testNavigation() {
|
||||
);
|
||||
|
||||
// reload the current tab and check data
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
// wait for storage tree refresh, and check host
|
||||
info("Waiting for storage tree to refresh and show correct host…");
|
||||
await waitUntil(() => isInTree(doc, ["localStorage", "http://example.net"]));
|
||||
|
@ -57,7 +57,7 @@ var reloadPageAndWaitForStyleSheets = async function(ui, editorCount) {
|
||||
info("Reloading the page.");
|
||||
|
||||
const onClear = ui.once("stylesheets-clear");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await onClear;
|
||||
|
||||
await waitUntil(() => ui.editors.length === editorCount);
|
||||
|
@ -108,7 +108,7 @@ add_task(async function() {
|
||||
"Reload the page to ensure asking for autocomplete again show the confirm dialog"
|
||||
);
|
||||
onPopupClose = autocompletePopup.once("popup-closed");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
info("tab reloaded, waiting for the popup to close");
|
||||
await onPopupClose;
|
||||
|
||||
|
@ -39,7 +39,7 @@ add_task(async function() {
|
||||
|
||||
info("reload the page to close the popup");
|
||||
const onPopupClose = popup.once("popup-closed");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await onPopupClose;
|
||||
|
||||
ok(!popup.isOpen, "popup is not open after reloading the page");
|
||||
|
@ -20,7 +20,7 @@ add_task(async function() {
|
||||
info(
|
||||
"Reload the page to check that JsTerm does not steal the content page focus"
|
||||
);
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
is(
|
||||
isInputFocused(hud),
|
||||
false,
|
||||
|
@ -16,13 +16,13 @@ add_task(async function() {
|
||||
|
||||
info("Refresh tab several times and check for correct message indentation");
|
||||
for (let i = 0; i < 5; i++) {
|
||||
await refreshTabAndCheckIndent(hud);
|
||||
await reloadBrowserAndCheckIndent(hud);
|
||||
}
|
||||
});
|
||||
|
||||
async function refreshTabAndCheckIndent(hud) {
|
||||
async function reloadBrowserAndCheckIndent(hud) {
|
||||
const onMessage = waitForMessage(hud, "hello", ".startGroup");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
const { node } = await onMessage;
|
||||
|
||||
is(
|
||||
|
@ -40,7 +40,7 @@ add_task(async function() {
|
||||
await logAndAssertInitialMessages(hud);
|
||||
|
||||
const onReloaded = hud.ui.once("reloaded");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await onReloaded;
|
||||
|
||||
info("Wait for messages to be cleared");
|
||||
@ -162,7 +162,7 @@ add_task(async function() {
|
||||
// Because will-navigate DOCUMENT_EVENT timestamp is shifted to workaround some other limitation,
|
||||
// the reported time of navigation may actually be slightly off and be older than the real navigation start
|
||||
let timeBeforeNavigation = Date.now() - WILL_NAVIGATE_TIME_SHIFT;
|
||||
refreshTab();
|
||||
reloadBrowser();
|
||||
await onNavigatedMessage;
|
||||
await onReloaded;
|
||||
|
||||
|
@ -22,7 +22,7 @@ add_task(async function() {
|
||||
await clearOutput(hud);
|
||||
|
||||
expectUncaughtExceptionNoE10s();
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await waitForError(hud);
|
||||
|
||||
// Close and reopen
|
||||
@ -33,7 +33,7 @@ add_task(async function() {
|
||||
hud = await openNewTabAndConsole(TEST_URI);
|
||||
|
||||
expectUncaughtExceptionNoE10s();
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await waitForError(hud);
|
||||
});
|
||||
|
||||
|
@ -39,7 +39,7 @@ add_task(async function() {
|
||||
"The console is scrolled to the bottom"
|
||||
);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
info("Console should be scrolled to bottom after refresh from page logs");
|
||||
await waitFor(() => findMessage(hud, "init-99"));
|
||||
|
@ -18,7 +18,7 @@ add_task(async function() {
|
||||
await waitFor(() => findMessage(hud, "is not a function"));
|
||||
checkErrorDisplayedTelemetry("JSMSG_NOT_FUNCTION", 1);
|
||||
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
info("Reloading the page (and having the same error) increments the sum");
|
||||
await waitFor(() => findMessage(hud, "is not a function"));
|
||||
|
@ -36,7 +36,7 @@ async function testWarningNotPresent(hud) {
|
||||
info(
|
||||
"wait for the page to refresh and make sure the warning still isn't there"
|
||||
);
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await waitFor(() => {
|
||||
// We need to wait for 3 messages because there are two logs, plus the
|
||||
// navigation message since messages are persisted
|
||||
@ -51,7 +51,7 @@ async function testWarningPresent(hud) {
|
||||
await waitFor(() => findMessage(hud, "logging API"));
|
||||
|
||||
info("reload the test page and wait for the warning to show");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
await waitFor(() => {
|
||||
return findMessages(hud, "logging API").length === 2;
|
||||
});
|
||||
|
@ -172,7 +172,7 @@ add_task(async function() {
|
||||
"When targets follow the WindowGlobal lifecycle and handle only one document, " +
|
||||
"only check that the panel refreshes correctly and emit its 'reloaded' event"
|
||||
);
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
} else {
|
||||
info(
|
||||
"When targets follow the DocShell lifecycle and handle more than one document, " +
|
||||
|
@ -113,7 +113,7 @@ add_task(async function() {
|
||||
availableResources = [];
|
||||
|
||||
info("Check that styleSheetChangeEventsEnabled persist after reloading");
|
||||
await refreshTab();
|
||||
await reloadBrowser();
|
||||
|
||||
// ⚠️ We're only getting the stylesheets for the top-level document and the remote frames;
|
||||
// the same-origin iframes stylesheets are missing.
|
||||
|
Loading…
Reference in New Issue
Block a user