Closed Bug 966385 Opened 10 years ago Closed 10 years ago

xhr gives Warning: Use of inputEncoding is deprecated

Categories

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

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: rkent, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

See also bug 860312 and bug 801545

My ExQuilla addon for Thunderbird, that uses XHR extensively, generates these junk warnings constantly:

"Warning: Use of inputEncoding is deprecated"

This warning originates in nsDocument.cpp GetInputEncoding, which in turn is called from nsXMLHttpRequest.cpp GetRequestBody

As far as I can tell, this error occurs whenever XHR is used to send a request, with no way to suppress it. My users complain about seeing this warning in the Error Console.

It seems to me that core code should not be generating an error message on the console that other core code routinely causes. Can't we remove that warning message until the core code is fixed, or at least have it only appear in debug mode?
Ms2ger, you added the warning here.  What's the right replacement for inputEncoding here?

> with no way to suppress it

At least not as long as you're passing a document object as an argument to send(), yeah...
Blocks: 688190
Flags: needinfo?(Ms2ger)
(In reply to Boris Zbarsky [:bz] from comment #1)
> 
> > with no way to suppress it
> 
> At least not as long as you're passing a document object as an argument to
> send(), yeah...

Thanks for the hint. If I serialize the DOM object before passing to XHR.send I can get rid of the junk warning. I'll do that.

It must not be that common to pass a DOM document to send, because when I google for the error message, my addon appears in the top page (Assuming that I correctly convinced google to give me generic and not personalized results).
GetCharacterSet?
Flags: needinfo?(Ms2ger)
Though per spec, I think we should always be using UTF-8 here... I don't see an existing bug on that, though.
Attachment #8529529 - Flags: review?(peterv)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8529529 [details] [diff] [review]
Stop using the deprecated GetInputEncoding in XHR code

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

::: dom/base/nsXMLHttpRequest.cpp
@@ +2402,5 @@
>  {
>    aContentType.AssignLiteral("application/xml");
> +  nsAutoString charset;
> +  aDoc->GetCharacterSet(charset);
> +  CopyUTF16toUTF8(charset, aCharset);

Or |aCharset = aDoc->GetDocumentCharacterSet();|?
Attachment #8529529 - Flags: review?(peterv) → review+
Did that and https://hg.mozilla.org/integration/mozilla-inbound/rev/fcc020cf3afe
Target Milestone: --- → mozilla37
Except of course aDoc is an nsIDOMDocument.  Added a QI: https://hg.mozilla.org/integration/mozilla-inbound/rev/458fbb343a6d
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: