RESOLVED FIXED 209378
[GTK] Add user agent quirk for auth.mayohr.com
https://bugs.webkit.org/show_bug.cgi?id=209378
Summary [GTK] Add user agent quirk for auth.mayohr.com
Ting-Wei Lan
Reported 2020-03-21 10:57:04 PDT
This site blocks the login page completely and asks the user to download Google Chrome when using our standard user agent. It only blocks the login page. After logging in, it works fine without user agent quirks. I added a new quirk called 'NeedsNoSafariVersion' for it because the site still blocks the page if both 'Chrome/' and 'Version/' exist in the user agent string. Therefore, I need a way to not only add 'Chrome/' but also remove 'Version/'.
Attachments
Patch (6.99 KB, patch)
2020-03-21 10:59 PDT, Ting-Wei Lan
no flags
Patch (6.98 KB, patch)
2020-03-21 11:42 PDT, Ting-Wei Lan
no flags
Patch (5.95 KB, patch)
2020-03-24 21:20 PDT, Ting-Wei Lan
no flags
Patch (5.94 KB, patch)
2020-03-25 04:34 PDT, Ting-Wei Lan
no flags
Ting-Wei Lan
Comment 1 2020-03-21 10:59:48 PDT
Ting-Wei Lan
Comment 2 2020-03-21 11:42:06 PDT
Michael Catanzaro
Comment 3 2020-03-23 07:30:58 PDT
Comment on attachment 394171 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394171&action=review OK this looks basically good, but let's simplify it a bit, because it reveals a problem with our existing Chrome quirk. > Source/WebCore/platform/UserAgentQuirks.cpp:157 > + // This site does not recognize Chrome/X with Version/X as a valid Chrome > + // user agent, so we have to hide Version/X from the user agent. OK, this just indicates that our current Google Chrome quirk is broken, and we just got lucky that the existing sites we use it on didn't notice. We don't need a new quirk here; instead, we should fix the existing quirk to not include Version/X. > Source/WebCore/platform/glib/UserAgentGLib.cpp:113 > // Version/X is mandatory *before* Safari/X to be a valid Safari UA. See > // https://bugs.webkit.org/show_bug.cgi?id=133403 for details. > - uaString.appendLiteral("Version/13.0 Safari/"); > + if (!quirks.contains(UserAgentQuirks::NeedsNoSafariVersion)) > + uaString.appendLiteral("Version/13.0 "); So this can become an else clause of the previous condition. Then it will get added except when the Chrome quirk is in use. (Or when the Firefox quirk is in use, but we already returned early up above in that case.)
Ting-Wei Lan
Comment 4 2020-03-24 21:20:34 PDT
Ting-Wei Lan
Comment 5 2020-03-25 04:34:55 PDT
Ting-Wei Lan
Comment 6 2020-03-25 06:22:12 PDT
I haven't figured out how to run WebKit tests, so I don't know if the test I modified in the patch passes.
EWS
Comment 7 2020-03-25 06:54:21 PDT
Committed r258978: <https://trac.webkit.org/changeset/258978> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394482 [details].
Note You need to log in before you can comment on or make changes to this bug.