@samitouri / QOS-React-2 / commits / 6dda816102

Remove emoji prefix from Firefox extension tab labels

Firefox adds these already for React, so the extra emoji character was confusing. For now, we still prepend it for Chrome

Brian Vaughn committed Aug 21, 2019 at 14:23 UTC 6dda81610276b50dcd626e5a9090fe596c8f595c
1 file changed +49 -37
shells/browser/shared/src/main.js
+49 -37
@@ -21,6 +21,8 @@ import DevTools from 'src/devtools/views/DevTools';
21 const LOCAL_STORAGE_SUPPORTS_PROFILING_KEY =
22 'React::DevTools::supportsProfiling';
23
24 +const isChrome = getBrowserName() === 'Chrome';
25 +
26 let panelCreated = false;
27
28 // The renderer interface can't read saved component filters directly,
@@ -123,7 +125,7 @@ function createPanelIfReactLoaded() {
125
126 store = new Store(bridge, {
127 isProfiling,
126 - supportsReloadAndProfile: getBrowserName() === 'Chrome',
128 + supportsReloadAndProfile: isChrome,
129 supportsProfiling,
130 });
131 store.profilerStore.profilingData = profilingData;
@@ -226,47 +228,57 @@ function createPanelIfReactLoaded() {
228 let currentPanel = null;
229 let needsToSyncElementSelection = false;
230
229 - chrome.devtools.panels.create('⚛ Components', '', 'panel.html', panel => {
230 - panel.onShown.addListener(panel => {
231 - if (needsToSyncElementSelection) {
232 - needsToSyncElementSelection = false;
233 - bridge.send('syncSelectionFromNativeElementsPanel');
234 - }
231 + chrome.devtools.panels.create(
232 + isChrome ? '⚛ Components' : 'Components',
233 + '',
234 + 'panel.html',
235 + panel => {
236 + panel.onShown.addListener(panel => {
237 + if (needsToSyncElementSelection) {
238 + needsToSyncElementSelection = false;
239 + bridge.send('syncSelectionFromNativeElementsPanel');
240 + }
241
236 - if (currentPanel === panel) {
237 - return;
238 - }
242 + if (currentPanel === panel) {
243 + return;
244 + }
245
240 - currentPanel = panel;
241 - componentsPortalContainer = panel.container;
246 + currentPanel = panel;
247 + componentsPortalContainer = panel.container;
248
243 - if (componentsPortalContainer != null) {
244 - ensureInitialHTMLIsCleared(componentsPortalContainer);
245 - render('components');
246 - panel.injectStyles(cloneStyleTags);
247 - }
248 - });
249 - panel.onHidden.addListener(() => {
250 - // TODO: Stop highlighting and stuff.
251 - });
252 - });
253 -
254 - chrome.devtools.panels.create('⚛ Profiler', '', 'panel.html', panel => {
255 - panel.onShown.addListener(panel => {
256 - if (currentPanel === panel) {
257 - return;
258 - }
249 + if (componentsPortalContainer != null) {
250 + ensureInitialHTMLIsCleared(componentsPortalContainer);
251 + render('components');
252 + panel.injectStyles(cloneStyleTags);
253 + }
254 + });
255 + panel.onHidden.addListener(() => {
256 + // TODO: Stop highlighting and stuff.
257 + });
258 + }
259 + );
260 +
261 + chrome.devtools.panels.create(
262 + isChrome ? '⚛ Profiler' : 'Profiler',
263 + '',
264 + 'panel.html',
265 + panel => {
266 + panel.onShown.addListener(panel => {
267 + if (currentPanel === panel) {
268 + return;
269 + }
270
260 - currentPanel = panel;
261 - profilerPortalContainer = panel.container;
271 + currentPanel = panel;
272 + profilerPortalContainer = panel.container;
273
263 - if (profilerPortalContainer != null) {
264 - ensureInitialHTMLIsCleared(profilerPortalContainer);
265 - render('profiler');
266 - panel.injectStyles(cloneStyleTags);
267 - }
268 - });
269 - });
274 + if (profilerPortalContainer != null) {
275 + ensureInitialHTMLIsCleared(profilerPortalContainer);
276 + render('profiler');
277 + panel.injectStyles(cloneStyleTags);
278 + }
279 + });
280 + }
281 + );
282
283 chrome.devtools.network.onNavigated.removeListener(checkPageForReact);
284