Closed Bug 382621 Opened 17 years ago Closed 17 years ago

don't include /toolkit/components/url-classifier/content/moz/debug.js by default

Categories

(Toolkit :: Safe Browsing, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: zeniko, Assigned: zeniko)

References

Details

Attachments

(1 file, 2 obsolete files)

... or replace it with minimal stubs for non-debug builds.
No longer blocks: 339030
Blocks: 339030
Summary: don't include /toolkit/components/url-classifier/content/moz/debug.js per default → don't include /toolkit/components/url-classifier/content/moz/debug.js by default
For reference: The following method stubs would have to be provided: function G_Debug() { } function G_Assert() { } function G_Error() { } var G_debugService = { __noSuchMethod__: function() { } }; Additionally String.prototype.subs (from moz/lang.js) seems not to be used outside of debug.js and should thus also be moved there and G_AssertEqual can be dropped completely.
Attached patch add only stubs when DEBUG isn't defined (obsolete) (deleted) — Splinter Review
Is this debug component still used at all? If so, we might want to remove all references to G_GDEBUG and instead introduce a new preprocessor symbol for enabling the full debug.js version. Otherwise we might want to go through the code and remove all occurrences of the now stubbed methods. Both to happen in a follow up bug, of course.
Assignee: nobody → zeniko
Status: NEW → ASSIGNED
Attachment #267070 - Flags: review?(tony)
Attachment #267070 - Attachment is obsolete: true
Attachment #267106 - Flags: review?(tony)
Attachment #267070 - Flags: review?(tony)
Attachment #267106 - Flags: review?(tony) → review+
I often set G_GDEBUG to true in nsUrlClassifierLib.js and use the debug service. It would be nice if there were something like pr_log for javascript where you can turn specific classes of debug messages on and off.
I removed the console service listener because it causes crashes.
Attachment #267106 - Attachment is obsolete: true
on trunk Checking in toolkit/components/url-classifier/content/moz/debug.js; /cvsroot/mozilla/toolkit/components/url-classifier/content/moz/debug.js,v <-- debug.js new revision: 1.6; previous revision: 1.5 done Checking in toolkit/components/url-classifier/content/moz/lang.js; /cvsroot/mozilla/toolkit/components/url-classifier/content/moz/lang.js,v <-- lang.js new revision: 1.4; previous revision: 1.3 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Further alternatives coming to mind: (1) use a JavaScript module (the new .jsm thingy) to load debugging stubs - and for real debugging you just have to override the .jsm with the full fledged version; (2) use a pref (e.g. toolkit.url-classifier.debugging) and define the full fledged version or stubs conditional on that (only if DEBUG is defined though). Both would allow to get rid of G_GDEBUG without making life any harder for you. OTOH with the current patch here, most G_GDEBUG instances are ifdef'd out anyway, so we could just as well leave it as is.
The current version can be controlled by prefs, but is also controlled by code (the enabled/disable zone stuff). Some things are enabled by default by the code. So if we wanted to do (2), we could disable all the zones by default and only let prefs turn on the output.
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: