Closed Bug 1186790 Opened 9 years ago Closed 9 years ago

Replace nsBaseHashtable::EnumerateRead() calls in xpfe/ with iterators

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1186787 +++

Because iterators are so much nicer than enumerate functions.

There is one occurrence of EnumerateRead() in this directory.

A note to the assignee: to preserve existing behaviour, you should probably use
nsBaseHashtable::Iterator::UserData() rather than nsBaseHashtable::Iterator::Data(). (The latter should be used when replacing nsBaseHashtable::Enumerate()).
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
Comment on attachment 8681758 [details] [diff] [review]
Replace nsBaseHashtable::EnumerateRead() calls in xpfe/ with iterators

[Ugh, this code doesn't clear its outparam. I guess nobody actually looks up a non-existent window.]

>-        return PL_DHASH_STOP;
Nit: You could break out of your loop when you find the resource.

>+        if (resource == windowResource.get()) {
[As you're changing this anyway, the .get() is probably unnecessary and could be removed.]

>-        if (docShell) {
>-            nsCOMPtr<nsIDOMWindow> result = do_GetInterface(docShell);
>+            if (docShell) {
>+                nsCOMPtr<nsIDOMWindow> result = do_GetInterface(docShell);
[do_GetInterface is null-safe, so the check isn't actually necessary.]

>-            *aResult = result;
>-            NS_IF_ADDREF(*aResult);
>+                *aResult = result;
>+                NS_IF_ADDREF(*aResult);
[Might be worth updating this to use result.forget(aResult); rather than the explicit AddRef.]
Attachment #8681758 - Flags: review?(neil) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/e1d1d11909a4feceb354c9ba8fdbbdb840aeaf73
Bug 1186790 - Replace nsBaseHashtable::EnumerateRead() calls in xpfe/ with iterators. r=neil.
https://hg.mozilla.org/mozilla-central/rev/e1d1d11909a4
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Moving to Core:XUL per https://bugzilla.mozilla.org/show_bug.cgi?id=1455336
Component: XP Toolkit/Widgets: XUL → XUL
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: