Closed Bug 384507 Opened 17 years ago Closed 17 years ago

nsContentSink.h contains static non-member functions and globals.

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jst, Assigned: sayrer)

Details

Attachments

(1 file, 1 obsolete file)

Bug 340554 added:

static nsIAtom** const kDefaultAllowedTags [] ...
static nsIAtom** const kDefaultAllowedAttributes [] ...

and

static
PRBool IsAttrURI(nsIAtom *aName)
{
  ...
}

to nsContentSink.h. That means that every file that includes nsContentSink.h gets its own copy of those globals and that function. The linker *may* be smart enough to eliminate the duplicates, but we really don't want those there.

The function could be a non-static inline function, or a non-static function defined elsewhere, and the globals should also be elsewhere (read nsContentSink.cpp), and the header file should only have extern declarations of the above.

Robert, since you introduced this, I'm giving you this bug :)
Whiteboard: [wanted-1.9]
Attached patch like so? (obsolete) — Splinter Review
Attachment #268836 - Flags: superreview?(jst)
Attachment #268836 - Flags: review?(jst)
Attachment #268836 - Attachment is patch: true
Attachment #268836 - Attachment mime type: text/x-patch → text/plain
Comment on attachment 268836 [details] [diff] [review]
like so?

+extern nsIAtom** const kDefaultAllowedTags [74];
+extern nsIAtom** const kDefaultAllowedAttributes [76];

The size of the arrays shouldn't need to be declared here, I'd hate to have to keep those in sync with the actual lists. How about loosing the size declarations and the code that depends on it, and null terminating the lists instead?

r- based on that, but if that's not an option I could be swayed the other way :)
Attachment #268836 - Flags: superreview?(jst)
Attachment #268836 - Flags: superreview-
Attachment #268836 - Flags: review?(jst)
Attachment #268836 - Flags: review-
Attached patch null terminateSplinter Review
Attachment #268836 - Attachment is obsolete: true
Attachment #268860 - Flags: superreview?
Attachment #268860 - Flags: review?
Attachment #268860 - Flags: superreview?(jst)
Attachment #268860 - Flags: superreview?
Attachment #268860 - Flags: review?(jst)
Attachment #268860 - Flags: review?
Comment on attachment 268860 [details] [diff] [review]
null terminate

+nsIAtom** const kDefaultAllowedTags [] = {
+  &nsGkAtoms::a,
+  &nsGkAtoms::abbr,
[...]
+  &nsGkAtoms::var,
+  '\0'
+};

Use nsnull instead of '\0' here, and in kDefaultAllowedAttributes.

r+sr=jst
Attachment #268860 - Flags: superreview?(jst)
Attachment #268860 - Flags: superreview+
Attachment #268860 - Flags: review?(jst)
Attachment #268860 - Flags: review+
Checked in. This did reduce codesize.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
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: