Closed
Bug 82803
Opened 23 years ago
Closed 23 years ago
nsSHEnumerator::HasMoreElements() needs to check mIndex = -1
Categories
(Core Graveyard :: Embedding: APIs, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.0
People
(Reporter: depman1, Assigned: radha)
References
()
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
1. Ran mfcEmbed w/ qa tests
2. Ran tests for nsISHistory iface. Incl SH index tests which start at index=0.
3. Special test for SimpleEnumerator.
4. Execute this Code segment:
nsCOMPtr<nsISimpleEnumerator> theSimpleEnum;
rv = theSessionHistory->GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum));
PRBool bMore = PR_FALSE;
nsCOMPtr<nsISupports> nextObj;
nsCOMPtr<nsIHistoryEntry> nextHistoryEntry;
while (NS_SUCCEEDED(theSimpleEnum->HasMoreElements(&bMore)) && bMore)
{
theSimpleEnum->GetNext(getter_AddRefs(nextObj));
if (!nextObj)
continue;
nextHistoryEntry = do_QueryInterface(nextObj);
if (!nextHistoryEntry)
continue;
rv = nextHistoryEntry->GetURI(getter_AddRefs(theUri));
rv = theUri->GetSpec(&uriSpec);
// ...
}
Result: It doesn't execute this while loop because HasMoreElements() initializes
the mIndex to -1 but only checks between 0 and a positive counter. Also, if I
replace the while() with a do/while() loop, it will execute, but the last url is
repeated twice and we get an assert.
Expected: Check for mIndex = -1 in nsSHEnumerator::HasMoreElements(), in the
"if" condition. Then the code segment will execute. See above url (line 804).
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.0
Assignee | ||
Comment 2•23 years ago
|
||
Assignee | ||
Comment 3•23 years ago
|
||
Comment 4•23 years ago
|
||
r=valeski on the mIndex line change.
Comment 5•23 years ago
|
||
sr=rpotts
Assignee | ||
Comment 6•23 years ago
|
||
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 7•23 years ago
|
||
nsSHEnumerator::HasMoreElements()is now working correctly. tested in testEmbed,
Tests.cpp, CTests::SimpleEnumTest(), using 7/9 build.
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•