Status

()

Core
DOM: Core & HTML
VERIFIED FIXED
18 years ago
18 years ago

People

(Reporter: Henrik Gemal, Assigned: jst)

Tracking

Trunk
mozilla0.8
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [HAVE FIX])

(Reporter)

Description

18 years ago
I'm not sure this is a bug or not, but if you have js strict option on and 
encounter a strict warning you'll get in the console:

JavaScript strict warning:
http://blablabla.blabla/ line 548: assignment to undeclared variable itag
Error was suppressed by event handler

Should it say:
Warning was suppressed by event handler or should it say nothing at all, since 
it's only a warning?

Comment 1

18 years ago
cc'ing Brendan for his opinion on this -
jst, can you just add a test !(report->flags & JSREPORT_WARNING) to the
condition around line 171 of dom/src/base/nsJSEnvironment.cpp?

/be
Assignee: rogerl → jst

Comment 3

18 years ago
Setting default component -
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
(Assignee)

Comment 4

18 years ago
Brendan, how about this in stead?

Index: dom/src/base/nsJSEnvironment.cpp
===================================================================
RCS file: /cvsroot/mozilla/dom/src/base/nsJSEnvironment.cpp,v
retrieving revision 1.122
diff -u -r1.122 nsJSEnvironment.cpp
--- nsJSEnvironment.cpp 2000/12/07 02:08:21     1.122
+++ nsJSEnvironment.cpp 2000/12/25 00:20:39
@@ -96,7 +96,7 @@
       //send error event first, then proceed
       nsCOMPtr<nsIDocShell> docShell;
       globalObject->GetDocShell(getter_AddRefs(docShell));
-      if (docShell) {
+      if (docShell && !JSREPORT_IS_STRICT(report->flags)) {
         static PRInt32 errorDepth = 0; // Recursion prevention
         errorDepth++;

This makes mozilla *not* call the onerror handler at all for strict warnings,
which IMO is the right thing to do, also see bug 63672 (also fixed by the above
patch).
Status: NEW → ASSIGNED
The issue isn't just strictness.  If I set javascript.options.werror, I want all
warnings (strict or not) to be treated as errors, which then must be handled by
onerror.  So I think you want JSREPORT_IS_WARNING, not JSREPORT_IS_STRICT (and
thanks for reminding me about those macros -- wonder why they don't take a
reportp arg instead of report->flags -- cc'ing mccabe).

/be
(Assignee)

Comment 6

18 years ago
Brendan, sr=? Pollmann sez r=pollmann.

Index: dom/src/base/nsJSEnvironment.cpp
===================================================================
RCS file: /cvsroot/mozilla/dom/src/base/nsJSEnvironment.cpp,v
retrieving revision 1.126
diff -u -r1.126 nsJSEnvironment.cpp
--- nsJSEnvironment.cpp 2001/02/02 06:05:17     1.126
+++ nsJSEnvironment.cpp 2001/02/02 06:53:26
@@ -180,7 +180,7 @@
   error.AppendWithConversion(": ");
   error.Append(NS_REINTERPRET_CAST(const PRUnichar*, report->ucmessage));
   error.AppendWithConversion("\n");
-  if (status != nsEventStatus_eIgnore)
+  if (status != nsEventStatus_eIgnore && !JSREPORT_IS_WARNING(report->flags))
     error.AppendWithConversion("Error was suppressed by event handler\n");

   char *errorStr = error.ToNewCString();
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.8
(Assignee)

Comment 8

18 years ago
Fix checked in.
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 9

18 years ago
Verified with 2001-02-06-08-Mtrunk
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.