Skip to content

Commit 65ac775

Browse files
author
Atila Butkovits
committed
Revert "Bug 1971094 - [devtools] Update search results when the selected source changes r=devtools-reviewers,nchevobbe" for causing failures at browser_dbg-search-file-retains-query.js.
This reverts commit c853ad4.
1 parent a0d6931 commit 65ac775

File tree

3 files changed

+8
-55
lines changed

3 files changed

+8
-55
lines changed

devtools/client/debugger/src/components/Editor/SearchInFileBar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
getIsCurrentThreadPaused,
1414
getSelectedSourceTextContent,
1515
getSearchOptions,
16+
getSelectedFrame,
1617
} from "../../selectors/index";
1718

1819
import { searchKeys } from "../../constants";
@@ -59,6 +60,7 @@ class SearchInFileBar extends Component {
5960
searchInFileEnabled: PropTypes.bool.isRequired,
6061
selectedSourceTextContent: PropTypes.object,
6162
selectedSource: PropTypes.object.isRequired,
63+
selectedFrame: PropTypes.object.isRequired,
6264
setActiveSearch: PropTypes.func.isRequired,
6365
querySearchWorker: PropTypes.func.isRequired,
6466
selectLocation: PropTypes.func.isRequired,
@@ -83,8 +85,9 @@ class SearchInFileBar extends Component {
8385
query &&
8486
this.props.selectedSource &&
8587
this.props.searchInFileEnabled &&
88+
nextProps.selectedFrame &&
8689
// If a new source is selected update the file search results
87-
this.props.selectedSource.id !== nextProps.selectedSource.id
90+
nextProps.selectedFrame.location.source.id !== nextProps.selectedSource.id
8891
) {
8992
// Do not scroll to the search location, if we just switched a new source
9093
// and debugger is already paused on a selelcted line.
@@ -397,6 +400,7 @@ const mapStateToProps = state => {
397400
selectedSource: getSelectedSource(state),
398401
isPaused: getIsCurrentThreadPaused(state),
399402
selectedSourceTextContent: getSelectedSourceTextContent(state),
403+
selectedFrame: getSelectedFrame(state),
400404
modifiers: getSearchOptions(state, "file-search"),
401405
};
402406
};

devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
44

5+
// Tests the search bar retains previous query on re-opening.
6+
57
"use strict";
68

7-
// Tests the search bar retains previous query on re-opening.
8-
add_task(async function testSearchRetainsPreviousQuery() {
9+
add_task(async function () {
910
const dbg = await initDebugger("doc-scripts.html", "simple1.js");
1011
const {
1112
selectors: { getActiveSearch },
@@ -35,54 +36,3 @@ add_task(async function testSearchRetainsPreviousQuery() {
3536
// Test for the retained query
3637
is(findElement(dbg, "fileSearchInput").value, "con");
3738
});
38-
39-
// Tests that the search results are updated when switching between sources
40-
add_task(async function testSearchUpdatesResultsOnSourceChanges() {
41-
const dbg = await initDebugger("doc-scripts.html", "simple1.js", "long.js");
42-
const {
43-
selectors: { getActiveSearch },
44-
} = dbg;
45-
46-
await selectSource(dbg, "simple1.js");
47-
48-
// Open search bar
49-
pressKey(dbg, "fileSearch");
50-
await waitFor(() => getActiveSearch() === "file");
51-
is(getActiveSearch(), "file");
52-
53-
// Type a search query
54-
const searchQuery = "this";
55-
type(dbg, searchQuery);
56-
await waitForSearchState(dbg);
57-
58-
await waitUntil(
59-
() => findElement(dbg, "fileSearchSummary").innerText !== "No results found"
60-
);
61-
62-
is(
63-
findElement(dbg, "fileSearchSummary").innerText,
64-
"1 of 3 results",
65-
`There are 3 results found for search query "${searchQuery}" in simple1.js`
66-
);
67-
is(
68-
findElement(dbg, "fileSearchInput").value,
69-
searchQuery,
70-
`The search input value matches the search query "${searchQuery}"`
71-
);
72-
73-
info("Switch to long.js");
74-
await selectSource(dbg, "long.js");
75-
76-
await waitUntil(
77-
() => findElement(dbg, "fileSearchSummary").innerText == "1 of 23 results"
78-
);
79-
ok(
80-
true,
81-
`There are 23 results found for search query "${searchQuery}" in long.js`
82-
);
83-
is(
84-
findElement(dbg, "fileSearchInput").value,
85-
searchQuery,
86-
`The search input value still matches the search query "${searchQuery}"`
87-
);
88-
});

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,6 @@ const selectors = {
19401940
sourceTreeFolderNode: ".sources-panel .node .folder",
19411941
excludePatternsInput: ".project-text-search .exclude-patterns-field input",
19421942
fileSearchInput: ".search-bar input",
1943-
fileSearchSummary: ".search-bar .search-field-summary",
19441943
watchExpressionsHeader: ".watch-expressions-pane ._header .header-label",
19451944
watchExpressionsAddButton: ".watch-expressions-pane ._header .plus",
19461945
editorNotificationFooter: ".editor-notification-footer",

0 commit comments

Comments
 (0)