PSA user-data-dir structure is changing

467 views
Skip to first unread message

dvallet (Chromium)

unread,
Oct 30, 2017, 6:45:08 PM10/30/17
to headless-dev
Headless user profile structure is changing. If you reuse profiles by setting the --user-data-dir flag, your profile (Cookies and local storage) will no longer be read in Chrome 63.

Why are we making this change?
We are changing headless to use a "Default" profile, this means that we share the same structure as non-headless Chrome Default profile, so you can reuse/share more easily profiles between Chrome and Headless Chrome. See https://crbug.com/775703 and https://crbug.com/617931 for more information.

Can I reuse the profile from previous versions of Headless Chrome?
Yes, you just need to move all folders into a Default directory. So if you stored your profile in <profile> you would run the following bash commands:
cd <profile>
mkdir Default
mv * Default


Please report any issues at crbug.com/new

PhistucK

unread,
Nov 3, 2017, 6:53:44 AM11/3/17
to dvallet (Chromium), headless-dev
I wonder how reusing is possible so simply - I know some of the files contain absolute paths - did you fix those instances, or are they simply irrelevant (used only by plugins, extensions and other unsupported features in --headless)?


PhistucK

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/CAPuKmMWeWRd-J7sq3iMzX_Zj0YpoBUvMBAYascEcPN80Cmb1rQ%40mail.gmail.com.

dvallet (Chromium)

unread,
Nov 5, 2017, 5:19:18 PM11/5/17
to PhistucK, headless-dev
For now we only support limited local storage features, mainly Cookies. Those should work just by moving the files.

On Fri, 3 Nov 2017 at 21:53 PhistucK <phis...@gmail.com> wrote:
I wonder how reusing is possible so simply - I know some of the files contain absolute paths - did you fix those instances, or are they simply irrelevant (used only by plugins, extensions and other unsupported features in --headless)?


PhistucK

On Tue, Oct 31, 2017 at 12:44 AM, dvallet (Chromium) <dva...@chromium.org> wrote:
Headless user profile structure is changing. If you reuse profiles by setting the --user-data-dir flag, your profile (Cookies and local storage) will no longer be read in Chrome 63.

Why are we making this change?
We are changing headless to use a "Default" profile, this means that we share the same structure as non-headless Chrome Default profile, so you can reuse/share more easily profiles between Chrome and Headless Chrome. See https://crbug.com/775703 and https://crbug.com/617931 for more information.

Can I reuse the profile from previous versions of Headless Chrome?
Yes, you just need to move all folders into a Default directory. So if you stored your profile in <profile> you would run the following bash commands:
cd <profile>
mkdir Default
mv * Default


Please report any issues at crbug.com/new

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.

rjs...@google.com

unread,
Nov 20, 2017, 4:59:38 PM11/20/17
to headless-dev
"so you can reuse/share more easily profiles between Chrome and Headless Chrome"

I'm running the latest Chrome Canary. How do I reuse profiles between Chrome and Headless Chrome? Or is this not yet implemented (as the status of https://crbug.com/617931 maybe suggests)?

I'm trying to use headless Chrome to access a page that requires login: so I want to reuse my logged in state from regular Chrome but in headless mode.

Thanks,
Robbie

dvallet (Chromium)

unread,
Nov 20, 2017, 5:13:37 PM11/20/17
to rjs...@google.com, headless-dev
Chrome uses a Default location where it stores user profiles (see https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#Default-Location) . If you run headless with --user-data-dir pointing to that directory, it should pick up the "Default" profile's local storage and cookies. 


--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.

romanoa...@gmail.com

unread,
Dec 4, 2017, 11:52:34 AM12/4/17
to headless-dev, rjs...@google.com
it should pick up the "Default" profile's local storage and cookies. 
 
Have you tried it before? I can't reuse cookies neither using --user-data-dir or --profile-dir.
Can you show a full command line example?

Thx

dvallet (Chromium)

unread,
Dec 4, 2017, 5:30:42 PM12/4/17
to romanoa...@gmail.com, headless-dev, rjs...@google.com
This is confirmed working. If you want to test it you can run both chrome with --headless and without the flag and the same --user-data-dir directory:
google-chrome-unstable --user-data-dir=/tmp/user1 http://www.google.com
google-chrome-unstable --headless --user-data-dir=/tmp/user1 --remote-debugging-port=9222

=> You can then inspect cookies in the headless mode and you'll see that Google cookies are there

romanoa...@gmail.com

unread,
Dec 5, 2017, 7:42:22 AM12/5/17
to headless-dev, romanoa...@gmail.com, rjs...@google.com
Thanks for the reply.
It should work, but I just tried and the Cookies section is simply empty.
Another thing I noticed is although all the cookies are being stored in the encrypted "PROFILE/Cookies" file, they're not being read on the future sessions.

Any thoughts?
I'm running on 64 unstable version.

romanoa...@gmail.com

unread,
Dec 5, 2017, 8:52:59 AM12/5/17
to headless-dev, romanoa...@gmail.com, rjs...@google.com
I tested it again and the cookies now are being read, BUT to make it work I had to navigate to another website before closing the browser.
That's weird, but it worked. Thanks a million!

Sami Kyostila

unread,
Dec 5, 2017, 10:26:31 AM12/5/17
to romanoa...@gmail.com, headless-dev, rjs...@google.com
It sounds like we aren't perhaps flushing the cookie storage properly to disk before exiting. How are you shutting down the browser in this case?

- Sami

romanoa...@gmail.com

unread,
Dec 5, 2017, 10:40:25 AM12/5/17
to headless-dev, romanoa...@gmail.com, rjs...@google.com
Well spotted. I double tested here and in a headfull session, closing the brower using the UI it flushes correclty to the disk.
In a headless session sending an INTERRUPT or a TERM signal both doesn't flush at all. I explain: I navigated to github.com and the firstview cookies were flushed, then I logged in and the session cookies were not flushed.
Probably it's my fault and I'm closing it wrong in the terminal.

Alex Clarke

unread,
Dec 5, 2017, 10:43:32 AM12/5/17
to romanoa...@gmail.com, headless-dev, rjs...@google.com
Browser.close might be what you're looking for.

To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.

To post to this group, send email to headle...@chromium.org.

dvallet (Chromium)

unread,
Dec 5, 2017, 4:16:41 PM12/5/17
to Alex Clarke, romanoa...@gmail.com, headless-dev, rjs...@google.com
I've heard from Puppeteer users that cookie storage can be flaky when closing down the browser.
I've created a bug to track this: https://crbug.com/792187

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
Reply all
Reply to author
Forward
0 new messages