Bug 218122 - [GTK] Chassis type check does not work in flatpak
Summary: [GTK] Chassis type check does not work in flatpak
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: Flatpak
  Show dependency treegraph
 
Reported: 2020-10-23 06:07 PDT by Michael Catanzaro
Modified: 2023-01-19 17:46 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2020-10-23 06:07:11 PDT
The chassis type check added in r264213 does not work in flatpak because it depends on /etc/machine-info, which is not available inside the sandbox. Jan-Michael proposed mounting it in the sandbox in https://github.com/flatpak/flatpak/pull/3727, but this was rejected upstream.

This means WebKit sends a desktop user agent even if a mobile user agent is required.
Comment 1 Alice Mikhaylenko 2020-10-23 07:03:58 PDT
Hmm right. Can we access hostnamectl somehow?
Comment 2 Michael Catanzaro 2020-10-23 07:56:33 PDT
I'm not sure what would be acceptable for upstream flatpak.

My guess is a chassis type portal would probably be acceptable. We should figure out what upstream is willing to accept before we implement something.
Comment 3 Michael Catanzaro 2021-06-30 08:11:37 PDT
Note this bug is really specific to flatpak only. It's not a problem for our bubblewrap sandbox because all of /etc is available in the bubblewrap sandbox.
Comment 4 Michael Catanzaro 2022-12-14 05:59:18 PST
We were discussing this today. Instead of implementing a portal to fix the ChassisType check, we should instead delete the code and stop using chassis type. Currently it's only used for setting a mobile user agent header. Instead, we should check window size and touchscreen presence to decide whether to pretend to be a mobile device.

However, WebKit itself does not have enough info to decide whether we are in mobile mode because it doesn't know what window size the browser uses as cutoff to switch between mobile UI vs. desktop UI. So I'm not sure quite how to do this. Some new API will probably be needed.
Comment 5 Alice Mikhaylenko 2022-12-14 06:01:24 PST
From my pov the ideal would be to just a flag to opt into using mobile UA for a particular tab. That's how it works in basically every single existing mobile browser, incl. Safari on iOS. Then the app can figure out if/when to show an option for it - e.g. when the window is small.