@@ -351,7 +351,7 @@ var emscriptenCpuProfiler = {
351351 document . getElementById ( 'trace_limit' ) . onkeydown = function ( e ) { if ( e . which == 13 || e . keycode == 13 ) emscriptenCpuProfiler . enableTraceWebGL ( ) ; else emscriptenCpuProfiler . disableTraceWebGL ( ) ; } ;
352352 cpuprofiler = document . getElementById ( 'cpuprofiler' ) ;
353353
354- if ( location . search . indexOf ( 'expandhelp' ) != - 1 ) this . toggleHelpTextVisible ( ) ;
354+ if ( location . search . includes ( 'expandhelp' ) ) this . toggleHelpTextVisible ( ) ;
355355 }
356356
357357 this . canvas = document . getElementById ( 'cpuprofiler_canvas' ) ;
@@ -470,9 +470,9 @@ var emscriptenCpuProfiler = {
470470
471471 // Also poll to autodetect if there is an Emscripten GL canvas available that we could hook into. This is a bit clumsy, but there's no good location to get an event after GL context has been created, so
472472 // need to resort to polling.
473- if ( location . search . indexOf ( 'webglprofiler' ) != - 1 && ! this . automaticallyHookedWebGLProfiler ) {
473+ if ( location . search . includes ( 'webglprofiler' ) && ! this . automaticallyHookedWebGLProfiler ) {
474474 this . hookWebGL ( ) ;
475- if ( location . search . indexOf ( 'tracegl' ) != - 1 ) {
475+ if ( location . search . includes ( 'tracegl' ) ) {
476476 var res = location . search . match ( / t r a c e g l = ( \d + ) / ) ;
477477 var traceGl = res [ 1 ] ;
478478 document . getElementById ( 'trace_limit' ) . value = traceGl ;
@@ -513,18 +513,18 @@ var emscriptenCpuProfiler = {
513513 var l9 = [ 'copyTexSubImage3D' ] ;
514514 var l10 = [ 'blitFramebuffer' , 'texImage3D' , 'compressedTexSubImage3D' ] ;
515515 var l11 = [ 'texSubImage3D' ] ;
516- if ( l0 . indexOf ( f ) != - 1 ) return 0 ;
517- if ( l1 . indexOf ( f ) != - 1 ) return 1 ;
518- if ( l2 . indexOf ( f ) != - 1 ) return 2 ;
519- if ( l3 . indexOf ( f ) != - 1 ) return 3 ;
520- if ( l4 . indexOf ( f ) != - 1 ) return 4 ;
521- if ( l5 . indexOf ( f ) != - 1 ) return 5 ;
522- if ( l6 . indexOf ( f ) != - 1 ) return 6 ;
523- if ( l7 . indexOf ( f ) != - 1 ) return 7 ;
524- if ( l8 . indexOf ( f ) != - 1 ) return 8 ;
525- if ( l9 . indexOf ( f ) != - 1 ) return 9 ;
526- if ( l10 . indexOf ( f ) != - 1 ) return 10 ;
527- if ( l11 . indexOf ( f ) != - 1 ) return 11 ;
516+ if ( l0 . includes ( f ) ) return 0 ;
517+ if ( l1 . includes ( f ) ) return 1 ;
518+ if ( l2 . includes ( f ) ) return 2 ;
519+ if ( l3 . includes ( f ) ) return 3 ;
520+ if ( l4 . includes ( f ) ) return 4 ;
521+ if ( l5 . includes ( f ) ) return 5 ;
522+ if ( l6 . includes ( f ) ) return 6 ;
523+ if ( l7 . includes ( f ) ) return 7 ;
524+ if ( l8 . includes ( f ) ) return 8 ;
525+ if ( l9 . includes ( f ) ) return 9 ;
526+ if ( l10 . includes ( f ) ) return 10 ;
527+ if ( l11 . includes ( f ) ) return 11 ;
528528 console . warn ( 'Unexpected WebGL function ' + f ) ;
529529 } ,
530530
@@ -537,7 +537,7 @@ var emscriptenCpuProfiler = {
537537
538538 toggleHookWebGL : function ( glCtx ) {
539539 if ( ! glCtx ) glCtx = this . detectWebGLContext ( ) ;
540- if ( this . hookedWebGLContexts . indexOf ( glCtx ) != - 1 ) this . unhookWebGL ( glCtx ) ;
540+ if ( this . hookedWebGLContexts . includes ( glCtx ) ) this . unhookWebGL ( glCtx ) ;
541541 else this . hookWebGL ( glCtx ) ;
542542 } ,
543543
@@ -567,7 +567,7 @@ var emscriptenCpuProfiler = {
567567 document . getElementById ( "toggle_webgl_profile" ) . style . background = '#E1E1E1' ;
568568
569569 for ( var f in glCtx ) {
570- if ( typeof glCtx [ f ] !== 'function' || f . indexOf ( 'real_' ) == 0 ) continue ;
570+ if ( typeof glCtx [ f ] !== 'function' || f . startsWith ( 'real_' ) ) continue ;
571571 var realf = 'real_' + f ;
572572 glCtx [ f ] = glCtx [ realf ] ;
573573 delete glCtx [ realf ] ;
@@ -576,7 +576,7 @@ var emscriptenCpuProfiler = {
576576
577577 hookWebGLFunction : function ( f , glCtx ) {
578578 var this_ = this ;
579- var section = ( this_ . hotGLFunctions . indexOf ( f ) != - 1 || f . indexOf ( 'uniform' ) == 0 || f . indexOf ( 'vertexAttrib' ) == 0 ) ? 0 : 1 ;
579+ var section = ( this_ . hotGLFunctions . incudes ( f ) || f . startsWith ( 'uniform' ) || f . startsWith ( 'vertexAttrib' ) ) ? 0 : 1 ;
580580 var realf = 'real_' + f ;
581581 glCtx [ realf ] = glCtx [ f ] ;
582582 var numArgs = this_ . webGLFunctionLength ( f ) ; // On Firefox & Chrome, could do "glCtx[realf].length", but that doesn't work on Edge, which always reports 0.
@@ -617,7 +617,7 @@ var emscriptenCpuProfiler = {
617617 this . createSection ( 0 , 'Hot GL' , this . colorHotGLFunction , /*traceable=*/ true ) ;
618618 this . createSection ( 1 , 'Cold GL' , this . colorColdGLFunction , /*traceable=*/ true ) ;
619619 for ( var f in glCtx ) {
620- if ( typeof glCtx [ f ] !== 'function' || f . indexOf ( 'real_' ) == 0 ) continue ;
620+ if ( typeof glCtx [ f ] !== 'function' || f . startsWith ( 'real_' ) ) continue ;
621621 this . hookWebGLFunction ( f , glCtx ) ;
622622 }
623623 var this_ = this ;
0 commit comments