phetsims / joist

Joist is the main framework for PhET Interactive Simulations. Joist creates and displays the simulation content, home screen, navigation bar, About dialog, enables switching between tabs, and other framework-related features.
MIT License
8 stars 6 forks source link

Chrome DevTools Issue: Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform #928

Closed pixelzoom closed 1 year ago

pixelzoom commented 1 year ago

Originally reported by @Nancy-Salpepi in https://github.com/phetsims/geometric-optics/issues/476 ...

Chrome DevTools is reporting an Issue related to FileSaver-b8054a2.js.

To reproduce:

  1. Launch any sim from phetmarks. For example, density in mode "Unbuilt".
  2. Open Chrome DevTools and click on the "Issues" tab. You'll see an Issue that looks like this. Note that the blue icon means severity "An improvement issue: there is an opportunity to improve the page".
screenshot_2555
  1. Example the issue, then expand "> 1 source". Note that the 1 source is FileSaver-b8054a2.js.
screenshot_2554
pixelzoom commented 1 year ago

I asked @jonathanolson to take a look at this, and in https://github.com/phetsims/geometric-optics/issues/476#issuecomment-1570497137 he replied:

The way we are using navigator.userAgent/navigator.platform appears to be compatible with the deprecations, so I don't believe anything is needed at this point. I'm on chrome 114 with the full new reduced versions, and the autodetection of platform is working nicely.

I didn't understand this, and asked for clarification in https://github.com/phetsims/geometric-optics/issues/476#issuecomment-1570894463:

@jonathanolson can you clarify https://github.com/phetsims/geometric-optics/issues/476#issuecomment-1570497137? I don't understand most of what you've said here. How/where are we using navigator.userAgent/navigator.platform? What deprecations? Are you able to reproduce the issue? Are you saying that these 2 console message are expected (a non-issue) or do you recommend investigating further?

pixelzoom commented 1 year ago

It looks like FileSaver is used for the PhET menu > Screenshot feature. Since this is an "opportunity for improvement" Issue, we will not address it for geometric-optics 1.3. And I'll transfer this issue from geometric-optics to joist, since it is reproducible for all sim.

jonathanolson commented 1 year ago

I wasn't able to reproduce the warning. We're using userAgent/platform in platform.js to detect browser/OS. Chrome (as of v113) has reduced the amount of information available in the userAgent/platform. We are fine with the current information provided (still), so the deprecation warnings before/after don't concern me. This is non-blocking, the console messages are warning about something that is not an issue for us.

jonathanolson commented 1 year ago

FileSaver also looks like it is compatible, so not an issue there.

pixelzoom commented 1 year ago

Thanks for the clarification. We can safely ignore this, so closing.