Add SQL VIEW with old "cookies.txt" format in cookies.sqlite

RESOLVED WONTFIX

Status

()

Core
Networking: Cookies
--
enhancement
RESOLVED WONTFIX
7 years ago
2 years ago

People

(Reporter: Samuel Adam, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
Build Identifier: N/A

Ugly as it is, cookies.txt was upraised by Netscape’s success to become the application-level lingua franca of cookies.  Thus, exporting Firefox cookies in cookies.txt format is a common use case.  A quick browse with $SEARCH_ENGINE shows that people are passing around ugly homebrew Python scripts, just so they can share their Firefox cookies with other applications.  An SQL VIEW makes far more sense, and is trivial to implement.

Pros to shipping Firefox with such a VIEW in cookies.sqlite:

 (a) It would have a negligible impact on shipping code size: About 250 bytes of uncompressed SQL, or a bit more if you add the old “do not edit” header;

 (b) It would enable users to extract a working cookies.txt with a single command using the SQLite shell tool from sqlite.org; and,

 (c) It would pave the way for a proper cookie-export function.  With the RDBMS machinery handling the data, cookie export becomes a UI matter.

Cons:

 - cookies.txt has no column for isHttpOnly.  That is not an argument against an SQL VIEW, but rather a general problem with export to cookies.txt.

 - I do not see a column in the cookies.sqlite schema which could be VIEWed into the second column of cookies.txt, viz., the boolean which denotes “[w]hether the cookie can be read by other machines at the same domain”[1].

[1] http://kb.mozillazine.org/Cookies.txt

I have no idea how to use Bugzilla, as I only registered to report Bug 609172.  When I can figure out how to make an attachment without dumping garbage in everybody’s lap, I will attach a snip of suggested SQL.  As I said, it’s really quite trivial.

Reproducible: Always
(Reporter)

Comment 1

7 years ago
Created attachment 493893 [details]
SQL VIEW to make cookies.sqlite give forth cookies.txt.

Set up VIEW in Windows:
type cookies_txt.sql | sqlite3 -batch cookies.sqlite
Set up VIEW in *nix:
cat cookies_txt.sql | sqlite3 -batch cookies.sqlite

General usage, modify depending on your shell's quoting requirements:

echo SELECT * FROM "cookies.txt"; | sqlite3 -batch cookies.sqlite > cookies.txt

(Extra pipes are used because sqlite3's shell command-line is finicky.)
Do we want this feature?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: Migration → Networking: Cookies
Product: Firefox → Core
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.