Closed
Bug 529820
Opened 15 years ago
Closed 14 years ago
nsCategoryCache is slightly unsafe
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a5
People
(Reporter: timeless, Assigned: timeless)
Details
Attachments
(1 file, 2 obsolete files)
1.86 KB,
patch
|
timeless
:
review+
|
Details | Diff | Splinter Review |
today nsCategoryObserver::nsCategoryObserver does the following: obs1. get a complete list of things from nsCategoryManager obs2. slowly loop through its list and make a call to an observer other1. can trigger a change to nsCategoryManager manager1. can mutate the category the observer enumerated manager2. will fire an async event other2. an observer can push an event queue obs0. will miss the async event from manager2 because it isn't listening obs2. will continue to slowly loop through its list until it finishes obs3. will register observers (too late for obs0) the first response people have is "why not listen early?" obs1. get a complete list of things from nsCategoryManager obs2. slowly loop through its list and make a call to an observer (initial_a) other1. triggers a change to nsCategoryManager (replace "b") manager1. can mutate the category the observer enumerated manager2. fires async event mutated_remove_b manager2. fires async event mutated_add_b other2. an observer can push an event queue other3. receives mutated_remove_b (before initial_b) other4. receives mutated_add_b (before initial_b) obs2. slowly loop through its list and make a call to an observer (initial_b) other1. gets inital_b after mutated_add_b and is thoroughly confused obs2. will continue to slowly loop through its list until it finishes
this ensures we don't *miss* events, it doesn't promise an absolutely strict order, but i think it's still a better improvement than the other approach
Comment 2•15 years ago
|
||
Comment on attachment 413339 [details] [diff] [review] patch + for (PRUint32 i = entries.Length(); i-- > 0; ) this is horribly unreadable. if you want to count down, use a signed integer and write the loop like: for (PRInt32 i = entries.Length() - 1; i >= 0; --i) or just count up.
Attachment #413339 -
Flags: review?(cbiesinger) → review-
Attachment #413339 -
Attachment is obsolete: true
Attachment #430890 -
Flags: review?(cbiesinger)
Updated•14 years ago
|
Attachment #430890 -
Flags: review?(cbiesinger) → review+
Attachment #430890 -
Attachment is obsolete: true
Attachment #439233 -
Flags: review+
Comment 6•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/c12bfe27e805
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite-
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in
before you can comment on or make changes to this bug.
Description
•