Closed Bug 1220237 Opened 5 years ago Closed 4 years ago

remove uses of nsIEnumerator from PSM

Categories

(Core :: Security: PSM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox45 --- affected
firefox47 --- fixed

People

(Reporter: keeler, Assigned: Cykesiopka)

References

Details

(Keywords: addon-compat)

Attachments

(1 file)

The comment in nsIEnumerator.idl indicates it should not be used:

/*
 * DO NOT USE THIS INTERFACE.  IT IS HORRIBLY BROKEN, USES NS_COMFALSE
 * AND IS BASICALLY IMPOSSIBLE TO USE CORRECTLY THROUGH PROXIES OR
 * XPCONNECT.  IF YOU SEE NEW USES OF THIS INTERFACE IN CODE YOU ARE
 * REVIEWING, YOU SHOULD INSIST ON nsISimpleEnumerator.
 *
 * DON'T MAKE ME COME OVER THERE.
 */

ಠ_ಠ
Assignee: nobody → cykesiopka.bmo
Status: NEW → ASSIGNED
Attachment #8722533 - Flags: review?(dkeeler) → review+
Comment on attachment 8722533 [details]
MozReview Request: Bug 1220237 - Remove uses of nsIEnumerator from PSM. r=keeler

https://reviewboard.mozilla.org/r/36077/#review33037

This looks great. I just had a few comments on the tests.

::: security/manager/ssl/tests/unit/test_pkcs11_list.js:19
(Diff revision 1)
> +function checkTestModuleMissing() {

Maybe "NotPresent" instead of "Missing"?

::: security/manager/ssl/tests/unit/test_pkcs11_list.js:70
(Diff revision 1)
> +    } catch (e) {}

Do we want to hide potential exceptions? Is the potential failure here "it was already unloaded"? Maybe we could check for that and re-throw if that's not the error.
https://reviewboard.mozilla.org/r/36077/#review33037

Thanks for the review!

> Do we want to hide potential exceptions? Is the potential failure here "it was already unloaded"? Maybe we could check for that and re-throw if that's not the error.

Yes, the potential failure here is mainly "it was already unloaded". In particular, we delete the module near the end, so in a normal run having the cleanup code delete the module again will result in an exception being thrown. For xpcshell tests, I guess cleanup like this isn't strictly necessary, but doing so does seem like best practice. I'll add a comment explaining this.

With regards to hiding exceptions, we call deleteModule() without a try-catch at line 87, so I think we already have sufficient coverage for the method throwing unexpectedly.
Comment on attachment 8722533 [details]
MozReview Request: Bug 1220237 - Remove uses of nsIEnumerator from PSM. r=keeler

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/36077/diff/1-2/
Attachment #8722533 - Attachment description: MozReview Request: Bug 1220237 - Remove uses of nsIEnumerator from PSM. → MozReview Request: Bug 1220237 - Remove uses of nsIEnumerator from PSM. r=keeler
https://hg.mozilla.org/mozilla-central/rev/63fdedf32876
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Keywords: addon-compat
You need to log in before you can comment on or make changes to this bug.