mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1810979 - [devtools] Show source id for source without urls r=nchevobbe
This patch displays a source id for sources without urls in the project search results. This source id matches that shown for the source tab. Differential Revision: https://phabricator.services.mozilla.com/D168246
This commit is contained in:
parent
a8c20b3cc0
commit
5590a753bd
@ -12,6 +12,7 @@ import { getEditor } from "../utils/editor";
|
||||
|
||||
import { statusType } from "../reducers/project-text-search";
|
||||
import { getRelativePath } from "../utils/sources-tree/utils";
|
||||
import { getFormattedSourceId } from "../utils/source";
|
||||
import {
|
||||
getActiveSearch,
|
||||
getTextSearchResults,
|
||||
@ -204,7 +205,6 @@ export class ProjectSearch extends Component {
|
||||
renderFile = (file, focused, expanded) => {
|
||||
const matchesLength = file.matches.length;
|
||||
const matches = ` (${matchesLength} match${matchesLength > 1 ? "es" : ""})`;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames("file-result", { focused })}
|
||||
@ -212,7 +212,11 @@ export class ProjectSearch extends Component {
|
||||
>
|
||||
<AccessibleImage className={classnames("arrow", { expanded })} />
|
||||
<AccessibleImage className="file" />
|
||||
<span className="file-path">{getRelativePath(file.filepath)}</span>
|
||||
<span className="file-path">
|
||||
{file.filepath
|
||||
? getRelativePath(file.filepath)
|
||||
: getFormattedSourceId(file.sourceId)}
|
||||
</span>
|
||||
<span className="matches-summary">{matches}</span>
|
||||
</div>
|
||||
);
|
||||
|
@ -69,6 +69,30 @@ add_task(async function testSimpleProjectSearch() {
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function testSearchDynamicScripts() {
|
||||
const dbg = await initDebugger("doc-minified.html");
|
||||
|
||||
const executeComplete = dbg.commands.scriptCommand.execute(
|
||||
`const foo = 5; debugger; console.log(foo)`
|
||||
);
|
||||
await waitForPaused(dbg);
|
||||
|
||||
await openProjectSearch(dbg);
|
||||
type(dbg, "foo");
|
||||
pressKey(dbg, "Enter");
|
||||
|
||||
const fileResults = await waitForSearchResults(dbg, 1);
|
||||
|
||||
ok(
|
||||
/source\d+/g.test(fileResults[0].innerText),
|
||||
"The search result was found in the eval script."
|
||||
);
|
||||
|
||||
await closeProjectSearch(dbg);
|
||||
await resume(dbg);
|
||||
await executeComplete;
|
||||
});
|
||||
|
||||
// Tests that minified sources are ignored when the prettyfied versions
|
||||
// exist.
|
||||
add_task(async function testIgnoreMinifiedSourceForPrettySource() {
|
||||
|
Loading…
Reference in New Issue
Block a user