Skip to content

Commit

Permalink
Deploy Nov 12, 2024 (#5202)
Browse files Browse the repository at this point in the history
[Nazım Can Altınova] Change the test-build-coverage script to use 'yarn
test' instead of jest directly (#5180)
[Nazım Can Altınova] Retrieve the page favicons from the browser and
display it on the tab selector (#5166)
[Nazım Can Altınova] Add default favicons to extensions and pages that
don't have nay favicons (#5182)
[Nazım Can Altınova] Do not clip the favicons in call tree (#5185)
[Nazım Can Altınova] Compute the profiling start and end time for chrome
tracing profiles (#5187)
[Nazım Can Altınova] Do not include the profile startTime in window
title if it's zero (#5188)
[Markus Stange] Profile format changes for flows and stack-based markers
(#5186)
[Nazım Can Altınova] Fix some svg images for Chrome by replacing
context-fill with the black color (#5201)
[Nazım Can Altınova] Enable the tab selector (#5197)
[Nazım Can Altınova] Do not make the parent process visible by default
when something is selected in the tab selector (#5198)
  • Loading branch information
canova authored Nov 12, 2024
2 parents afa401f + 28e880e commit 07188f2
Show file tree
Hide file tree
Showing 56 changed files with 1,677 additions and 1,132 deletions.
10 changes: 10 additions & 0 deletions docs-developer/CHANGELOG-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Note that this is not an exhaustive list. Processed profile format upgraders can

## Processed profile format

### Version 51

Two new marker schema field format types have been added: `flow-id` and `terminating-flow-id`, with string index values (like `unique-string`).
An optional `isStackBased` boolean field has been added to the marker schema.

### Version 50

The serialized format can now optionally store sample and counter sample times as time deltas instead of absolute timestamps to reduce the JSON size. The unserialized version is unchanged.
Expand Down Expand Up @@ -78,6 +83,11 @@ Older versions are not documented in this changelog but can be found in [process

## Gecko profile format

### Version 31

Two new marker schema field format types have been added: `flow-id` and `terminating-flow-id`, with string index values (like `unique-string`).
An optional `isStackBased` boolean field has been added to the marker schema.

### Version 30

A new `sanitized-string` marker schema format type has been added, allowing markers to carry arbitrary strings containing PII that will be sanitized along with URLs and FilePaths.
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"test": "node bin/output-fixing-commands.js cross-env LC_ALL=C TZ=UTC NODE_ENV=test jest",
"test-all": "run-p --max-parallel 4 flow license-check lint test test-alex test-lockfile",
"test-all:ci": "run-p --max-parallel 4 flow:ci license-check lint test test-alex test-lockfile",
"test-build-coverage": "jest --coverage --coverageReporters=html",
"test-build-coverage": "yarn test --coverage --coverageReporters=html",
"test-serve-coverage": "ws -d coverage/ -p 4343",
"test-coverage": "run-s test-build-coverage test-serve-coverage",
"test-alex": "alex ./docs-* *.md",
Expand Down Expand Up @@ -97,26 +97,26 @@
"reselect": "^4.1.8",
"url": "^0.11.4",
"weaktuplemap": "^1.0.0",
"workbox-window": "^7.1.0"
"workbox-window": "^7.3.0"
},
"devDependencies": {
"@babel/cli": "^7.25.7",
"@babel/core": "^7.25.7",
"@babel/eslint-parser": "^7.25.7",
"@babel/eslint-plugin": "^7.25.7",
"@babel/cli": "^7.25.9",
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@babel/eslint-plugin": "^7.25.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.25.7",
"@babel/preset-flow": "^7.25.7",
"@babel/preset-react": "^7.25.7",
"@babel/preset-env": "^7.26.0",
"@babel/preset-flow": "^7.25.9",
"@babel/preset-react": "^7.25.9",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"alex": "^11.0.1",
"autoprefixer": "^10.4.20",
"babel-jest": "^29.7.0",
"babel-loader": "^9.2.1",
"babel-plugin-module-resolver": "^5.0.2",
"browserslist": "^4.24.0",
"browserslist": "^4.24.2",
"caniuse-lite": "^1.0.30001667",
"circular-dependency-plugin": "^5.2.1",
"codecov": "^3.8.3",
Expand All @@ -133,17 +133,17 @@
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-jest-dom": "^5.4.0",
"eslint-plugin-jest-formatting": "^3.1.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-testing-library": "^6.3.0",
"espree": "^10.2.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-testing-library": "^6.4.0",
"espree": "^10.3.0",
"fake-indexeddb": "^6.0.0",
"fetch-mock-jest": "^1.5.1",
"file-loader": "^6.2.0",
"flow-bin": "^0.96.0",
"flow-coverage-report": "^0.8.0",
"flow-typed": "^4.0.0",
"glob": "^10.4.5",
"html-webpack-plugin": "^5.6.0",
"html-webpack-plugin": "^5.6.3",
"husky": "^4.3.8",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -167,7 +167,7 @@
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0",
"workbox-webpack-plugin": "^7.1.0",
"workbox-webpack-plugin": "^7.3.0",
"yargs": "^17.7.2"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion res/img/svg/edit-name-profiler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions res/img/svg/extension-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions res/img/svg/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion res/img/svg/select-thread.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion res/img/svg/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 66 additions & 11 deletions src/actions/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// @flow
import type { Action, ThunkAction } from 'firefox-profiler/types';
import type {
Action,
ThunkAction,
IconWithClassName,
} from 'firefox-profiler/types';

export function iconHasLoaded(icon: string): Action {
export function iconHasLoaded(iconWithClassName: {|
+icon: string,
+className: string,
|}): Action {
return {
type: 'ICON_HAS_LOADED',
icon,
iconWithClassName,
};
}

Expand All @@ -20,25 +27,35 @@ export function iconIsInError(icon: string): Action {
}

const icons: Set<string> = new Set();
let iconCounter = 0;

type IconRequestResult = 'loaded' | 'error' | 'cached';
type IconRequestResult =
| {| type: 'error' | 'cached' |}
| {|
type: 'loaded',
iconWithClassName: IconWithClassName,
|};

function _getIcon(icon: string): Promise<IconRequestResult> {
async function _getIcon(icon: string): Promise<IconRequestResult> {
if (icons.has(icon)) {
return Promise.resolve('cached');
return Promise.resolve({ type: 'cached' });
}

icons.add(icon);

// New class name for an icon. They are guaranteed to be unique, that's why
// just increment the icon counter and return that string.
const className = `favicon-${++iconCounter}`;

const result = new Promise((resolve) => {
const image = new Image();
image.src = icon;
image.referrerPolicy = 'no-referrer';
image.onload = () => {
resolve('loaded');
resolve({ type: 'loaded', iconWithClassName: { icon, className } });
};
image.onerror = () => {
resolve('error');
resolve({ type: 'error' });
};
});

Expand All @@ -48,9 +65,9 @@ function _getIcon(icon: string): Promise<IconRequestResult> {
export function iconStartLoading(icon: string): ThunkAction<Promise<void>> {
return (dispatch) => {
return _getIcon(icon).then((result) => {
switch (result) {
switch (result.type) {
case 'loaded':
dispatch(iconHasLoaded(icon));
dispatch(iconHasLoaded(result.iconWithClassName));
break;
case 'error':
dispatch(iconIsInError(icon));
Expand All @@ -59,8 +76,46 @@ export function iconStartLoading(icon: string): ThunkAction<Promise<void>> {
// nothing to do
break;
default:
throw new Error(`Unknown icon load result ${result}`);
throw new Error(`Unknown icon load result ${result.type}`);
}
});
};
}

/**
* Batch load the data url icons.
*
* We don't need to check if they are valid images or not, so we can omit doing
* this extra work for these icons. Just add them directly to our cache and state.
*/
export function batchLoadDataUrlIcons(
iconsToAdd: Array<string | null>
): ThunkAction<void> {
return (dispatch) => {
const newIcons = [];
for (const icon of iconsToAdd) {
if (!icon || icons.has(icon)) {
continue;
}

icons.add(icon);

// New class name for an icon. They are guaranteed to be unique, that's why
// just increment the icon counter and return that string.
const className = `favicon-${++iconCounter}`;
newIcons.push({ icon, className });
}

dispatch({
type: 'ICON_BATCH_ADD',
icons: newIcons,
});
};
}

/**
* Only use it in tests!
*/
export function _resetIconCounter() {
iconCounter = 0;
}
Loading

0 comments on commit 07188f2

Please sign in to comment.