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

RESOLVED FIXED in Firefox 45

Status

()

RESOLVED FIXED
3 years ago
5 months ago

People

(Reporter: njn, Assigned: njn)

Tracking

unspecified
mozilla45
Points:
---

Firefox Tracking Flags

(firefox45 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
+++ 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)

Comment 1

3 years ago
Created attachment 8681758 [details] [diff] [review]
Replace nsBaseHashtable::EnumerateRead() calls in xpfe/ with iterators
Attachment #8681758 - Flags: review?(neil)
(Assignee)

Updated

3 years ago
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED

Comment 2

3 years ago
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+
(Assignee)

Comment 3

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/e1d1d11909a4feceb354c9ba8fdbbdb840aeaf73
Bug 1186790 - Replace nsBaseHashtable::EnumerateRead() calls in xpfe/ with iterators. r=neil.

Comment 4

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/e1d1d11909a4
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox45: --- → fixed
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.