Closed
Bug 104549
Opened 24 years ago
Closed 21 years ago
Too many duplicate warnings in javascript console on referencing an undefined variable or object property with strict warnings enabled
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: caillon, Unassigned)
References
()
Details
Attachments
(3 files)
Seen on Linux trunk 2001101212-
1. Ensure JS strict warnings are on
2. Clear JS Console
3. Click on the URL above
Expected results in the JS Console:
Warning: reference to undefined property document.all
Actual:
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
Warning: reference to undefined property document.all
It's always displayed 14X. Doesn't matter which object you pass alert(); if the
property you passed is undefined, you get 14 warnings.
Updated•24 years ago
|
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → mozilla1.1
Comment 1•24 years ago
|
||
Maybe I got the answer in the WDF-DOM mailing list. It appears we throw an alert
for each letter of the string
"[object Object]"
Any idea why people?
Comment 2•24 years ago
|
||
*** Bug 111686 has been marked as a duplicate of this bug. ***
Comment 3•24 years ago
|
||
See also testcase for an HTML document
http://bugzilla.mozilla.org/showattachment.cgi?attach_id=59023
We really are calling js_GetProperty 15 times, but only when strict mode is
enabled (a "printf proof").
We get into some goofy state where js_GetPropery ultimately calls
NS_ScriptErrorReporter, which wants to fire an event which needs to
js_GetProperty again, which wants to call NS_ScriptErrorReporter
(or something like that).
Comment 4•24 years ago
|
||
Reporter | ||
Comment 5•24 years ago
|
||
Not that it matters too much, but I count 13 each of blarfs and snarfs in jrgm's
testcase, and 14 alls from the URL.
Summary: Warning: Too Many Warnings! calling alert() with an undefined object property → Warning: Too Many Warnings! referencing an undefined object property with JS strict warnings enabled
http://wickline.org/mozilla/2001120100/
another example case, originally for bug 113078
Comment 7•24 years ago
|
||
*** Bug 113078 has been marked as a duplicate of this bug. ***
Comment 8•24 years ago
|
||
jrgm, if that's the case, why aren't we getting a crash or something like that
because of recursive function calls? Why exactly 13 warnings for each error?
Comment 9•24 years ago
|
||
Incidentally, this bug and bug 81279 combine to generate a sizable performance
hit. The sooner we get either one of these two bugs fixed, the better.
Comment 10•24 years ago
|
||
I think I already gave the reason in my comment #1, but I never got around to
figure out why it is doing that.
Updated•24 years ago
|
Summary: Warning: Too Many Warnings! referencing an undefined object property with JS strict warnings enabled → Warning: Too Many Warnings! referencing an undefined object property with JavaScript strict warnings enabled
Comment 11•24 years ago
|
||
In my experience, this error also shows up for XUL documents, and for *any*
"reference to undefined variable" error, which makes using the JS console for
debugging a bit annoying, especially if you're a novice js programmer who hits
this kind of warning often ;)
Changing the subject to include more search-friendly words - I almost gave up
and filed a dupe.
Summary: Warning: Too Many Warnings! referencing an undefined object property with JavaScript strict warnings enabled → duplicate warnings in javascript console on reference of undefined variable or property with strict warnings enabled
Reporter | ||
Comment 12•24 years ago
|
||
sballard: when changing summaries on bugs that have been around a while, please
try not to remove any words from the original bug summary. People who have
queried with certain words may now find their queries are turning up blank.
For example, I query on this bug with "Too Many Warnings" and you've just
removed that. I have no objections to rewording or making additions to any
summary for clarity, but please keep as much of the original summary as possible
to prevent future lectures ;)
Summary: duplicate warnings in javascript console on reference of undefined variable or property with strict warnings enabled → Too many duplicate warnings in javascript console on referencing an undefined variable or object property with strict warnings enabled
Comment 13•24 years ago
|
||
Sorry! I should have thought of that. I was worried that the summary was getting
excessively long already and the words "too many" seemed redundant; didn't occur
to me that people might already know the bug by those words.
![]() |
||
Comment 14•24 years ago
|
||
*** Bug 122250 has been marked as a duplicate of this bug. ***
Comment 15•24 years ago
|
||
cc'ing Bob from the duplicate bug -
Comment 16•24 years ago
|
||
Comment 17•24 years ago
|
||
I'm not sure I'd call that "reduced" compared to the testcase that's already in
the URL of this bug :)
Comment 18•24 years ago
|
||
Oops! Missed that.
Comment 19•23 years ago
|
||
*** Bug 138694 has been marked as a duplicate of this bug. ***
Comment 20•23 years ago
|
||
I think this bug is so heavy...
because many pages use "if(document.all),if(document.layer),etc... ".
When use these width setTimeout or setInterval, ...like freez.
Comment 21•23 years ago
|
||
Increasing severity to major. This hits anyone who is trying to
debug their scripts via the JS Console. Also see Comment #20 -
Severity: normal → major
Updated•23 years ago
|
Target Milestone: mozilla1.1alpha → ---
Comment 22•22 years ago
|
||
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Status: ASSIGNED → NEW
![]() |
||
Comment 23•22 years ago
|
||
*** Bug 214611 has been marked as a duplicate of this bug. ***
Comment 24•22 years ago
|
||
Shouldn't this have Component "JavaScript Console"? I searched before filing the
dupe, but couldn't imagine it would live in another component.
And FWIW, I'm getting exactly *12* warnings.
It may be of interest that this code:
<script>
var x;
self.undefinedProperty;
</script>
yields 11 warnings for "QueryInterface" + 1 warning for "undefinedProperty"
(current Linux nightly, not in 1.4). This is because of |var x| and has not this
special behavior when used in
data:text/html,<script>var x; self.undefinedProperty;</script>
I will attach it as testcase.
Comment 25•22 years ago
|
||
Comment 26•22 years ago
|
||
Hmm, the special behavior with QueryInterface does not show up in the testcase,
but it does when I view it as a local file.
Comment 27•22 years ago
|
||
Ignore comment 26. I tested with Mozilla 1.4 by accident.
Comment 28•22 years ago
|
||
http://lxr.mozilla.org/mozilla/source/dom/src/base/nsJSEnvironment.cpp#139 :
181 static PRInt32 errorDepth; // Recursion prevention
182 errorDepth++;
183
184 nsCOMPtr<nsIPresContext> presContext;
185 docShell->GetPresContext(getter_AddRefs(presContext));
186
187 if(presContext && errorDepth < 2) {
188 nsScriptErrorEvent errorevent;
189 errorevent.eventStructType = NS_EVENT;
190 errorevent.message = NS_SCRIPT_ERROR;
191
192 errorevent.fileName = fileName.get();
193 errorevent.errorMsg = msg.get();
194 errorevent.lineNr = report ? report->lineno : 0;
195
196 // HandleDOMEvent() must be synchronous for the recursion block
197 // (errorDepth) to work.
198 globalObject->HandleDOMEvent(presContext, &errorevent, nsnull,
199 NS_EVENT_FLAG_INIT, &status);
200 }
201
202 errorDepth--;
Is this the problem? Is HandleDOMEvent() actually synchronous? Is a static
variable guaranteed to be 0 initially?
Comment 29•22 years ago
|
||
*** Bug 219957 has been marked as a duplicate of this bug. ***
Comment 30•22 years ago
|
||
> Is HandleDOMEvent() actually synchronous? Is a static variable guaranteed to be
> 0 initially?
Yes and yes.
/be
Comment 31•22 years ago
|
||
WFM with a current nightly build.
See also http://bugzilla.mozilla.org/show_bug.cgi?id=220603#c22.
![]() |
||
Comment 32•21 years ago
|
||
This does indeed seem to be fixed by the bug 220603 changes....
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
Comment 33•21 years ago
|
||
I no longer see the problem since using Mozilla 1.6.
You need to log in
before you can comment on or make changes to this bug.
Description
•