Open Bug 150337 Opened 22 years ago Updated 3 years ago

[FIX] Previous button doubles factor

Categories

(SeaMonkey :: Search, defect)

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: mmcguigan, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020605
BuildID:    2002060511

Previous button doubles factor and sends user back two pages in results instead
of the previous results page.

Reproducible: Always
Steps to Reproduce:
1.Use any search plugin that has both the Next and Previous buttons enabled
using a factor.  Most of them use a factor.
2.Search for something that will return several pages of results.
3.Use the Next button to go forward more than one page in the results.
4.Use the Previous button.

Actual Results:  Using Previous button displays the results from the page prior
to the previous page.

Expected Results:  Previous button should go back one page in the results.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This problem of moving double the factor when pressing the previous button 
should probably be listed as a seperate bug, but I believe I've found it's 
cause.

The "showMoreResults" function in search-panel.js:

http://lxr.mozilla.org/seamonkey/source/xpfe/components/search/resources/search-
panel.js#996

And the "computeIndex" function in nsInternetSearchService.cpp:
http://lxr.mozilla.org/seamonkey/source/xpfe/components/search/src/nsInternetSea
rchService.cpp#4482

Both decrement the "page" index by one when hitting "previous". "page" is then 
multiplied by "factor".

This side-effect of computeIndex is well-hidden by the fact that computeIndex 
is called via "getInputs" in InternetSearchService.cpp (line 4475). getInputs 
is called by "GetInternetSearchURL" in InternetSearchService.cpp, which is the 
function that is called from search-panel.js.

getInputs doesn't increment the page number when asked for the _next_ index, so 
it is somewhat inconsistent. Either the SearchService or the search-panel 
should be responsible for tracking the current index, not both.

Anyways, that's my interpretation of that oddity. It can be solved by removing 
lines 4659 to 4664 in nsInternetSearchService.cpp, but there might be other 
things that rely on this side-effect. It can also be solved by removing lines1 
011 and 1012 in search-panel.js, but that would probably be bad "practice" to 
rely on an undocumented side-effect of a function buried three calls deep.

Sam
Depends on: 172122
Blocks: 172122
No longer depends on: 172122
I have found independently the same solution as Sam Schinke.
The page number is incrementing and decrementing in search-panel.js, so the
other decrementing of page in nsInternetSearchService.cpp is wrong.

I have looked for any possible interferences and there is no problem.
Adding a patch. Can someone review it?
Comment on attachment 127433 [details] [diff] [review]
patch removing wrong page decreasing

Samir, can you please review this attachment?
Attachment #127433 - Flags: review?(sgehani)
Blocks: 123569
Summary: Previous button doubles factor. → [FIX] Previous button doubles factor
Removing blocking 123569 since this bug has not been pushed out or futured.
Let's wait for Samirs review and try to get a super-review first.
No longer blocks: 123569
Attached patch remove incorrect page decreasing (obsolete) — Splinter Review
The same patch as attachment 127433 [details] [diff] [review], but better formed and make against actual
file version in CVS.
Attachment #127433 - Attachment is obsolete: true
Attachment #137570 - Flags: review?(sgehani)
Attached patch patch (obsolete) — Splinter Review
Update to the previous patch which appears to have bit rotten. Thanks.
Attachment #137570 - Attachment is obsolete: true
Attachment #174554 - Flags: superreview?(alecf)
Attachment #174554 - Flags: review?(caillon)
I have included this patch in the patch for bug 150333 since they both affect
the same file and are both simple patches.
Attached patch patchSplinter Review
This removes the page decrement as the earlier patch did and also removes the
direction arg which was used for the decrement and is no longer needed. I
checked lxr for other consumers and did not find any.
Assignee: samir_bugzilla → moz_bugzilla
Attachment #174554 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #174866 - Flags: superreview?(alecf)
Attachment #174866 - Flags: review?(caillon)
Attachment #174554 - Flags: superreview?(alecf)
Attachment #174554 - Flags: review?(caillon)
*** Bug 285539 has been marked as a duplicate of this bug. ***
Comment on attachment 127433 [details] [diff] [review]
patch removing wrong page decreasing

clearing stale requests
Attachment #127433 - Flags: review?(samir_bugzilla)
Attachment #137570 - Flags: review?(samir_bugzilla)
Attachment #174866 - Flags: superreview?(alecf) → superreview+
Attachment #174866 - Flags: review?(caillon) → review+
Assignee: rob_strong → search
Status: ASSIGNED → NEW
QA Contact: claudius
Product: Core → SeaMonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: