Closed Bug 273518 Opened 20 years ago Closed 20 years ago

Home button displays wrong content pack, and defaultTopic is hardcoded

Categories

(SeaMonkey :: Help Viewer, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: rod.whiteley, Assigned: steffen.wilberg)

Details

Attachments

(1 file, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 The help viewer opens a separate window for each content pack. So Firefox help has its own window, and any other content pack has its own window. But the Home button always displays Firefox help, even in a different content pack's window. Reproducible: Always Steps to Reproduce: 1. Display a content pack other than Firefox help. 2. Press the Home button. Actual Results: The topic "Welcome to Mozilla Firefox Help" is displayed. Expected Results: The default topic specified in the content pack's master help file should be displayed. This happens because help.js contains a goHome function where the home page URI is hard coded instead of being looked up by topic.
Indeed. Confirming and taking.
Assignee: jwalden+fxhelp → steffen.wilberg
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 98 → All
Hardware: PC → All
Status: NEW → ASSIGNED
Attached patch patch (obsolete) — Splinter Review
use displayTopic(defaultTopic) instead of loadURI("chrome://help/locale/firefox_welcome.xhtml"). While experimenting with defaultTopic, I found another (hidden) bug: defaultTopic was const'ed to "use-help". This is both wrong and unnecessary. The topic is either set 1. in the openHelp() call (like in helpMenuOverlay.xul), passed as an argument to the Help window and evaluated in init(), 2. in nc:defaulttopic in the content pack (e.g. firebirdhelp.rdf), evaluated in loadHelpRDF(), 3. "welcome" as a fallback, specified in loadHelpRDF() as well; displayTopic() then uses the defaultTopic because topic is null.
One problem. What was supposed to happen is that helpTopic is defined by the value taken in when showHelp() was called, and if it is not defined then we use the content pack default. You are currently overriding any possible function value. I'd remove line 136 and modify contextHelp.js to not take in a parameter for a topic (which would be the best thing to do IMO then making a hack around it).
showHelp? You probably mean openHelp? I don't understand you. openHelp() still opens the welcome page, and openHelp("cookies") still opens cookies.xhtml. And I still need openHelp(topic) to work because of bug 260054 (add Help buttons to some dialogs).
(In reply to comment #4) > showHelp? You probably mean openHelp? > I don't understand you. openHelp() still opens the welcome page, and > openHelp("cookies") still opens cookies.xhtml. > > And I still need openHelp(topic) to work because of bug 260054 (add Help buttons > to some dialogs). oh wait, getting my variables mixed up :). We need some documentation in help because reviewing this patch is way more of a pain then it should be. From first glance it looks like helpTopic will be null, but all the functions set things in line when they check for it and will end up using defaultTopic when helpTopic is null. Totally forgot that it did that. Sorry! It's all good! Error on my part. We should really throw a comment in somewhere noting that if helpTopic is null then defaultTopic is used.
Attached patch also document a bit (obsolete) — Splinter Review
I agree, writing the patch was a bit of an advventure. So I've added a comment based on comment 2.
Attachment #168143 - Attachment is obsolete: true
It's even clearer with the original var helpTopic = defaultTopic;.
Attachment #168168 - Attachment is obsolete: true
In your patch, why not use preprocessor comments (# comments instead of // or /**/)? It'll save a couple of bytes from the final JS file and will keep consistency with the rest of the file.
- help.js is not at all consistent in its comment style. - I don't like #-style comments that much since they make line numbers in the js console pretty useless. - My Editor doesn't recognize the #-style and colors the commments. - browser.js only use //-style comments. Over 600 of them.
Comment on attachment 168170 [details] [diff] [review] stay with var helpTopic = defaultTopic; OK, sounds good. r=rlk@trfnev.com
Attachment #168170 - Flags: review+
Comment on attachment 168170 [details] [diff] [review] stay with var helpTopic = defaultTopic; r=me for checkin to toolkit As a note, prevailing style throughout Firefox and toolkit UI code is to use gDefaultTopic instead of defaultTopic for global vars, it makes code a LOT easier to follow. Obviously that isn't the case in Help code right now, but going forward changing to that style is probably going to be expected/helpful.
Summary: Home button displays wrong content pack → Home button displays wrong content pack, and defaultTopic is hardcoded
Checking in mozilla/toolkit/components/help/content/help.js; /cvsroot/mozilla/toolkit/components/help/content/help.js,v <-- help.js new revision: 1.17; previous revision: 1.16 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox1.1
Flags: review+
Product: Firefox → Toolkit
Target Milestone: Firefox1.1 → ---
Targetting bugs which were targetted to Firefox1.1 before the move to mozilla1.8beta2.
Target Milestone: --- → mozilla1.8beta2
Flags: in-testsuite?
Product: Toolkit → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: