WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
188009
navigator.userAgent may return outdated value after webView.customUserAgent is set
https://bugs.webkit.org/show_bug.cgi?id=188009
Summary
navigator.userAgent may return outdated value after webView.customUserAgent i...
Chris Dumez
Reported
2018-07-25 10:57:59 PDT
navigator.userAgent may return outdated value after webView.customUserAgent is set, due to its cached not getting invalidated.
Attachments
Patch
(16.24 KB, patch)
2018-07-25 11:06 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(16.29 KB, patch)
2018-07-25 12:05 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2018-07-25 10:58:13 PDT
<
rdar://problem/42566456
>
Chris Dumez
Comment 2
2018-07-25 11:06:03 PDT
Created
attachment 345768
[details]
Patch
Geoffrey Garen
Comment 3
2018-07-25 11:44:26 PDT
Comment on
attachment 345768
[details]
Patch Prior to <
https://trac.webkit.org/changeset/232159/webkit
>, was the UI client able to change navigator.userAgent while the page was live? I'm not sure it's important or desirable to be able to change navigator.userAgent while the page is live. It's specified as a readonly attribute, and a website might do something really weird if feature detection returned different results half-way through webpage rendering.
Chris Dumez
Comment 4
2018-07-25 11:59:58 PDT
(In reply to Geoffrey Garen from
comment #3
)
> Comment on
attachment 345768
[details]
> Patch > > Prior to <
https://trac.webkit.org/changeset/232159/webkit
>, was the UI > client able to change navigator.userAgent while the page was live?
Yes, since there was no caching whatsoever.
> I'm not > sure it's important or desirable to be able to change navigator.userAgent > while the page is live. It's specified as a readonly attribute, and a > website might do something really weird if feature detection returned > different results half-way through webpage rendering.
I am not sure how important this is either but this is a recent behavior change compared to shipping and I have a radar about it. Clearly, the developer who filed the radar see this as a regression.
Chris Dumez
Comment 5
2018-07-25 12:04:48 PDT
(In reply to Chris Dumez from
comment #4
)
> (In reply to Geoffrey Garen from
comment #3
) > > Comment on
attachment 345768
[details]
> > Patch > > > > Prior to <
https://trac.webkit.org/changeset/232159/webkit
>, was the UI > > client able to change navigator.userAgent while the page was live? > > Yes, since there was no caching whatsoever. > > > I'm not > > sure it's important or desirable to be able to change navigator.userAgent > > while the page is live. It's specified as a readonly attribute, and a > > website might do something really weird if feature detection returned > > different results half-way through webpage rendering. > > I am not sure how important this is either but this is a recent behavior > change compared to shipping and I have a radar about it. Clearly, the > developer who filed the radar see this as a regression.
My first instinct was also not to fix it since I am not convinced there is a great use-case for changing the user agent after the page has loaded. That said, the radar was sent to me so I fixed it. It is not a lot of code and I have already written it, I do not see much harm in landing it.
Chris Dumez
Comment 6
2018-07-25 12:05:55 PDT
Created
attachment 345772
[details]
Patch
Chris Dumez
Comment 7
2018-07-25 12:07:10 PDT
(In reply to Chris Dumez from
comment #5
)
> (In reply to Chris Dumez from
comment #4
) > > (In reply to Geoffrey Garen from
comment #3
) > > > Comment on
attachment 345768
[details]
> > > Patch > > > > > > Prior to <
https://trac.webkit.org/changeset/232159/webkit
>, was the UI > > > client able to change navigator.userAgent while the page was live? > > > > Yes, since there was no caching whatsoever. > > > > > I'm not > > > sure it's important or desirable to be able to change navigator.userAgent > > > while the page is live. It's specified as a readonly attribute, and a > > > website might do something really weird if feature detection returned > > > different results half-way through webpage rendering. > > > > I am not sure how important this is either but this is a recent behavior > > change compared to shipping and I have a radar about it. Clearly, the > > developer who filed the radar see this as a regression. > > My first instinct was also not to fix it since I am not convinced there is a > great use-case for changing the user agent after the page has loaded. That > said, the radar was sent to me so I fixed it. It is not a lot of code and I > have already written it, I do not see much harm in landing it.
Note that would also impact changing the user-agent via the Develop menu (navigator.userAgent would not change until reloading).
WebKit Commit Bot
Comment 8
2018-07-25 13:33:24 PDT
Comment on
attachment 345772
[details]
Patch Clearing flags on attachment: 345772 Committed
r234211
: <
https://trac.webkit.org/changeset/234211
>
WebKit Commit Bot
Comment 9
2018-07-25 13:33:26 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug