Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#53451 assigned task (blessed)

Chrome 92 userAgent notice

Reported by: superpoincare's profile superpoincare Owned by: adamsilverstein's profile adamsilverstein
Milestone: Future Release Priority: normal
Severity: minor Version:
Component: General Keywords:
Focuses: javascript Cc:

Description

Starting Chrome 92, Chrome dev tools will start warning about the usage of navigator.userAgent:

https://blog.chromium.org/2021/05/update-on-user-agent-string-reduction.html

Although it is colored blue and not red and hence not an error message, it's better to not see it.

Many scripts user navigator.userAgent, especially wp-emoji.js which loads on all sites.

A way to continue using it is to see if navigator.userAgentData is true and prevent new Chrome from executing navigator.userAgent.

Attachments (1)

navigator_userAgent.code-search (7.3 KB) - added by superpoincare 3 years ago.
Files containing navigator.userAgent

Download all attachments as: .zip

Change History (7)

#1 @johnbillion
3 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version trunk deleted

Thanks for the ticket @superpoincare.

Let's start by gathering a list of all the scripts which perform logic based on the value of navigator.userAgent then we can go from there.

@superpoincare
3 years ago

Files containing navigator.userAgent

#2 follow-up: @superpoincare
3 years ago

Added a file. I found the results via VS Code's search function. Ignored minified files and library files which have those. The search query is in the file.

24 script files in total.

Version 0, edited 3 years ago by superpoincare (next)

#3 in reply to: ↑ 2 @SergeyBiryukov
3 years ago

Replying to superpoincare:

Added a file. I found the results via VS Code's search function. Ignored minified files and external library files which have those. The search query is in the file.

# Query: navigator.userAgent
# Excluding: *jquery*,*mediaelement*,*moxie*,*react*,*thickbox*,*tinymce*,*min.js

Thanks! Just noting that Thickbox can be patched too, it's essentially considered an "adopted" library and no longer an external library at this point.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#4 @adamsilverstein
2 years ago

  • Milestone changed from Future Release to 6.0
  • Owner set to adamsilverstein
  • Status changed from new to assigned

Time for some userAgent spring cleaning! https://developer.chrome.com/blog/progress-in-the-privacy-sandbox-2021-12/#user-agent-spring-cleaning

Related:

Last edited 2 years ago by SergeyBiryukov (previous) (diff)

#5 @costdev
2 years ago

  • Type changed from enhancement to task (blessed)

#6 @costdev
2 years ago

  • Milestone changed from 6.0 to Future Release

With 6.0 RC1 tomorrow, I'm moving this ticket back to Future Release.

Note: See TracTickets for help on using tickets.