Closed Bug 1463584 Opened 6 years ago Closed 6 years ago

Assert.throws for an empty password in browser_notifications_2.js isn't testing the correct error

Categories

(Toolkit :: Password Manager, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: standard8, Assigned: MattN)

References

Details

Attachments

(1 file)

In browser_notifications_2.js, there's a bit of code:

      Assert.throws(notificationElement.button.doCommand(),
                    "Can't add a login with a null or empty password.",
                    "Should fail for an empty password");

There's two problems with this:

- Assert.throws expects to be passed a function to be called rather than the result of the called argument.
- The second argument is a string, rather than a regexp.

When I correct the call, I get a missing expected exception. It appears that CustomizableUI is swallowing the doCommand somehow.

This code did get re-arranged in bug 1217134.

I suspect this check needs to be changed to something else, but I'm guessing.

Matt, can you take a look at this please?
Flags: needinfo?(MattN+bmo)
Assignee: nobody → MattN+bmo
Status: NEW → ASSIGNED
Priority: -- → P1
We can simply remove that Assert since it's out of place to test it here where the button is disabled and we have thorough tests for empty passwords in https://dxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/test/unit/test_logins_change.js#158-162
Flags: needinfo?(MattN+bmo)
Feel free to autoland for me
Comment on attachment 8979815 [details]
Bug 1463584 - Remove invalid Assert.throws from test_empty_password.

https://reviewboard.mozilla.org/r/245974/#review252032

Great, thank you for investigating.
Attachment #8979815 - Flags: review?(standard8) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eea7f6eebf0f
Remove invalid Assert.throws from test_empty_password. r=standard8
https://hg.mozilla.org/mozilla-central/rev/eea7f6eebf0f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: