Skip to content

Commit 25c8ad7

Browse files
committed
Bug 2007539 - [devtools] Reload pages as Firefox does in DevTools tests. r=devtools-reviewers,nchevobbe
The `gBrowser.reloadTab` method was doing a very light reload, which could preserve iframe overriden locations. The new method ensures we load the original HTML content back, this seems to also have an impact on keep-alive which is not longer guaranteed. Only supports reloading the currently selected tab, to better replicate real user scenarios. But also to comply to `BrowserCommands.reload`, which only supports reloading the selected tab. Also tune the har test, now that requests are really cancelled and we may try to fetch reponse content for such request. Differential Revision: https://phabricator.services.mozilla.com/D277433
1 parent dec33cb commit 25c8ad7

File tree

130 files changed

+208
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+208
-183
lines changed

devtools/client/aboutdebugging/test/browser/head.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,12 @@ async function closeWebExtAboutDevtoolsToolbox(devtoolsWindow, win) {
210210
async function reloadAboutDebugging(tab) {
211211
info("reload about:debugging");
212212

213-
await reloadBrowser(tab.linkedBrowser);
213+
is(
214+
gBrowser.selectedTab,
215+
tab,
216+
"The about:debugging tab is the currently selected tab"
217+
);
218+
await reloadSelectedTab();
214219
const browser = tab.linkedBrowser;
215220
const document = browser.contentDocument;
216221
const window = browser.contentWindow;

devtools/client/accessibility/test/browser/browser_accessibility_tree_audit_all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ addA11YPanelTask(
1212
const { doc, toolbox } = env;
1313
info("Reload to have a clean state");
1414
// This is needed to reproduce the issue from Bug 1929891
15-
await reloadBrowser();
15+
await reloadSelectedTab();
1616

1717
info(`Select the "All issues" item to run all audits at once`);
1818
await toggleMenuItem(doc, toolbox.doc, TREE_FILTERS_MENU_ID, 1);

devtools/client/anti-tracking/test/browser/browser_anti_tracking_panel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ add_task(async function test_unblock_single_request() {
209209
"Tracker should now be unblocked in debugger state"
210210
);
211211

212-
await reloadBrowser(tab.linkedBrowser);
212+
await reloadSelectedTab();
213213

214214
// Test that the tracker would now load
215215
result = await loadTracker(tab.linkedBrowser);
@@ -416,7 +416,7 @@ add_task(async function test_unblock_selected_button() {
416416
);
417417

418418
// Test that both trackers now load successfully
419-
await reloadBrowser(tab.linkedBrowser);
419+
await reloadSelectedTab();
420420

421421
result = await loadTracker(tab.linkedBrowser, "https://tracking.example.org");
422422
is(result, "loaded", "First tracker should load after bulk unblock");

devtools/client/debugger/test/mochitest/browser_dbg-blackbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ add_task(async function testBlackBoxOnToolboxRestart() {
140140
await openContextMenuInDebugger(dbg, "gutterElement", 2);
141141
await selectBlackBoxContextMenuItem(dbg, "blackbox-line");
142142

143-
await reloadBrowser();
143+
await reloadSelectedTab();
144144
// Wait a little bit incase of a pause
145145
await wait(1000);
146146

@@ -159,7 +159,7 @@ add_task(async function testBlackBoxOnToolboxRestart() {
159159
// Wait for blackbox action and requests to settle to avoid unhandled promise
160160
// rejections due to pending promises.
161161
const onBlackboxDone = waitForDispatch(dbg2.store, "BLACKBOX_SOURCE_RANGES");
162-
await reloadBrowser();
162+
await reloadSelectedTab();
163163

164164
info("Wait for the blackbox action to complete");
165165
await onBlackboxDone;

devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints-fission.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ add_task(async function () {
2222
]);
2323

2424
info("Assert early timeout event breakpoint gets hit");
25-
const waitForReload = reloadBrowser();
25+
const waitForReload = reloadSelectedTab();
2626

2727
await waitForPaused(dbg);
2828
await assertPausedAtSourceAndLine(

devtools/client/debugger/test/mochitest/browser_dbg-inline-cache.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ add_task(async function () {
4444
const dbg = createDebuggerContext(toolbox);
4545
await waitForSource(dbg, "inline-cache.html");
4646
info("Reload tab to ensure debugger finds script");
47-
await reloadBrowser();
47+
await reloadSelectedTab();
4848
let pageValue = await getPageValue(tab);
4949
is(pageValue, "let x = 1;", "Content loads from network, has doc value 1");
5050
await waitForSource(dbg, "inline-cache.html");
@@ -64,7 +64,7 @@ add_task(async function () {
6464
makeChanges();
6565

6666
info("Reload inside debugger with toolbox caching disabled (attempt 1)");
67-
await reloadBrowser();
67+
await reloadSelectedTab();
6868
pageValue = await getPageValue(tab);
6969
is(pageValue, "let x = 2;", "Content loads from network, has doc value 2");
7070
await waitForLoadedSource(dbg, "inline-cache.html");
@@ -79,7 +79,7 @@ add_task(async function () {
7979
makeChanges();
8080

8181
info("Reload inside debugger with toolbox caching disabled (attempt 2)");
82-
await reloadBrowser();
82+
await reloadSelectedTab();
8383
pageValue = await getPageValue(tab);
8484
is(pageValue, "let x = 3;", "Content loads from network, has doc value 3");
8585
await waitForLoadedSource(dbg, "inline-cache.html");
@@ -101,7 +101,7 @@ add_task(async function () {
101101
// document contents.
102102

103103
info("Reload inside debugger with toolbox caching enabled (attempt 1)");
104-
await reloadBrowser();
104+
await reloadSelectedTab();
105105
pageValue = await getPageValue(tab);
106106
is(pageValue, "let x = 4;", "Content loads from network, has doc value 4");
107107
await waitForLoadedSource(dbg, "inline-cache.html");
@@ -115,7 +115,7 @@ add_task(async function () {
115115
makeChanges();
116116

117117
info("Reload inside debugger with toolbox caching enabled (attempt 2)");
118-
await reloadBrowser();
118+
await reloadSelectedTab();
119119
pageValue = await getPageValue(tab);
120120
is(pageValue, "let x = 5;", "Content loads from network, has doc value 5");
121121
await waitForLoadedSource(dbg, "inline-cache.html");

devtools/client/debugger/test/mochitest/browser_dbg-project-search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ add_task(async function testSearchExcludePatterns() {
254254
);
255255

256256
info("Assert that the exclude pattern is persisted across reloads");
257-
await reloadBrowser();
257+
await reloadSelectedTab();
258258
await openProjectSearch(dbg);
259259

260260
const excludePatternsInputElement = await waitForElement(

devtools/client/debugger/test/mochitest/browser_dbg-unselected-pause.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ add_task(async function () {
5454
info(
5555
"Reload the test page, which will trigger the debugger statement in the iframe"
5656
);
57-
const pausedReload = reloadBrowser();
57+
const pausedReload = reloadSelectedTab();
5858

5959
const dbg = await assertDebuggerIsHighlightedAndPaused(toolbox);
6060
const source = findSource(dbg, IFRAME_TEST_COM_URI);
@@ -79,7 +79,7 @@ add_task(async function () {
7979
info(
8080
"Reload the test page, which will trigger the debugger statement in the iframe"
8181
);
82-
const pausedReload = reloadBrowser();
82+
const pausedReload = reloadSelectedTab();
8383

8484
const dbg = await assertDebuggerIsHighlightedAndPaused(toolbox);
8585
const topLevelThread =

devtools/client/debugger/test/mochitest/integration/browser_dbg-features-wasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ add_task(async function () {
2727
// Reload once again, while the console is opened.
2828
// When opening the debugger, it will still miss the source content.
2929
// To see the sources, we have to reload while the debugger has been opened.
30-
await reloadBrowser();
30+
await reloadSelectedTab();
3131

3232
await toolbox.selectTool("jsdebugger");
3333
const dbg = createDebuggerContext(toolbox);

devtools/client/debugger/test/mochitest/shared-head.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ function deleteExpression(dbg, input) {
10271027
* @static
10281028
*/
10291029
async function reload(dbg, ...sources) {
1030-
await reloadBrowser();
1030+
await reloadSelectedTab();
10311031
return waitForSources(dbg, ...sources);
10321032
}
10331033

0 commit comments

Comments
 (0)