Last Comment Bug 238928 - domstubs.idl should not include nsAString.h
: domstubs.idl should not include nsAString.h
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: x86 Linux
: -- normal (vote)
: ---
Assigned To: Marco Pesenti Gritti
: Andrew Overholt [:overholt]
Depends on:
  Show dependency treegraph
Reported: 2004-03-27 12:48 PST by Marco Pesenti Gritti
Modified: 2010-11-13 09:43 PST (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Move the helpers out to nsDOMString.h (14.09 KB, patch)
2004-03-29 10:54 PST, Marco Pesenti Gritti
benjamin: review+
jst: superreview+
dbaron: approval1.7+
Details | Diff | Splinter Review
Updated patch without Truncate() as request by jst (14.06 KB, patch)
2004-03-30 03:22 PST, Marco Pesenti Gritti
no flags Details | Diff | Splinter Review

Description Marco Pesenti Gritti 2004-03-27 12:48:46 PST
As per #238088 nsStringAPI.h and nsAString.h conflicts. nsAString.h should only
be used by files in the mozilla codebase.
Including it in domstubs.idl we make impossible to use nsIDOMXXX and
nsEmbedString contemporarily by embedding applications.
Comment 1 Benjamin Smedberg [:bsmedberg] 2004-03-27 13:00:17 PST
This makes the frozen DOM interfaces unusable with the SDK.
Comment 2 Marco Pesenti Gritti 2004-03-27 17:13:27 PST
Is the Truncate () necessary ?

nsTSubstring SetIsVoid (PR_TRUE) method seem to be doing it already

Also there is similar SetToNull code without the Truncate () call

If so would s/DOMStringIsNull/IsVoid s/SetDOMStringToNull/SetIsVoid(TRUE) be
considered an acceptable solution ? I dont see disadvantages in using the string
api directly but I'm not familiar with either DOM or string code.
Comment 3 David Baron :dbaron: ⌚️UTC-8 2004-03-28 11:02:57 PST
The disadvantage to using the string API directly is that it's not frozen so we
don't guarantee binary compatibility.
Comment 4 David Baron :dbaron: ⌚️UTC-8 2004-03-28 14:18:07 PST
The easiest solution is probably to move these helpers elsewhere, into something
not included by frozen headers.
Comment 5 Marco Pesenti Gritti 2004-03-28 15:13:40 PST
Ok, I looked in the dom headers and I couldnt find any good candidate.
Suggestions are welcome.
Maybe nsDOMUtils.cpp/.h is in order ? (IHMO at that point getting rid of the
helpers and use the aString.IsVoid/SetIsVoid in the mozilla DOM implementation
would be cleaner, at least if Truncate() is redundant).
Comment 6 Marco Pesenti Gritti 2004-03-29 10:54:17 PST
Created attachment 145028 [details] [diff] [review]
Move the helpers out to nsDOMString.h

I did not use nsDOMUtils.h because there is a file with the same name in
Comment 7 Johnny Stenback (:jst, 2004-03-29 15:48:05 PST
Comment on attachment 145028 [details] [diff] [review]
Move the helpers out to nsDOMString.h

+inline void SetDOMStringToNull(nsAString& aString)
+  aString.Truncate();
+  aString.SetIsVoid(PR_TRUE);

Seems like you can remove the call to Truncate(), as you mentioned earlier.

sr=jst for making this change, I'm sure we'll find more helpers to add to this
header file as we move forward...
Comment 8 Marco Pesenti Gritti 2004-03-30 03:22:04 PST
Created attachment 145082 [details] [diff] [review]
Updated patch without Truncate() as request by jst
Comment 9 Darin Fisher 2004-04-01 11:44:44 PST
fixed-on-trunk for 1.7 final
Comment 10 :Ms2ger (⌚ UTC+1/+2) 2010-11-13 09:43:19 PST
V. based on code inspection.

Note You need to log in before you can comment on or make changes to this bug.