Coder Social home page Coder Social logo

Comments (10)

Tanych avatar Tanych commented on May 30, 2024 2

@nicjansma initially client hints only persist on browsing session level, however, starting from M103, we made the client hints persisted even browser restarts. we probably need to clean up some documents to avoid the confusion.

context: https://bugs.chromium.org/p/chromium/issues/detail?id=1296339

I tested the latest chrome canary on Android and mac os:

  • 112.0.5579.0 on mac os. has no issue when restart.
  • 112.0.5579.0 on Android (pixel 5) has no issue when restart.

I will try to verify any issues in Windows 11 as well.

from client-hints-infrastructure.

Tanych avatar Tanych commented on May 30, 2024 1

I'm also not seeing any unexpected behavior in the above scenarios, another note is that you won't see client hints change in the first request header after you change the accept_ch list in the response header because client is unaware of the server’s most recent preferences. All sub-requests will notice the accept_ch header changes.
You can use critical_ch, If corresponding client hints headers didn't send in the original request, the user agent will retry the request along with the client hints headers rather than render the page.

from client-hints-infrastructure.

arichiv avatar arichiv commented on May 30, 2024

It looks like the client hints cache should persist between browser sessions: https://source.chromium.org/chromium/chromium/src/+/main:components/content_settings/core/browser/website_settings_registry.cc;l=179;drc=f775d850d7f5beebd9308f5d02111d6069083b28;bpv=0;bpt=1

However the persistence of the cache is marked as lossy so there may be some chance it's not being written? Although I would assume all lossy caches are at least written on normal browser close.

It seems like that comment that "cache is cleared when session cookies are cleared" is false, as it should persist unless all cookies are cleared manually.

Can you detail how you tested the persistence?

@yoavweiss if I'm missing something

from client-hints-infrastructure.

miketaylr avatar miketaylr commented on May 30, 2024

It seems like that comment that "cache is cleared when session cookies are cleared" is false, as it should persist unless all cookies are cleared manually.

Yeah, that should just say "cookies and other site data", right?

from client-hints-infrastructure.

nicjansma avatar nicjansma commented on May 30, 2024

I was just using user-agent-client-hints.glitch.me for testing, i.e. asking for Sec-CH-UA-Platform-Version

Browser Restart Scenario:

  1. Nav to https://user-agent-client-hints.glitch.me/headers?uach=Sec-CH-UA-Platform-Version
    • Client requests with default hints, i.e. w/out Sec-CH-UA-Platform-Version
    • Server sends Accept-CH: Sec-CH-UA-Platform-Version
  2. Reload of the same page
    • Client requests with Sec-CH-UA-Platform-Version
    • Server sends Accept-CH: Sec-CH-UA-Platform-Version
  3. Close browser
  4. Open Browser
  5. Nav to https://user-agent-client-hints.glitch.me/headers?uach=Sec-CH-UA-Platform-Version
    • Client requests with default hints, i.e. w/out Sec-CH-UA-Platform-Version <-- this shows browse restarts don't persist Accept-CH
    • Server sends Accept-CH: Sec-CH-UA-Platform-Version
  6. Reload of the same page
    • Client requests with Sec-CH-UA-Platform-Version
    • Server sends Accept-CH: Sec-CH-UA-Platform-Version

from client-hints-infrastructure.

miketaylr avatar miketaylr commented on May 30, 2024

Thanks @nicjansma - I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1413216 to investigate.

from client-hints-infrastructure.

arichiv avatar arichiv commented on May 30, 2024

I'm not seeing this reproduce locally. If I load and refresh https://user-agent-client-hints.glitch.me/headers?uach=Sec-CH-UA-Platform-Version so that the hint is included it works. If I open a new window or tab and load the page the hint appears without needing a reload. If I close all tabs and windows and re-open the browser and load https://user-agent-client-hints.glitch.me/headers?uach=Sec-CH-UA-Platform-Version it's still there without a refresh.

from client-hints-infrastructure.

nicjansma avatar nicjansma commented on May 30, 2024

Ok, I've done some additional testing:

  • On macOS Monterey / 111.0.5554.0, Accept-CH hints are persisted between restarting Chrome Canary
  • On Windows 11 / 112.0.5576.0, Accept-CH hints are not persisted between restarting Chrome Canary

So maybe this is just a Windows bug? I haven't tested Android yet either.

(I'm not using an In Private session or anything to test, just closing and re-opening a vanilla Canary browser).

Back to my main question though: If I'm understanding the comments above correctly, the intent is for Accept-CH hints to persist not only through the browsing session (which I think people generally understand to be until the browser closes), but across browser restarts as well, correct?

If so, when I'm reading documentation explaining hints ([1] [2]) etc, that talk about hint lifetimes persisting "for the browsing session" are accurate, but not complete, and could improve clarity by saying something like "for the browsing session and persisted (through browser restarts) until the site's data is cleared", or something.

i.e. MDN even says:

In other words, the request for a specific set of hints does not expire until the browser is shut down

Happy to file tickets or make these changes for those docsets to clarify, just making sure I understand the intent :)

from client-hints-infrastructure.

Tanych avatar Tanych commented on May 30, 2024

The latest canary should fix the persisted client hints issue on Windows.

from client-hints-infrastructure.

nicjansma avatar nicjansma commented on May 30, 2024

@Tanych that's great! I'll followup with trying to get those other docsets updated. I'll probably open a PR for this repo too to add that clarification in the explainer, if that's OK.

from client-hints-infrastructure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.