Closed Bug 248528 Opened 20 years ago Closed 17 years ago

JS strict warnings should be on (at least for chrome) in debug builds

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 385872

People

(Reporter: dmosedale, Unassigned)

References

Details

Attachments

(3 obsolete files)

In order to help keep the code clean.  There may be some other things that need
to happen first, such as tweaking venkman.
 ------- Bug 249012 Comment #29 From Darin Fisher  2005-02-23 21:01 PST  -------

what would it take to get JS strict warnings enabled by default in debug builds?
 or would that just be too painful?


------- Bug 249012 Comment #30 From Benjamin Smedberg [:bs] (formerly
bsmedberg@covad.net) 2005-02-23 21:11 PST -------

Just an #ifdef in all.js -- very simple, in fact. I don't know the pain level.

We need to change this to true:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/modules/libpref/src/init/all.js&rev=3.567&mark=433#433

But #ifdef DEBUG doesn't work, it's not defined in debug builds. What kind of
Makefile magic is required here?

I'd also suggest to set javascript.options.showInConsole to true in Firefox
debug builds:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/browser/app/profile/firefox.js&rev=1.37&mark=217#217
Have you tried NS_DEBUG ?
NS_DEBUG doesn't work, neither does MOZ_DEBUG.
all-thunderbird.js already has showInConsole set to true. I didn't change Sunbird or others, but I can add those if needed. This patch is untested, but both changed files have other preprocessing instructions in, so I can't think why it wouldn't work.
Assignee: general → DJCater
Status: NEW → ASSIGNED
Attachment #207896 - Flags: superreview?(benjamin)
Attachment #207896 - Flags: review?(benjamin)
I'm really not so sure this is such a hot idea.  Bear in mind there are 20 times as many strict warnings from web pages as there are from chrome.  As we haven't yet fixed the bug to give error reporting more details yet, I can't say this is really worth it at this point.
Comment on attachment 207896 [details] [diff] [review]
Set showInConsole to true for Firefox debug builds and strict to true for all debug builds

I agree with AJ: showInConsole is good, options.strict is not because it makes browsing web content ridiculously painful.
Attachment #207896 - Flags: superreview?(benjamin)
Attachment #207896 - Flags: review?(benjamin)
Attachment #207896 - Flags: review-
Yeah, I've changed my mind too, strict isn't useful really, and produces far too many messages.
Attachment #207896 - Attachment is obsolete: true
Attachment #208020 - Flags: superreview?(benjamin)
Attachment #208020 - Flags: review?(benjamin)
(In reply to comment #8)
> Created an attachment (id=208020) [edit]
> Set showInConsole to true for Firefox debug builds
> 
> Yeah, I've changed my mind too, strict isn't useful really, and produces far
> too many messages.

Maybe we really just want chrome windows (not content windows) to enable the JSOPTION_STRICT option on their JSContexts.  Then no web page JS fluff will be reported as lint.  Why not do that?

/be
Attachment #208020 - Flags: superreview?(benjamin)
Attachment #208020 - Flags: review?(benjamin)
Attachment #208020 - Flags: review+
Thanks benjamin. Why exactly is superreview not needed here? I'm not fully familiar with the process...

Also, can someone check this in for me please?
Oh. I just tested this, and it doesn't appear to work. I'm not sure why, but I guess I should have believed comment 2...

I built a Firefox debug build, went to about:config and looked for javascript.options.showInConsole and it was set to false.
(In reply to comment #9)

> Maybe we really just want chrome windows (not content windows) to enable the
> JSOPTION_STRICT option on their JSContexts.  Then no web page JS fluff will be
> reported as lint.  Why not do that?

This is trivial to do, btw.  Did anyone figure out why the existing code to preset JSOPTION_STRICT #ifdef DEBUG isn't working?

http://lxr.mozilla.org/mozilla/source/dom/src/base/nsJSEnvironment.cpp#695

Perhaps because of the way the pref-changed callback is used to bootstrap itself?

Anyway, see

http://lxr.mozilla.org/mozilla/source/dom/src/base/nsJSEnvironment.cpp#1612

where JSOPTION_XML is set by default for chrome windows.  If we just bitwise-or JSOPTION_STRICT here, no #ifdefs, then that ought to do the trick.  I hope.

/be
Comment on attachment 208020 [details] [diff] [review]
Set showInConsole to true for Firefox debug builds

Benjamin, do you know why comment 11 and the first part of comment 12 are true (#ifdef DEBUG not working in both cases)?
Attachment #208020 - Attachment is obsolete: true
I don't know of a nicer way to do this, since just adding the -DDEBUG=$(MOZ_DEBUG) makes "#ifdef DEBUG" true, regardless of MOZ_DEBUG's value ("" or "1").
Attachment #221935 - Flags: review?(benjamin)
Comment on attachment 221935 [details] [diff] [review]
set showInConsole to true for Firefox debug builds

Actually, I split the showInConsole app setting to bug 337875, since this one is about strict warnings.
Attachment #221935 - Attachment is obsolete: true
Attachment #221935 - Flags: review?(benjamin)
Assignee: DJCater → general
Status: ASSIGNED → NEW
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Bug 383365 is Firefox-specific, this bug wasn't, so not really a dupe.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Blocks: 385872
Given the fix, duping again.
Status: REOPENED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: