Skip to content

Commit 7c6e3fc

Browse files
committed
Address review comments
1 parent 6e245dc commit 7c6e3fc

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

docs-developer/loading-in-profiles.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function openProfile(profile) {
147147

148148
window.addEventListener('message', listener);
149149
while (!isReady) {
150-
await new Promise((resolve) => setTimeout(resolve, 10));
150+
await new Promise((resolve) => setTimeout(resolve, 100));
151151
profilerWindow.postMessage({ name: 'is-ready' }, origin);
152152
}
153153

@@ -162,8 +162,6 @@ await waitForProfilerReady();
162162
window.postMessage({ name: 'inject-profile', profile }, '*');
163163
```
164164
165-
This
166-
167165
### File
168166
169167
> `https://profiler.firefox.com/from-file/`

src/actions/receive-profile.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ import type {
8282
InnerWindowID,
8383
Pid,
8484
OriginsTimelineRoot,
85-
DataSource,
8685
} from 'firefox-profiler/types';
8786

8887
import type {
@@ -127,7 +126,6 @@ export function loadProfile(
127126
transformStacks: TransformStacksPerThread,
128127
browserConnection: BrowserConnection | null,
129128
skipSymbolication: boolean, // Please use this in tests only.
130-
dataSource: DataSource,
131129
|}> = {},
132130
initialLoad: boolean = false
133131
): ThunkAction<Promise<void>> {
@@ -157,7 +155,6 @@ export function loadProfile(
157155
pathInZipFile: config.pathInZipFile,
158156
implementationFilter: config.implementationFilter,
159157
transformStacks: config.transformStacks,
160-
dataSource: config.dataSource,
161158
});
162159

163160
// During initial load, we are upgrading the URL and generating the UrlState
@@ -716,7 +713,6 @@ export function viewProfile(
716713
transformStacks: TransformStacksPerThread,
717714
skipSymbolication: boolean,
718715
browserConnection: BrowserConnection | null,
719-
dataSource: DataSource,
720716
|}> = {}
721717
): ThunkAction<Promise<void>> {
722718
return async (dispatch) => {
@@ -1659,6 +1655,11 @@ export function retrieveProfileForRawUrl(
16591655
dispatch(viewProfileFromPostMessage(data.profile));
16601656
break;
16611657
case 'is-ready': {
1658+
// The "inject-profile" event could be coming from a variety of locations.
1659+
// It could come from a `window.open` call on another page. It could come
1660+
// from an addon. It could come from being embedded in an iframe. In order
1661+
// to generically support these cases allow the opener to poll for the
1662+
// "is-ready" message.
16621663
console.log(
16631664
'Responding via postMessage that the profiler is ready.'
16641665
);

src/reducers/url-state.js

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ const dataSource: Reducer<DataSource> = (state = 'none', action) => {
5454
return 'unpublished';
5555
case 'SET_DATA_SOURCE':
5656
return action.dataSource;
57-
case 'PROFILE_LOADED':
58-
return action.dataSource ?? state;
5957
default:
6058
return state;
6159
}

src/test/components/UrlManager.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ describe('UrlManager', function () {
334334
const { getState, waitUntilUrlSetupPhase, createUrlManager } = setup(
335335
'/from-post-message/'
336336
);
337-
const log = console.log;
338-
(console: any).log = jest.fn();
337+
jest.spyOn(console, 'log').mockImplementation(() => {});
339338

340339
expect(getProfileOrNull(getState())).toBeFalsy();
341340

@@ -368,8 +367,5 @@ describe('UrlManager', function () {
368367
await new Promise((resolve) => setTimeout(resolve, 0));
369368

370369
expect(getProfileOrNull(getState())).toBeTruthy();
371-
372-
// Restore the console.log.
373-
(console: any).log = log;
374370
});
375371
});

src/test/store/symbolication.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ describe('doSymbolicateProfile', function () {
484484
implementationFilter: undefined,
485485
pathInZipFile: undefined,
486486
transformStacks: undefined,
487-
dataSource: undefined,
488487
});
489488
profile = ProfileViewSelectors.getProfile(getState());
490489
expect(profile).toBe(newProfile);

src/types/actions.js

-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ type ReceiveProfileAction =
400400
+pathInZipFile: ?string,
401401
+implementationFilter: ?ImplementationFilter,
402402
+transformStacks: ?TransformStacksPerThread,
403-
+dataSource: ?DataSource,
404403
|}
405404
| {|
406405
+type: 'VIEW_FULL_PROFILE',

0 commit comments

Comments
 (0)