passwords.search function "crashes" with some profiles

NEW
Unassigned

Status

Add-on SDK
General
--
major
6 years ago
2 years ago

People

(Reporter: nmaier, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
The passwords module tries to convert retrieved logins to it's internal Login() type, however nsILoginInfo does not guarantee that all "url" fields, in particular the formSubmitURL member, are in fact URLs.
Some other add-ons might store information that cannot be parsed as an URL, and hence will crash passwords.search() in a way that it never calls the onComplete callback, with a stack similar to the following:

Error: An exception occurred.
Traceback (most recent call last):
  File "resource://jid1-8bd4ev1healr7w-at-jetpack/api-utils/lib/url.js", line 99, in URL
    var uri = newURI(url, base);
  File "resource://jid1-8bd4ev1healr7w-at-jetpack/api-utils/lib/url.js", line 53, in newURI
    throw new Error("malformed URI: " + uriStr);
Error: malformed URI: FireFTP

(That URI was obviously created by the FireFTP login).

While the other add-on (such as FireFTP) might actually violate convention here, the SDK passwords module should still not simply crash here.

STR:
1) Execute the following code once, e.g. in an about:memory ScratchPad:
Components.utils.import("resource://gre/modules/Services.jsm");
var nsLoginInfo = new Components.Constructor(
    "@mozilla.org/login-manager/loginInfo;1",
    Components.interfaces.nsILoginInfo,
    "init"
    );
Services.logins.addLogin(new nsLoginInfo(
    "testHost",
    "testForm",
    null,
    "testUser",
    "testPassword",
    "", ""
    ));

2) require("passwords").search({onComplete: function() {}});

-> Observe the crash in the error console, and also that onComplete is never called.
(Reporter)

Comment 1

6 years ago
Might be also important for add-on reviews: CC'ing Jorgev
Summary: passwords.search modules "crashes" with some profile → passwords.search function "crashes" with some profiles
Irakli, can you look at this?
Whiteboard: [triage:followup]
Assignee: nobody → rFobic
Priority: -- → P1
Whiteboard: [triage:followup]
Assignee: rFobic → jsantell
Unassigning myself from bugs I haven't gotten around to
Assignee: jsantell → nobody

Updated

2 years ago
Priority: P1 → --
You need to log in before you can comment on or make changes to this bug.