Closed Bug 56621 Opened 25 years ago Closed 24 years ago

LoadInitialPage() fails if no url on cmd line + fix

Categories

(Core Graveyard :: Cmd-line Features, defect, P3)

DEC
OSF/1
defect

Tracking

(Not tracked)

VERIFIED WORKSFORME
Future

People

(Reporter: harbaugh, Assigned: vishy)

References

()

Details

(Keywords: helpwanted)

nsBrowserInstance::LoadInitialPage() fails if no url is specified on the command line. The error displayed is JavaScript error: line 0: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIBrowserInstance.loadInitialPage]" ns result: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://navigator/content/navigator.js :: tryToSetContentWindow :: line 547" data: no] The initial window is empty *AND* any attempt to load a url into it results in the error JavaScript error: chrome://navigator/content/sessionHistoryUI.js line 110: gURLBar has no properties ======== TO FIX: =============== modify line 788 of nsBrowserInstance.cpp to test for a null string in addition to a null value: *** ./xpfe/browser/src/nsBrowserInstance.cpp_orig Fri Oct 6 21:36:43 2000 --- ./xpfe/browser/src/nsBrowserInstance.cpp Fri Oct 13 20:21:37 2000 *************** *** 785,791 **** rv = cmdLineArgs->GetURLToLoad(&urlstr); } ! if (urlstr != nsnull) { // A url was provided. Load it if (APP_DEBUG) printf("Got Command line URL to load %s\n", urlstr); nsString url; url.AssignWithConversion( urlstr ); --- 785,791 ---- rv = cmdLineArgs->GetURLToLoad(&urlstr); } ! if (urlstr != nsnull && nsCRT::strlen((char *)urlstr) > 0) { // A url was provided. Load it if (APP_DEBUG) printf("Got Command line URL to load %s\n", urlstr); nsString url; url.AssignWithConversion( urlstr ); When this is changed, the initial page is loaded successfully and the window is usable (can load subsequent urls) =========== WHY LoadInitialPage FAILS: ================= The call to cmdLineArgs->GetURLToLoad(&urlstr) on line 785 returns a NULL STRING, *NOT* nsnull, when there is no command line url. This happens because GetURLToLoad() calls GetCmdLineValue("-url",...) [line 151 of nsCommandLineService.cpp] and GetCmdLineValue *FINDS* "-url" in the argument list, with a null string as the value [lines 197 & 198 of nsCommandLineService.cpp]
setting bug status to New
Status: UNCONFIRMED → NEW
Ever confirmed: true
adding patch kw...
Keywords: patch
Since Don has left, Vishy is taking his bugs in bulk, pending reassignment. thanks, Vishy
Assignee: don → vishy
Netscape Nav triage team: this is not a Netscape beta stopper.
Marking nsbeta1- bugs as future to get off the radar
Target Milestone: --- → Future
I don't think this bug is valid anymore. Current source has the following: 688 689 if (!urlstr.IsEmpty()) { 690 // A url was provided. Load it 691 if (APP_DEBUG) printf("Got Command line URL to load %s\n", NS_Conv ertUCS2toUTF8(urlstr).get()); urlstr is an "nsAutoString"
marking WORKSFORME since this is no long a problem
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
mass-verifying WorksForMe bugs. reopen only if this bug is still a problem with a *recent trunk build*. mail search string for bugspam: AchilleaMillefolium
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.