Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

What do cookie permission values mean in permissions.sqlite?

  • 4 trả lời
  • 2 gặp vấn đề này
  • 48 lượt xem
  • Trả lời mới nhất được viết bởi cor-el

more options

I want to export my cookie permissions either through a WebExtension or a script outside of Firefox.

I'm looking at the `moz_perms` table in my permissions.sqlite, and I see three values for `permission` for entries of `type` "cookie":

  • 1: Keep cookies permanently
  • 2: Block all cookies
  • 8: Keep cookies for session

As I review the Firefox codebase, I see the following in nsIPermissionManager.idl:

 const uint32_t EXPIRE_NEVER = 0;
 const uint32_t EXPIRE_SESSION = 1;
 const uint32_t EXPIRE_TIME = 2;
 const uint32_t EXPIRE_POLICY = 3;

Obviously, that doesn't match up at all, so I'm probably looking at the wrong thing. I've been a user of Self-destructing cookies if that makes any difference.

Where can I find code or documentation on meaning of the `permission` field for entries of `type` "cookie" in the `moz_perms` table of permissions.sqlite? Is there a better or existing means of exporting cookie settings like this?

Được chỉnh sửa bởi Sondra Kinsey vào

Tất cả các câu trả lời (4)

more options

This does what I want, but I still was hoping to reference the code or documentation:

sqlite3 -csv permissions.sqlite '
select "origin",
     WHEN permission = 1 THEN "allow"
     WHEN permission = 2 THEN "block"
     WHEN permission = 8 THEN "allow for session"
     ELSE permission
from moz_perms where type == "cookie"

Được chỉnh sửa bởi Sondra Kinsey vào

more options

Man I wish this used Markdown!

Được chỉnh sửa bởi Sondra Kinsey vào

more options

Sorry, it's old wiki syntax here.

Regarding an extension, I'm not sure there is an API to read out the site permissions, so you may be stuck reading the database.

There are libraries to read databases via a webapp. I used sql.js -- a SQLite library converted to JavaScript using Emscripten -- to read the old stylish.sqlite database in this page: https://www.jeffersonscher.com/res/stylishextract.html

The sql.js library makes that data available as an array with the objects columns (has one array of headings) and values (has an array containing one array for each row). The syntax is annoying, but making it a webapp allows lots of flexibility for output.

If you are more handy with SQL and tools to handle such output (e.g., Excel) than with JavaScript, your way's probably much more efficient.

Also, on the original question, I think we know where 1 and 2 come from, but it's not clear where 8 comes from:

 const uint32_t UNKNOWN_ACTION = 0;
 const uint32_t ALLOW_ACTION = 1;
 const uint32_t DENY_ACTION = 2;
 const uint32_t PROMPT_ACTION = 3;
more options