The default bug view has changed. See this FAQ.

Make Selection.toString() API use DOMString instead of wstring

RESOLVED FIXED in mozilla16

Status

()

Core
DOM
--
enhancement
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: mats, Assigned: jhk)

Tracking

unspecified
mozilla16
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first bug][mentor=Ms2ger][lang=c++])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

5 years ago
Make Selection.toString() API use DOMString instead of wchar,
per bug 748961 comment 11.

Updated

5 years ago
Whiteboard: [good first bug][mentor=Ms2ger][lang=c++]
Need to change the declarations in

http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelection.idl#165
http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionPrivate.idl#88

to use "DOMString" instead of "wstring", and the implementations in

http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsSelection.cpp#1313

The PRUnichar** arguments should become nsAString& in nsTypedSelection::ToString and nsTypedSelection::ToStringWithFormat.
Summary: Make Selection.toString() API use DOMString instead of wchar → Make Selection.toString() API use DOMString instead of wstring

Comment 2

5 years ago
I'm looking at this bug as an introduction to the mozilla bug tracker and other things, but the PRUnichar** arguments are pointers to that type if im right, so changing them to nsAString& does what? Is that a type?
nsAString& is a writable abstract string type; see <https://developer.mozilla.org/En/Mozilla_internal_string_guide> for more information about it.
(Assignee)

Comment 4

5 years ago
Created attachment 631322 [details] [diff] [review]
Patch(v1)
Attachment #631322 - Flags: feedback?(Ms2ger)
Comment on attachment 631322 [details] [diff] [review]
Patch(v1)

Review of attachment 631322 [details] [diff] [review]:
-----------------------------------------------------------------

This looks great; just a few comments. Can you fix those and ask :smaug to review?

::: content/base/public/nsISelection.idl
@@ +134,5 @@
>  
>      /**
>       * Returns the whole selection into a plain text string.
>       */
> +    DOMString toString();

Update the uuid.

::: layout/generic/nsSelection.cpp
@@ +1094,5 @@
>    // null if the Selection has been disconnected (the shell is Destroyed).
>    nsCOMPtr<nsIPresShell> shell =
>      mFrameSelection ? mFrameSelection->GetShell() : nsnull;
>    if (!shell) {
> +    aReturn = ToNewUnicode(EmptyString());

This should just be 'aReturn.Truncate();' now.

@@ +1145,1 @@
>    return rv;

And these four lines can be 'return encoder->EncodeToString(aReturn);'
Attachment #631322 - Flags: feedback?(Ms2ger) → feedback+
(Assignee)

Comment 6

5 years ago
Created attachment 631333 [details] [diff] [review]
Patch(v2)
Attachment #631322 - Attachment is obsolete: true
Attachment #631333 - Flags: review?(bugs)
Attachment #631333 - Flags: review?(bugs) → review+

Updated

5 years ago
Assignee: nobody → jigneshhk1992
Keywords: checkin-needed
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/34117bad5665
Flags: in-testsuite-
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/34117bad5665
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Ms2ger pushed a follow-up to comm-central fix bustage there as well.
https://hg.mozilla.org/comm-central/rev/1608d7734acb
You need to log in before you can comment on or make changes to this bug.