Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

In Firefox Nightly, "NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsICookieManager2.remove] HTTPS.js:164:0" #4241

Closed

Description

@dholbert

Not sure about exact STR, but in Firefox Nightly 47 with HTTPS Everywhere 5.1.4, I saw this error in my Browser Console (ctrl shift J):

NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsICookieManager2.remove] HTTPS.js:164:0

This points to the following source code in HTTPS Everywhere's HTTPS.js source file:

  handleInsecureCookie: function(c) {
      [...]
      cookieManager.remove(c.host, c.name, c.path, false);

The error happens because the remove function-signature was modified recently, here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1245184
http://hg.mozilla.org/mozilla-central/diff/ab3a305b3e41/netwerk/cookie/nsICookieManager.idl#l47

A new parameter "aOriginAttributes" has been added.

Activity

  1. changed the title [-]In Firefox NIghtly, "NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsICookieManager2.remove] HTTPS.js:164:0"[/-] [+]In Firefox Nightly, "NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsICookieManager2.remove] HTTPS.js:164:0"[/+] on Feb 29, 2016
  2. dholbert commented on Feb 29, 2016

    @dholbert
    ContributorAuthor

    (CCing @bakulf who made this change in Gecko.)

  3. bakulf commented on Mar 1, 2016

    @bakulf

    the new method wants an additional param. Change that line to:

    cookieManager.remove(c.host, c.name, c.path, c.originAttributes, false);

  4. dholbert commented on Mar 1, 2016

    @dholbert
    ContributorAuthor

    (Of course, that change on its own would make HTTPS Everywhere stop working in earlier versions of Firefox, like our current release & beta. So really, I suspect they might want to do this in a try{}catch{}, or something else to allow for both versions of the method.)

  5. Vednier commented on Jun 30, 2016

    @Vednier

    Right now Nightly (Firefox 50) throws a lot of errors like this in console
    “nsICookieManager.remove()” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager HTTPS.js:164:6
    “nsICookieManager2.add()” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager2 HTTPS.js:165:6

  6. Vednier commented on Jun 30, 2016

    @Vednier

    the new method wants an additional param. Change that line to:
    cookieManager.remove(c.host, c.name, c.path, c.originAttributes, false);

    No, this doesnt work, changing that in HTTPS.js only cause this error to appear.
    NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsICookieManager2.remove] HTTPS.js:164

  7. Lithopsian commented on Jul 11, 2016

    @Lithopsian

    They changed it so that origin attributes is the last parameter. It appeared as the fourth parameter in an initial incarnation in nightly, but that just broke too many addons, so it was moved after the existing parameters. It is also optional, although the documentation doesn't say that and it is likely to become mandatory at some point. The console message should only appear if the origin attributes parameter (the fifth one) is undefined or empty.

  8. Vednier commented on Jul 27, 2016

    @Vednier

    Changing lines 164 and 165 from
    cookieManager.remove(c.host, c.name, c.path, false); cookieManager.add(c.host, c.path, c.name, c.value, true, c.isHTTPOnly, c.isSession, expiry);
    to
    cookieManager.remove(c.host, c.name, c.path, false, c.originAttributes); cookieManager.add(c.host, c.path, c.name, c.value, true, c.isHTTPOnly, c.isSession, expiry, c.originAttributes);

    Solves problem completely (but breaks signing, which i dont care for)

  9. evilpie commented on Sep 17, 2016

    @evilpie
    Contributor

    Can we get this fixed? @Hainish @jeremyn

  10. bakulf commented on Sep 19, 2016

    @bakulf

    You don't need to fix this issue. We make originAttributes an optional argument.

  11. dholbert commented on Sep 19, 2016

    @dholbert
    ContributorAuthor

    Ah, looks like that indeed changed in https://bugzilla.mozilla.org/show_bug.cgi?id=1259169 (a few months after this github-issue was filed).

    OK, I think this issue can just be closed then -- it was addressed/worked-around by that ^^ Firefox bug.

    (As a sanity-check that this is indeed fixed: I don't see any mentions of NS_ERROR_XPC_NOT_ENOUGH_ARGS in my error console, in my current Firefox session which has HTTPS Everywhere active.)

  12. Vednier commented on Sep 20, 2016

    @Vednier

    There is still tons of deprecation warnings instead in 51.0a1 (2016-09-19) (64-bit) Nighly

    “nsICookieManager.remove()” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager HTTPS.js:164:6

    “nsICookieManager2.add()” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager2 HTTPS.js:165:6

  13. dholbert commented on Sep 20, 2016

    @dholbert
    ContributorAuthor

    Ah, I guess I must not have exercised HTTPS Everywhere sufficiently in that browser-session.

    @bakulf , are those warnings expected? If not, we should figure out what's causing them... Or if they are indeed expected, then we should indeed get this fixed in HTTPS Everywhere.

  14. bakulf commented on Sep 20, 2016

    @bakulf

    Those warnings are expected if OriginAttributes is not passed as argument, yes. I was commenting the title of the bug, and nsICookieManager.remove() doesn't throw NS_ERROR_XPC_NOT_ENOUGH_ARGS anymore, so this issue it's fixed.

    I'm going to send a pull-request for this issue, but we should file a new for supporting originAttributes correctly. This means: privateBrowsing(?), WebExtensions and containers, these 3 features (and maybe in the future we could have more) are currently managed via OriginAttributes.

  15. bakulf commented on Sep 20, 2016

    @bakulf
  16. gloomy-ghost commented on Sep 1, 2017

    @gloomy-ghost
    Collaborator

    Closing as we are moving to WebExtension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions