mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Update debugger-frontend from e1dd7af...6e249b3 (#54526)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54526 Changelog: [Internal] - Update `react-native/debugger-frontend` from e1dd7af...6e249b3 Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebook/react-native-devtools-frontend/compare/e1dd7af9019d54f5a7b89d2ca09c2e63da02e76c...6e249b361c744f1e1774e0f83091d5f1ee921670). ### Changelog | Commit | Author | Date/Time | Subject | | ------ | ------ | --------- | ------- | | [6e249b361](https://github.com/facebook/react-native-devtools-frontend/commit/6e249b361) | sbuggay (sbuggay@gmail.com) | 2025-11-12T18:55:40-08:00 | [Add experiment for enabling frames and screenshots (#212)](https://github.com/facebook/react-native-devtools-frontend/commit/6e249b361) | Reviewed By: hoxyq Differential Revision: D86935909 fbshipit-source-id: cd956224a645643908e84e9a1c10fa979e4b2d12
This commit is contained in:
1 parent
f8e8c4e203
commit
ec4a0606f7
4 files changed
+5
-5
No files matched your search
@@ -1,5 +1,5 @@
|
||||
@generated SignedSource<<e06b1f2e62286749dc811af700de2391>>
|
||||
Git revision: e1dd7af9019d54f5a7b89d2ca09c2e63da02e76c
|
||||
@generated SignedSource<<99075505013dc57bbff93badedc77a0f>>
|
||||
Git revision: 6e249b361c744f1e1774e0f83091d5f1ee921670
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/facebook/react-native-devtools-frontend
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import*as e from"../root/root.js";const t=e.Runtime.RNExperimentName,i={didInitializeExperiments:!1,isReactNativeEntryPoint:!1};class n{name;title;unstable;docLink;feedbackLink;enabledByDefault;constructor(e){this.name=e.name,this.title=e.title,this.unstable=e.unstable,this.docLink=e.docLink,this.feedbackLink=e.feedbackLink,this.enabledByDefault=function(e,t){if(null==e)return()=>t;if("boolean"==typeof e)return()=>e;return e}(e.enabledByDefault,!1)}}const r=new class{#e=new Map;#t=new Set;register(e){if(i.didInitializeExperiments)throw new Error("Experiments must be registered before constructing MainImpl");const{name:t}=e;if(this.#e.has(t))throw new Error(`React Native Experiment ${t} is already registered`);this.#e.set(t,new n(e))}enableExperimentsByDefault(e){if(i.didInitializeExperiments)throw new Error("Experiments must be configured before constructing MainImpl");for(const i of e)if(Object.prototype.hasOwnProperty.call(t,i)){const e=this.#e.get(i);if(!e)throw new Error(`React Native Experiment ${i} is not registered`);e.enabledByDefault=()=>!0}else this.#t.add(i)}copyInto(e,t=""){for(const[n,r]of this.#e)e.register(n,t+r.title,r.unstable,r.docLink,r.feedbackLink),r.enabledByDefault({isReactNativeEntryPoint:i.isReactNativeEntryPoint})&&e.enableExperimentsByDefault([n]);for(const t of this.#t)e.enableExperimentsByDefault([t]);i.didInitializeExperiments=!0}};r.register({name:t.JS_HEAP_PROFILER_ENABLE,title:"Enable Heap Profiler (Memory Panel)",unstable:!1,enabledByDefault:({isReactNativeEntryPoint:e})=>!e}),r.register({name:t.REACT_NATIVE_SPECIFIC_UI,title:"Show React Native-specific UI",unstable:!1,enabledByDefault:({isReactNativeEntryPoint:e})=>e});var a=Object.freeze({__proto__:null,Instance:r,RNExperimentName:t,setIsReactNativeEntryPoint:function(e){if(i.didInitializeExperiments)throw new Error("setIsReactNativeEntryPoint must be called before constructing MainImpl");i.isReactNativeEntryPoint=e}});export{a as RNExperimentsImpl};
|
||||
import*as e from"../root/root.js";const t=e.Runtime.RNExperimentName,i={didInitializeExperiments:!1,isReactNativeEntryPoint:!1};class n{name;title;unstable;docLink;feedbackLink;enabledByDefault;constructor(e){this.name=e.name,this.title=e.title,this.unstable=e.unstable,this.docLink=e.docLink,this.feedbackLink=e.feedbackLink,this.enabledByDefault=function(e,t){if(null==e)return()=>t;if("boolean"==typeof e)return()=>e;return e}(e.enabledByDefault,!1)}}const r=new class{#e=new Map;#t=new Set;register(e){if(i.didInitializeExperiments)throw new Error("Experiments must be registered before constructing MainImpl");const{name:t}=e;if(this.#e.has(t))throw new Error(`React Native Experiment ${t} is already registered`);this.#e.set(t,new n(e))}enableExperimentsByDefault(e){if(i.didInitializeExperiments)throw new Error("Experiments must be configured before constructing MainImpl");for(const i of e)if(Object.prototype.hasOwnProperty.call(t,i)){const e=this.#e.get(i);if(!e)throw new Error(`React Native Experiment ${i} is not registered`);e.enabledByDefault=()=>!0}else this.#t.add(i)}copyInto(e,t=""){for(const[n,r]of this.#e)e.register(n,t+r.title,r.unstable,r.docLink,r.feedbackLink),r.enabledByDefault({isReactNativeEntryPoint:i.isReactNativeEntryPoint})&&e.enableExperimentsByDefault([n]);for(const t of this.#t)e.enableExperimentsByDefault([t]);i.didInitializeExperiments=!0}};r.register({name:t.JS_HEAP_PROFILER_ENABLE,title:"Enable Heap Profiler (Memory Panel)",unstable:!1,enabledByDefault:({isReactNativeEntryPoint:e})=>!e}),r.register({name:t.REACT_NATIVE_SPECIFIC_UI,title:"Show React Native-specific UI",unstable:!1,enabledByDefault:({isReactNativeEntryPoint:e})=>e}),r.register({name:t.ENABLE_TIMELINE_FRAMES,title:"Enable performance frames track",unstable:!0,enabledByDefault:()=>globalThis.enableTimelineFrames??!1});var a=Object.freeze({__proto__:null,Instance:r,RNExperimentName:t,setIsReactNativeEntryPoint:function(e){if(i.didInitializeExperiments)throw new Error("setIsReactNativeEntryPoint must be called before constructing MainImpl");i.isReactNativeEntryPoint=e}});export{a as RNExperimentsImpl};
|
||||
@@ -1 +1 @@
|
||||
import*as e from"../platform/platform.js";const t=new URLSearchParams(location.search);let n,r,s="";function i(){return window.location.pathname}function a(e){return["node_app","js_app"].some((t=>e.includes(t)))}class o{constructor(){}static instance(e={forceNew:null}){const{forceNew:t}=e;return n&&!t||(n=new o),n}static removeInstance(){n=void 0}static queryParam(e){return t.get(e)}static setQueryParamForTesting(e,n){t.set(e,n)}static isNode(){return void 0===r&&(r=a(i())),r}static setPlatform(e){s=e}static platform(){return s}static isDescriptorEnabled(e){const{experiment:t}=e;if("*"===t)return!0;if(t&&t.startsWith("!")&&h.isEnabled(t.substring(1)))return!1;if(t&&!t.startsWith("!")&&!h.isEnabled(t))return!1;const{condition:n}=e;return!n||n(f)}loadLegacyModule(e){console.log("Loading legacy module: "+e);return import(`../../${e}`).then((t=>(console.log("Loaded legacy module: "+e),t)))}}class l{#e=[];#t=new Set;#n=new Set;#r=new Set;#s=new Set;#i=new c;allConfigurableExperiments(){const e=[];for(const t of this.#e)this.#n.has(t.name)||e.push(t);return e}register(t,n,r,s,i){if(this.#t.has(t))throw new Error(`Duplicate registration of experiment '${t}'`);this.#t.add(t),this.#e.push(new m(this,t,n,Boolean(r),s??e.DevToolsPath.EmptyUrlString,i??e.DevToolsPath.EmptyUrlString))}isEnabled(e){return this.checkExperiment(e),!1!==this.#i.get(e)&&(!(!this.#n.has(e)&&!this.#r.has(e))||(!!this.#s.has(e)||Boolean(this.#i.get(e))))}setEnabled(e,t){this.checkExperiment(e),this.#i.set(e,t)}enableExperimentsTransiently(e){for(const t of e)this.checkExperiment(t),this.#n.add(t)}enableExperimentsByDefault(e){for(const t of e)this.checkExperiment(t),this.#r.add(t)}setServerEnabledExperiments(e){for(const t of e)this.checkExperiment(t),this.#s.add(t)}enableForTest(e){this.checkExperiment(e),this.#n.add(e)}disableForTest(e){this.checkExperiment(e),this.#n.delete(e)}clearForTest(){this.#e=[],this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear()}cleanUpStaleExperiments(){this.#i.cleanUpStaleExperiments(this.#t)}checkExperiment(e){if(!this.#t.has(e))throw new Error(`Unknown experiment '${e}'`)}}class c{#e={};constructor(){try{const e=self.localStorage?.getItem("experiments");e&&(this.#e=JSON.parse(e))}catch{console.error("Failed to parse localStorage['experiments']")}}get(e){return this.#e[e]}set(e,t){this.#e[e]=t,this.#a()}cleanUpStaleExperiments(e){for(const[t]of Object.entries(this.#e))e.has(t)||delete this.#e[t];this.#a()}#a(){self.localStorage?.setItem("experiments",JSON.stringify(this.#e))}}class m{name;title;unstable;docLink;feedbackLink;#e;constructor(e,t,n,r,s,i){this.name=t,this.title=n,this.unstable=r,this.docLink=s,this.feedbackLink=i,this.#e=e}isEnabled(){return this.#e.isEnabled(this.name)}setEnabled(e){this.#e.setEnabled(this.name,e)}}const h=new l;var p,E,d,u;!function(e){e.REACT_NATIVE_SPECIFIC_UI="react-native-specific-ui",e.JS_HEAP_PROFILER_ENABLE="js-heap-profiler-enable"}(p||(p={})),function(e){e.NOT_SOURCES_HIDE_ADD_FOLDER="!sources.hide_add_folder",e.REACT_NATIVE_UNSTABLE_NETWORK_PANEL="unstable_enableNetworkPanel"}(E||(E={})),function(e){e[e.ALLOW=0]="ALLOW",e[e.ALLOW_WITHOUT_LOGGING=1]="ALLOW_WITHOUT_LOGGING",e[e.DISABLE=2]="DISABLE"}(d||(d={})),function(e){e.ALL_SCRIPTS="ALL_SCRIPTS",e.SIDE_EFFECT_FREE_SCRIPTS_ONLY="SIDE_EFFECT_FREE_SCRIPTS_ONLY",e.NO_SCRIPTS="NO_SCRIPTS"}(u||(u={}));const f=Object.create(null),x={canDock:()=>Boolean(o.queryParam("can_dock")),notSourcesHideAddFolder:()=>Boolean(o.queryParam(E.NOT_SOURCES_HIDE_ADD_FOLDER)),reactNativeExpoNetworkPanel:()=>Boolean(o.queryParam(E.REACT_NATIVE_UNSTABLE_NETWORK_PANEL))};var _=Object.freeze({__proto__:null,get ConditionName(){return E},Experiment:m,ExperimentsSupport:l,get GenAiEnterprisePolicyValue(){return d},get HostConfigFreestylerExecutionMode(){return u},get RNExperimentName(){return p},Runtime:o,conditions:x,experiments:h,getChromeVersion:()=>{const e=navigator.userAgent.match(/(?:^|\W)(?:Chrome|HeadlessChrome)\/(\S+)/);return e&&e.length>1?e[1]:""},getPathName:i,getRemoteBase:function(e=self.location.toString()){const t=new URL(e).searchParams.get("remoteBase");if(!t)return null;const n=/\/serve_file\/(@[0-9a-zA-Z]+)\/?$/.exec(t);return n?{base:`devtools://devtools/remote/serve_file/${n[1]}/`,version:n[1]}:null},hostConfig:f,isNodeEntry:a});export{_ as Runtime};
|
||||
import*as e from"../platform/platform.js";const t=new URLSearchParams(location.search);let n,r,s="";function i(){return window.location.pathname}function a(e){return["node_app","js_app"].some((t=>e.includes(t)))}class o{constructor(){}static instance(e={forceNew:null}){const{forceNew:t}=e;return n&&!t||(n=new o),n}static removeInstance(){n=void 0}static queryParam(e){return t.get(e)}static setQueryParamForTesting(e,n){t.set(e,n)}static isNode(){return void 0===r&&(r=a(i())),r}static setPlatform(e){s=e}static platform(){return s}static isDescriptorEnabled(e){const{experiment:t}=e;if("*"===t)return!0;if(t&&t.startsWith("!")&&h.isEnabled(t.substring(1)))return!1;if(t&&!t.startsWith("!")&&!h.isEnabled(t))return!1;const{condition:n}=e;return!n||n(f)}loadLegacyModule(e){console.log("Loading legacy module: "+e);return import(`../../${e}`).then((t=>(console.log("Loaded legacy module: "+e),t)))}}class l{#e=[];#t=new Set;#n=new Set;#r=new Set;#s=new Set;#i=new c;allConfigurableExperiments(){const e=[];for(const t of this.#e)this.#n.has(t.name)||e.push(t);return e}register(t,n,r,s,i){if(this.#t.has(t))throw new Error(`Duplicate registration of experiment '${t}'`);this.#t.add(t),this.#e.push(new m(this,t,n,Boolean(r),s??e.DevToolsPath.EmptyUrlString,i??e.DevToolsPath.EmptyUrlString))}isEnabled(e){return this.checkExperiment(e),!1!==this.#i.get(e)&&(!(!this.#n.has(e)&&!this.#r.has(e))||(!!this.#s.has(e)||Boolean(this.#i.get(e))))}setEnabled(e,t){this.checkExperiment(e),this.#i.set(e,t)}enableExperimentsTransiently(e){for(const t of e)this.checkExperiment(t),this.#n.add(t)}enableExperimentsByDefault(e){for(const t of e)this.checkExperiment(t),this.#r.add(t)}setServerEnabledExperiments(e){for(const t of e)this.checkExperiment(t),this.#s.add(t)}enableForTest(e){this.checkExperiment(e),this.#n.add(e)}disableForTest(e){this.checkExperiment(e),this.#n.delete(e)}clearForTest(){this.#e=[],this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear()}cleanUpStaleExperiments(){this.#i.cleanUpStaleExperiments(this.#t)}checkExperiment(e){if(!this.#t.has(e))throw new Error(`Unknown experiment '${e}'`)}}class c{#e={};constructor(){try{const e=self.localStorage?.getItem("experiments");e&&(this.#e=JSON.parse(e))}catch{console.error("Failed to parse localStorage['experiments']")}}get(e){return this.#e[e]}set(e,t){this.#e[e]=t,this.#a()}cleanUpStaleExperiments(e){for(const[t]of Object.entries(this.#e))e.has(t)||delete this.#e[t];this.#a()}#a(){self.localStorage?.setItem("experiments",JSON.stringify(this.#e))}}class m{name;title;unstable;docLink;feedbackLink;#e;constructor(e,t,n,r,s,i){this.name=t,this.title=n,this.unstable=r,this.docLink=s,this.feedbackLink=i,this.#e=e}isEnabled(){return this.#e.isEnabled(this.name)}setEnabled(e){this.#e.setEnabled(this.name,e)}}const h=new l;var E,p,d,u;!function(e){e.REACT_NATIVE_SPECIFIC_UI="react-native-specific-ui",e.JS_HEAP_PROFILER_ENABLE="js-heap-profiler-enable",e.ENABLE_TIMELINE_FRAMES="enable-timeline-frames"}(E||(E={})),function(e){e.NOT_SOURCES_HIDE_ADD_FOLDER="!sources.hide_add_folder",e.REACT_NATIVE_UNSTABLE_NETWORK_PANEL="unstable_enableNetworkPanel"}(p||(p={})),function(e){e[e.ALLOW=0]="ALLOW",e[e.ALLOW_WITHOUT_LOGGING=1]="ALLOW_WITHOUT_LOGGING",e[e.DISABLE=2]="DISABLE"}(d||(d={})),function(e){e.ALL_SCRIPTS="ALL_SCRIPTS",e.SIDE_EFFECT_FREE_SCRIPTS_ONLY="SIDE_EFFECT_FREE_SCRIPTS_ONLY",e.NO_SCRIPTS="NO_SCRIPTS"}(u||(u={}));const f=Object.create(null),_={canDock:()=>Boolean(o.queryParam("can_dock")),notSourcesHideAddFolder:()=>Boolean(o.queryParam(p.NOT_SOURCES_HIDE_ADD_FOLDER)),reactNativeExpoNetworkPanel:()=>Boolean(o.queryParam(p.REACT_NATIVE_UNSTABLE_NETWORK_PANEL))};var x=Object.freeze({__proto__:null,get ConditionName(){return p},Experiment:m,ExperimentsSupport:l,get GenAiEnterprisePolicyValue(){return d},get HostConfigFreestylerExecutionMode(){return u},get RNExperimentName(){return E},Runtime:o,conditions:_,experiments:h,getChromeVersion:()=>{const e=navigator.userAgent.match(/(?:^|\W)(?:Chrome|HeadlessChrome)\/(\S+)/);return e&&e.length>1?e[1]:""},getPathName:i,getRemoteBase:function(e=self.location.toString()){const t=new URL(e).searchParams.get("remoteBase");if(!t)return null;const n=/\/serve_file\/(@[0-9a-zA-Z]+)\/?$/.exec(t);return n?{base:`devtools://devtools/remote/serve_file/${n[1]}/`,version:n[1]}:null},hostConfig:f,isNodeEntry:a});export{x as Runtime};
|
||||
+1
-1
@@ -40,4 +40,4 @@ import*as e from"../../core/i18n/i18n.js";import*as t from"../../models/trace/tr
|
||||
</td>
|
||||
</tr>`}))}
|
||||
</table>
|
||||
</devtools-data-grid>`,i,{host:this})}){super(),this.registerRequiredCSS($n),this.#bi=t,this.element.setAttribute("jslog",`${v.pane("selector-stats").track({resize:!0})}`),this.#Si=new Map,this.#t=e,this.performUpdate()}#Ci(e){const{menu:t}=e.detail;t.defaultSection().appendItem(Yn(Kn.copyTable),(()=>{const e=[],t=[Yn(Kn.elapsed),Yn(Kn.matchAttempts),Yn(Kn.matchCount),Yn(Kn.rejectPercentage),Yn(Kn.selector),Yn(Kn.styleSheetId)];e.push(t.join("\t"));for(const t of this.#Ei){const i=t[Jn.MatchAttempts]-t[Jn.MatchCount],n=100*(i?t[Jn.FastRejectCount]/i:1),r=t[Jn.StyleSheetId];let a="";const s=o.TargetManager.TargetManager.instance().primaryPageTarget(),l=s?.model(o.CSSModel.CSSModel);if(l){const e=l.styleSheetHeaderForId(r);e&&(a=e.resourceURL().toString())}a||(a=Yn(Kn.unableToLink)),e.push([t[Jn.Elapsed]/1e3,t[Jn.MatchAttempts],t[Jn.MatchCount],n,t[Jn.Selector],a].join("\t"))}const i=e.join("\n");navigator.clipboard.writeText(i),m.ARIAUtils.alert(Yn(Kn.tableCopiedToClipboard))}))}performUpdate(){const e={timings:this.#Ei,onContextMenu:e=>{this.#Ci(e)}};this.#bi(e,{},this.contentElement)}setEvent(e){if(!this.#t)return!1;if(this.#wi===e)return!1;this.#wi=e;const t=this.#t.SelectorStats.dataForUpdateLayoutEvent.get(e);return t?(this.processSelectorTimings(t.timings).then((e=>{this.#Ei=e,this.requestUpdate()})),!0):(this.#Ei=[],this.requestUpdate(),!1)}setAggregatedEvents(e){const t=[],i=new Map;if(!this.#t)return;const n={[Jn.Elapsed]:0,[Jn.MatchAttempts]:0,[Jn.MatchCount]:0,[Jn.FastRejectCount]:0};if(!Array.isArray(this.#wi)||this.#wi.length!==e.length||!e.every(((e,t)=>e===this.#wi[t]))){this.#wi=e;for(let t=0;t<e.length;t++){const r=e[t],a=r?this.#t.SelectorStats.dataForUpdateLayoutEvent.get(r):void 0;if(a){const e=a.timings;for(const t of e){const e=t[Jn.Selector]+"_"+t[Jn.StyleSheetId],r=i.get(e);void 0!==r?(r[Jn.Elapsed]+=t[Jn.Elapsed],r[Jn.FastRejectCount]+=t[Jn.FastRejectCount],r[Jn.MatchAttempts]+=t[Jn.MatchAttempts],r[Jn.MatchCount]+=t[Jn.MatchCount]):i.set(e,structuredClone(t)),n[Jn.Elapsed]+=t[Jn.Elapsed],n[Jn.MatchAttempts]+=t[Jn.MatchAttempts],n[Jn.MatchCount]+=t[Jn.MatchCount],n[Jn.FastRejectCount]+=t[Jn.FastRejectCount]}}}if(!(i.size>0))return this.#Ei=[],void this.requestUpdate();i.forEach((e=>{t.push(e)})),i.clear(),t.unshift({[Jn.Elapsed]:n[Jn.Elapsed],[Jn.FastRejectCount]:n[Jn.FastRejectCount],[Jn.MatchAttempts]:n[Jn.MatchAttempts],[Jn.MatchCount]:n[Jn.MatchCount],[Jn.Selector]:Yn(Kn.totalForAllSelectors),[Jn.StyleSheetId]:"n/a"}),this.processSelectorTimings(t).then((e=>{this.#Ei=e,this.requestUpdate()}))}}async processSelectorTimings(e){const t=o.TargetManager.TargetManager.instance().primaryPageTarget(),i=t?.model(o.CSSModel.CSSModel);return i?await Promise.all(e.sort(((e,t)=>t[Jn.Elapsed]-e[Jn.Elapsed])).map((async e=>{const t=e[Jn.StyleSheetId],n=e[Jn.Selector].trim(),r="n/a"===t?null:await async function(e,t,i,n){if(!e)return;const r=e.styleSheetHeaderForId(t);if(!r||!r.resourceURL())return;const a=JSON.stringify({selectorText:i,styleSheetId:t});let s=n.get(a);if(!s){const r=await e.agent.invoke_getLocationForSelector({styleSheetId:t,selectorText:i});if(r.getError()||!r.ranges)return;s=r.ranges,n.set(a,s)}return s.map((e=>({url:r.resourceURL(),lineNumber:e.startLine,columnNumber:e.startColumn,linkText:Yn(Kn.lineNumber,{PH1:e.startLine+1,PH2:e.startColumn+1}),title:`${r.id} line ${e.startLine+1}:${e.startColumn+1}`})))}(i,t,n,this.#Si);return{...e,locations:r}}))):[]}}const Zn={summary:"Summary",bottomup:"Bottom-up",callTree:"Call tree",eventLog:"Event log",paintProfiler:"Paint profiler",layers:"Layers",selectorStats:"Selector stats"},Qn=e.i18n.registerUIStrings("panels/timeline/TimelineDetailsView.ts",Zn),er=e.i18n.getLocalizedString.bind(void 0,Qn);class tr extends(l.ObjectWrapper.eventMixin(m.Widget.VBox)){detailsLinkifier;tabbedPane;defaultDetailsWidget;defaultDetailsContentWidget;rangeDetailViews;#le;lazyPaintProfilerView;lazyLayersView;preferredTabId;selection;updateContentsScheduled;lazySelectorStatsView;#t=null;#ki=null;#Ii=null;#Ae=null;#Mi;#xi;#te=this.#ie.bind(this);#Pi=new c.RelatedInsightChips.RelatedInsightChips;#Ri=new _t;#de=null;constructor(e){super(),this.element.classList.add("timeline-details"),this.detailsLinkifier=new S.Linkifier.Linkifier,this.tabbedPane=new m.TabbedPane.TabbedPane,this.tabbedPane.show(this.element),this.tabbedPane.headerElement().setAttribute("jslog",`${v.toolbar("sidebar").track({keydown:"ArrowUp|ArrowLeft|ArrowDown|ArrowRight|Enter|Space"})}`),this.defaultDetailsWidget=new m.Widget.VBox,this.defaultDetailsWidget.element.classList.add("timeline-details-view"),this.defaultDetailsWidget.element.setAttribute("jslog",`${v.pane("details").track({resize:!0})}`),this.defaultDetailsContentWidget=this.#Fi(),this.appendTab(ir.Details,er(Zn.summary),this.defaultDetailsWidget),this.setPreferredTab(ir.Details),this.rangeDetailViews=new Map,this.updateContentsScheduled=!1;const t=new Nt;this.appendTab(ir.BottomUp,er(Zn.bottomup),t),this.rangeDetailViews.Line truncated
|
||||
</devtools-data-grid>`,i,{host:this})}){super(),this.registerRequiredCSS($n),this.#bi=t,this.element.setAttribute("jslog",`${v.pane("selector-stats").track({resize:!0})}`),this.#Si=new Map,this.#t=e,this.performUpdate()}#Ci(e){const{menu:t}=e.detail;t.defaultSection().appendItem(Yn(Kn.copyTable),(()=>{const e=[],t=[Yn(Kn.elapsed),Yn(Kn.matchAttempts),Yn(Kn.matchCount),Yn(Kn.rejectPercentage),Yn(Kn.selector),Yn(Kn.styleSheetId)];e.push(t.join("\t"));for(const t of this.#Ei){const i=t[Jn.MatchAttempts]-t[Jn.MatchCount],n=100*(i?t[Jn.FastRejectCount]/i:1),r=t[Jn.StyleSheetId];let a="";const s=o.TargetManager.TargetManager.instance().primaryPageTarget(),l=s?.model(o.CSSModel.CSSModel);if(l){const e=l.styleSheetHeaderForId(r);e&&(a=e.resourceURL().toString())}a||(a=Yn(Kn.unableToLink)),e.push([t[Jn.Elapsed]/1e3,t[Jn.MatchAttempts],t[Jn.MatchCount],n,t[Jn.Selector],a].join("\t"))}const i=e.join("\n");navigator.clipboard.writeText(i),m.ARIAUtils.alert(Yn(Kn.tableCopiedToClipboard))}))}performUpdate(){const e={timings:this.#Ei,onContextMenu:e=>{this.#Ci(e)}};this.#bi(e,{},this.contentElement)}setEvent(e){if(!this.#t)return!1;if(this.#wi===e)return!1;this.#wi=e;const t=this.#t.SelectorStats.dataForUpdateLayoutEvent.get(e);return t?(this.processSelectorTimings(t.timings).then((e=>{this.#Ei=e,this.requestUpdate()})),!0):(this.#Ei=[],this.requestUpdate(),!1)}setAggregatedEvents(e){const t=[],i=new Map;if(!this.#t)return;const n={[Jn.Elapsed]:0,[Jn.MatchAttempts]:0,[Jn.MatchCount]:0,[Jn.FastRejectCount]:0};if(!Array.isArray(this.#wi)||this.#wi.length!==e.length||!e.every(((e,t)=>e===this.#wi[t]))){this.#wi=e;for(let t=0;t<e.length;t++){const r=e[t],a=r?this.#t.SelectorStats.dataForUpdateLayoutEvent.get(r):void 0;if(a){const e=a.timings;for(const t of e){const e=t[Jn.Selector]+"_"+t[Jn.StyleSheetId],r=i.get(e);void 0!==r?(r[Jn.Elapsed]+=t[Jn.Elapsed],r[Jn.FastRejectCount]+=t[Jn.FastRejectCount],r[Jn.MatchAttempts]+=t[Jn.MatchAttempts],r[Jn.MatchCount]+=t[Jn.MatchCount]):i.set(e,structuredClone(t)),n[Jn.Elapsed]+=t[Jn.Elapsed],n[Jn.MatchAttempts]+=t[Jn.MatchAttempts],n[Jn.MatchCount]+=t[Jn.MatchCount],n[Jn.FastRejectCount]+=t[Jn.FastRejectCount]}}}if(!(i.size>0))return this.#Ei=[],void this.requestUpdate();i.forEach((e=>{t.push(e)})),i.clear(),t.unshift({[Jn.Elapsed]:n[Jn.Elapsed],[Jn.FastRejectCount]:n[Jn.FastRejectCount],[Jn.MatchAttempts]:n[Jn.MatchAttempts],[Jn.MatchCount]:n[Jn.MatchCount],[Jn.Selector]:Yn(Kn.totalForAllSelectors),[Jn.StyleSheetId]:"n/a"}),this.processSelectorTimings(t).then((e=>{this.#Ei=e,this.requestUpdate()}))}}async processSelectorTimings(e){const t=o.TargetManager.TargetManager.instance().primaryPageTarget(),i=t?.model(o.CSSModel.CSSModel);return i?await Promise.all(e.sort(((e,t)=>t[Jn.Elapsed]-e[Jn.Elapsed])).map((async e=>{const t=e[Jn.StyleSheetId],n=e[Jn.Selector].trim(),r="n/a"===t?null:await async function(e,t,i,n){if(!e)return;const r=e.styleSheetHeaderForId(t);if(!r||!r.resourceURL())return;const a=JSON.stringify({selectorText:i,styleSheetId:t});let s=n.get(a);if(!s){const r=await e.agent.invoke_getLocationForSelector({styleSheetId:t,selectorText:i});if(r.getError()||!r.ranges)return;s=r.ranges,n.set(a,s)}return s.map((e=>({url:r.resourceURL(),lineNumber:e.startLine,columnNumber:e.startColumn,linkText:Yn(Kn.lineNumber,{PH1:e.startLine+1,PH2:e.startColumn+1}),title:`${r.id} line ${e.startLine+1}:${e.startColumn+1}`})))}(i,t,n,this.#Si);return{...e,locations:r}}))):[]}}const Zn={summary:"Summary",bottomup:"Bottom-up",callTree:"Call tree",eventLog:"Event log",paintProfiler:"Paint profiler",layers:"Layers",selectorStats:"Selector stats"},Qn=e.i18n.registerUIStrings("panels/timeline/TimelineDetailsView.ts",Zn),er=e.i18n.getLocalizedString.bind(void 0,Qn);class tr extends(l.ObjectWrapper.eventMixin(m.Widget.VBox)){detailsLinkifier;tabbedPane;defaultDetailsWidget;defaultDetailsContentWidget;rangeDetailViews;#le;lazyPaintProfilerView;lazyLayersView;preferredTabId;selection;updateContentsScheduled;lazySelectorStatsView;#t=null;#ki=null;#Ii=null;#Ae=null;#Mi;#xi;#te=this.#ie.bind(this);#Pi=new c.RelatedInsightChips.RelatedInsightChips;#Ri=new _t;#de=null;constructor(e){super(),this.element.classList.add("timeline-details"),this.detailsLinkifier=new S.Linkifier.Linkifier,this.tabbedPane=new m.TabbedPane.TabbedPane,this.tabbedPane.show(this.element),this.tabbedPane.headerElement().setAttribute("jslog",`${v.toolbar("sidebar").track({keydown:"ArrowUp|ArrowLeft|ArrowDown|ArrowRight|Enter|Space"})}`),this.defaultDetailsWidget=new m.Widget.VBox,this.defaultDetailsWidget.element.classList.add("timeline-details-view"),this.defaultDetailsWidget.element.setAttribute("jslog",`${v.pane("details").track({resize:!0})}`),this.defaultDetailsContentWidget=this.#Fi(),this.appendTab(ir.Details,er(Zn.summary),this.defaultDetailsWidget),this.setPreferredTab(ir.Details),this.rangeDetailViews=new Map,this.updateContentsScheduled=!1;const t=new Nt;this.appendTab(ir.BottomUp,er(Zn.bottomup),t),this.rangeDetailViews.Line truncated
|
||||
Reference in new issue
Block a user