Skip to content

Commit 18c3a38

Browse files
committed
Pass sourceUuid through the source fetching pipeline
1 parent 6ad697c commit 18c3a38

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/components/app/SourceCodeFetcher.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
getSymbolServerUrl,
1212
getSourceViewFile,
1313
getSourceViewSourceIndex,
14+
getSourceViewSourceUuid,
1415
} from 'firefox-profiler/selectors';
1516
import {
1617
beginLoadingSourceCodeFromUrl,
@@ -35,6 +36,7 @@ import type {
3536
type StateProps = {
3637
readonly sourceViewFile: string | null;
3738
readonly sourceViewSourceIndex: IndexIntoSourceTable | null;
39+
readonly sourceViewSourceUuid: string | null;
3840
readonly sourceViewCode: SourceCodeStatus | void;
3941
readonly symbolServerUrl: string;
4042
readonly profile: Profile | null;
@@ -73,6 +75,7 @@ class SourceCodeFetcherImpl extends React.PureComponent<Props> {
7375
sourceViewSourceIndex,
7476
sourceViewCode,
7577
sourceViewFile,
78+
sourceViewSourceUuid,
7679
beginLoadingSourceCodeFromUrl,
7780
beginLoadingSourceCodeFromBrowserConnection,
7881
finishLoadingSourceCode,
@@ -109,6 +112,7 @@ class SourceCodeFetcherImpl extends React.PureComponent<Props> {
109112

110113
const fetchSourceResult = await fetchSource(
111114
sourceViewFile,
115+
sourceViewSourceUuid,
112116
symbolServerUrl,
113117
addressProof,
114118
this._archiveCache,
@@ -140,6 +144,7 @@ export const SourceCodeFetcher = explicitConnect<{}, StateProps, DispatchProps>(
140144
mapStateToProps: (state) => ({
141145
sourceViewSourceIndex: getSourceViewSourceIndex(state),
142146
sourceViewFile: getSourceViewFile(state),
147+
sourceViewSourceUuid: getSourceViewSourceUuid(state),
143148
sourceViewCode: getSourceViewCode(state),
144149
symbolServerUrl: getSymbolServerUrl(state),
145150
profile: getProfileOrNull(state),

src/test/unit/fetch-source.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('fetchSource', function () {
99
expect(
1010
await fetchSource(
1111
'hg:hg.mozilla.org/mozilla-central:widget/cocoa/nsAppShell.mm:997f00815e6bc28806b75448c8829f0259d2cb28',
12+
null,
1213
'https://symbolication.services.mozilla.com',
1314
null,
1415
new Map(),
@@ -72,6 +73,7 @@ describe('fetchSource', function () {
7273
expect(
7374
await fetchSource(
7475
'cargo:github.com-1ecc6299db9ec823:addr2line-0.17.0:src/lib.rs',
76+
null,
7577
'https://symbolication.services.mozilla.com',
7678
null,
7779
archiveCache,
@@ -90,6 +92,7 @@ describe('fetchSource', function () {
9092
expect(
9193
await fetchSource(
9294
'cargo:github.com-1ecc6299db9ec823:addr2line-0.17.0:src/function.rs',
95+
null,
9396
'https://symbolication.services.mozilla.com',
9497
null,
9598
archiveCache,
@@ -106,6 +109,7 @@ describe('fetchSource', function () {
106109
expect(
107110
await fetchSource(
108111
'cargo:github.com-1ecc6299db9ec823:addr2line-0.17.0:src/nonexist.rs',
112+
null,
109113
'https://symbolication.services.mozilla.com',
110114
null,
111115
archiveCache,
@@ -129,6 +133,7 @@ describe('fetchSource', function () {
129133
expect(
130134
await fetchSource(
131135
'hg:hg.mozilla.org/mozilla-central:widget/cocoa/nsAppShell.mm:997f00815e6bc28806b75448c8829f0259d2cb28',
136+
null,
132137
'https://symbolication.services.mozilla.com',
133138
null,
134139
new Map(),
@@ -161,6 +166,7 @@ describe('fetchSource', function () {
161166
expect(
162167
await fetchSource(
163168
'/Users/mstange/code/mozilla/gfx/wr/webrender/src/renderer/mod.rs',
169+
null,
164170
'https://symbolication.services.mozilla.com',
165171
{
166172
debugName: 'FAKE_DEBUGNAME',
@@ -199,6 +205,7 @@ describe('fetchSource', function () {
199205
expect(
200206
await fetchSource(
201207
'/Users/mstange/code/mozilla/gfx/wr/webrender/src/renderer/mod.rs',
208+
null,
202209
'http://127.0.0.1:3000',
203210
{
204211
debugName: 'FAKE_DEBUGNAME',
@@ -249,6 +256,7 @@ describe('fetchSource', function () {
249256
expect(
250257
await fetchSource(
251258
'git:github.com/rust-lang/rust:library/core/src/intrinsics.rs:acbe4443cc4c9695c0b74a7b64b60333c990a400',
259+
null,
252260
'http://127.0.0.1:3001',
253261
{
254262
debugName: 'FAKE_DEBUGNAME',
@@ -299,6 +307,7 @@ describe('fetchSource', function () {
299307
expect(
300308
await fetchSource(
301309
'git:github.com/rust-lang/rust:library/core/src/intrinsics.rs:acbe4443cc4c9695c0b74a7b64b60333c990a400',
310+
null,
302311
'http://127.0.0.1:3002',
303312
{
304313
debugName: 'FAKE_DEBUGNAME',
@@ -347,6 +356,7 @@ describe('fetchSource', function () {
347356
expect(
348357
await fetchSource(
349358
'git:github.com/rust-lang/rust:library/core/src/intrinsics.rs:acbe4443cc4c9695c0b74a7b64b60333c990a400',
359+
null,
350360
'http://127.0.0.1:3003',
351361
{
352362
debugName: 'FAKE_DEBUGNAME',
@@ -391,6 +401,7 @@ describe('fetchSource', function () {
391401
expect(
392402
await fetchSource(
393403
'git:git.iximeow.net/yaxpeax-arm:src/armv8/a64.rs:0663147eacdef847cc1bdc07cf89eed14b1aeaca',
404+
null,
394405
'https://symbolication.services.mozilla.com',
395406
null,
396407
new Map(),
@@ -416,6 +427,7 @@ describe('fetchSource', function () {
416427
expect(
417428
await fetchSource(
418429
'/Users/mstange/code/mozilla/gfx/wr/webrender/src/renderer/mod.rs',
430+
null,
419431
'https://symbolication.services.mozilla.com',
420432
{
421433
debugName: 'FAKE_DEBUGNAME',
@@ -456,6 +468,7 @@ describe('fetchSource', function () {
456468
expect(
457469
await fetchSource(
458470
'/Users/mstange/code/mozilla/gfx/wr/webrender/src/renderer/mod.rs',
471+
null,
459472
'https://symbolication.services.mozilla.com',
460473
{
461474
debugName: 'FAKE_DEBUGNAME',

src/utils/fetch-source.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export type FetchSourceResult =
2828
* then this will call `callbacks.fetchUrlResponse("https://hg.mozilla.org/mozilla-central/raw-file/997f00815e6bc28806b75448c8829f0259d2cb28/widget/cocoa/nsAppShell.mm")`.
2929
*
3030
* @param file - The path of the file that should be fetched
31+
* @param sourceUUid - The optional UUID of the JS source file that should be
32+
* fetched. It's null for non-JS files.
3133
* @param symbolServerUrl - The symbol server URL, used for getting source code
3234
* from local servers via the symbolication API /source/v1.
3335
* @param addressProof - An "address proof" for the requested file, if known. Otherwise null.
@@ -37,6 +39,7 @@ export type FetchSourceResult =
3739
*/
3840
export async function fetchSource(
3941
file: string,
42+
_sourceUuid: string | null,
4043
symbolServerUrl: string,
4144
addressProof: AddressProof | null,
4245
archiveCache: Map<string, Promise<Uint8Array>>,

0 commit comments

Comments
 (0)