Closed
Bug 117827
Opened 23 years ago
Closed 23 years ago
javascript function defined in a .js file is not defined in the .html file
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
WORKSFORME
People
(Reporter: wear, Assigned: rogerl)
Details
(Keywords: regression, testcase)
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.7+) Gecko/20011226
BuildID: 2001122603,200122703,2002010103
When calling a function which is defined in a javascript file which is loaded by
doing <SCRIPT LANGUAGE="JavaScript" SRC="./lib/file.js"></SCRIPT> in the header
of the html file, I get the following error "function is not defined". This
code works in IE and Mozilla build 2001122203 and earlier.
Reproducible: Always
Steps to Reproduce:
1. Put sample jsbug.html code on server (or in a directory) and .js file in lib
subdirectory.
2. open JavaScript Console to see the error.
3. Open jsbug.html
Actual Results: In the JavaScript Console, I get the following error "setfocus
is not defined".
Expected Results: Set focus to the second field in the form.
jsbug.html
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" SRC="./lib/jsbug.js"></SCRIPT>
</head>
<body ONLOAD="setfocus(document.myform.password);">
<form name="myform">
<input type=text name="name">
<input type=password name="password">
</body>
</html>
lib/jsbug.js
function setfocus(field)
{
field.focus();
}
This is my first bug report. Please, forgive any mistakes.
Reporter | ||
Comment 1•23 years ago
|
||
Sorry, this was not checked with 2001122203, it was checked and worked in
2001122003.
Updated•23 years ago
|
Keywords: regression,
testcase
Comment 2•23 years ago
|
||
Keith, thank you for this well-written report. However, I do not see
this bug with any WinNT binary I try: 2001121209
2001122709
2002010206
In each case, I follow the steps to reproduce, and the page loads
with focus on the second field, exactly as desired. I also see no
errors in the JavaScript Console.
cc'ing Boris, Fabian - do you see this bug? Could it possibly be related
to some preference setting? Keith, what happens if you create a new Profile?
Does the bug still occur?
Comment 3•23 years ago
|
||
I should note, I am only testing this in a local directory, not on a server.
Comment 4•23 years ago
|
||
I think this problem can be seen for example at url
<http://www.helsinginsanomat.fi/tuoreet/juttu.asp?id=20020103OL16>. See
javascript console errors and html source of this page.
I'm now using build 2001123008 on WinNT.
Reporter | ||
Comment 5•23 years ago
|
||
Creating a new profile fixed this. Why? (basically a rhetorical question, but
if anyone knows the answer, I'd like to know)
Comment 6•23 years ago
|
||
Keith: thanks. Based on your report, resolving this bug as WORKSFORME,
since there is no bug in JS Engine here.
To answer your question: I'm hoping that there is some difference
in the user preferences in your old profile vs. your new profile
that will explain this. We recently added a new preference option
in builds after December 30, I believe:
Edit > Preferences > Advanced > Scripts and Windows
Perhaps here, or somewhere else, some JavaScript functionality
was restricted? Or perhaps some Security setting got set which
prevented the external JS file from loading?
Here is a way you can check that. Using the bad profile, load
Mozilla to some random page. Then load the JavaScript Debugger
(Tasks > Tools > JavaScript Debugger). Then in Mozilla, load your
testcase. Now look in the JavaScript Debugger, in the upper-left
pane. Do you see that your external JS file got loaded?
Finally, if you know how to use command-line diff functions,
you can try to diff the "prefs.js" files in the new profile you made
vs. the old profile. Here is a sample path on my own WinNT box:
"C:\WINNT\Profiles\pschwartau\Application Data\Mozilla\Profiles\Default
User\wtu4q9hf.slt\prefs.js"
You should now have two separate profiles in the Profiles directory.
Diffing one against the other might show the setting that got changed -
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
Comment 7•23 years ago
|
||
Marking Verified.
Keith, thank you for this report. If you find the setting that got
changed between the two profiles, please let us know, thanks -
Status: RESOLVED → VERIFIED
Comment 8•23 years ago
|
||
Correction: if you use the JavaScript Debugger to see if your external
JS file gets loaded, its the MID-left pane that would show it, not the
upper-left pane.
Comment 9•23 years ago
|
||
This happened to me as well this morning (build ID 2001122803). I can confirm
that the JS debugger did not have the included JS listed in its source list.
Naturally, however, I replaced my profile to get things working again, instead
of just creating a new one, so I can't run any 'diffs' on the preferences files.
(sigh.)
Comment 10•23 years ago
|
||
The problem seems to be in the profiles cache files. See bug 118404 for details.
You need to log in
before you can comment on or make changes to this bug.
Description
•