nsTextEditorState.h should include nsString.h

RESOLVED FIXED in mozilla8

Status

()

Core
Layout: Form Controls
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: arno renevier, Assigned: arno renevier)

Tracking

unspecified
mozilla8
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

6 years ago
Hi,
When trying to include nsTextEditorState.h in a file which does not include (directly or indirectly nsString.h), compilation fails:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:269:13: error: ‘nsCString’ was not declared in this scope
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:269:22: error: template argument 1 is invalid
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:271:11: error: ‘nsString’ does not name a type
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h: In member function ‘void nsTextEditorState::EmptyValue()’:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:163:41: error: base operand of ‘->’ is not a pointer
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h: In member function ‘PRBool nsTextEditorState::IsEmpty() const’:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:164:50: error: base operand of ‘->’ is not a pointer
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h: In member function ‘void nsTextEditorState::ClearValueCache()’:
/home/arno/mozilla/content/html/content/src/nsTextEditorState.h:213:28: error: ‘mCachedValue’ was not declared in this scope
(Assignee)

Comment 1

6 years ago
Created attachment 551043 [details] [diff] [review]
patch
Assignee: nobody → arno
Status: NEW → ASSIGNED
Attachment #551043 - Flags: review?(ehsan)
A good practice that helps avoid problems of this sort is to make each class-specific .h file the first #include in its .cpp file.  In other words, if nsTextEditorState.h were the first #include in nsTextEditorState.cpp, this wouldn't have happened.
(Assignee)

Comment 3

6 years ago
Created attachment 551105 [details] [diff] [review]
updated patch: make nsTextEditorState.h first include of nsTextEditorState.cpp
Attachment #551043 - Attachment is obsolete: true
Attachment #551043 - Flags: review?(ehsan)
Attachment #551105 - Flags: review?(ehsan)
Attachment #551105 - Flags: review?(ehsan) → review+
Landed the patch on mozilla-inbound.  Thanks for writing the patch!
http://hg.mozilla.org/mozilla-central/rev/d7db60b35edc
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.