Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Various errata of GM_cookie #2244

Open
PRO-2684 opened this issue Nov 14, 2024 · 0 comments
Open

doc: Various errata of GM_cookie #2244

PRO-2684 opened this issue Nov 14, 2024 · 0 comments

Comments

@PRO-2684
Copy link

  • expirationDate not present at the documentation of cookie objects under GM_cookie.list. expirationDate
  • Typo of GM.cookies under "Example usage" - it should be GM.cookie.
    GM.cookies
  • Invalid example at "Example usage" - GM.cookie.list() doesn't return, but GM.cookie.list({}) works as expected.

Specifications

  • Chromium: Edge 130.0.2849.80
  • TM: v5.3.6216
  • OS: Windows 11 23H2, 22631.4460

Script

Adapted from #465 (comment)

// ==UserScript==
// @name         Test cookie
// @namespace    xxx
// @version      xxx
// @description  xxx
// @author       xxx
// @match        *://*/*
// @grant        GM.xmlHttpRequest
// @grant        GM.cookie
// @connect      httpbin.org
// ==/UserScript==


const getRandomString = () => (new Date()).getTime().toString(36) + Math.random().toString(36).slice(2);

const d = getRandomString();
await GM.xmlHttpRequest({ url: 'https://httpbin.org/response-headers?set-cookie=partitioned='+d+';path=/;expires=Wed,%2021%20Sep%202033%2015:59:37%20GMT;httponly;secure;samesite=none;partitioned' })
await GM.xmlHttpRequest({ url: 'https://httpbin.org/response-headers?set-cookie=nonpartitioned='+d+';path=/;expires=Wed,%2021%20Sep%202033%2015:59:37%20GMT;httponly;secure;samesite=none' })

console.log('expected value', d);
console.log("Arg: {...}", await GM.cookie.list({ url: 'https://httpbin.org/', partitionKey: {} })); // Success
console.log("Arg: {}", await GM.cookie.list({})); // Success
console.log("Arg: undefined", await GM.cookie.list()); // Never resolves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant