Closed Bug 238928 Opened 20 years ago Closed 20 years ago

domstubs.idl should not include nsAString.h

Categories

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

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: mpgritti, Assigned: mpgritti)

Details

Attachments

(2 files)

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.
This makes the frozen DOM interfaces unusable with the SDK.
Flags: blocking1.7?
Is the Truncate () necessary ?

nsTSubstring SetIsVoid (PR_TRUE) method seem to be doing it already
http://lxr.mozilla.org/mozilla/source/xpcom/string/src/nsTSubstring.cpp#485

Also there is similar SetToNull code without the Truncate () call
http://lxr.mozilla.org/mozilla/source/extensions/webservices/soap/src/nsSOAPUtils.h#175

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.
The disadvantage to using the string API directly is that it's not frozen so we
don't guarantee binary compatibility.
The easiest solution is probably to move these helpers elsewhere, into something
not included by frozen headers.
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).
I did not use nsDOMUtils.h because there is a file with the same name in
extensions/
Attachment #145028 - Flags: superreview?(jst)
Attachment #145028 - Flags: review?(bsmedberg)
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...
Attachment #145028 - Flags: superreview?(jst) → superreview+
Attachment #145028 - Flags: review?(bsmedberg)
Attachment #145028 - Flags: review+
Attachment #145028 - Flags: approval1.7?
fixed-on-trunk for 1.7 final
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Flags: blocking1.7?
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
V. based on code inspection.
Assignee: general → mpgritti
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.