author | Masatoshi Kimura <VYV03354@nifty.ne.jp> |
Wed, 24 Oct 2012 22:03:21 -0400 | |
changeset 111319 | 05636b372638e8effb4f486fdfe87a6322e664ca |
parent 111318 | b448aae5a5d4d6b6ba779a7b4ebfc200d8e35511 |
child 111320 | acbfd1eebb3bdabb5f02a83f67dfe66a49938c6a |
push id | 17007 |
push user | ryanvm@gmail.com |
push date | Thu, 25 Oct 2012 02:03:26 +0000 |
treeherder | mozilla-inbound@05636b372638 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sicking |
bugs | 801487 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/encoding/TextEncoder.cpp +++ b/dom/encoding/TextEncoder.cpp @@ -7,28 +7,21 @@ #include "nsContentUtils.h" #include "nsICharsetConverterManager.h" #include "nsServiceManagerUtils.h" namespace mozilla { namespace dom { void -TextEncoder::Init(const Optional<nsAString>& aEncoding, +TextEncoder::Init(const nsAString& aEncoding, ErrorResult& aRv) { - // If the constructor is called with no arguments, let label be the "utf-8". - // Otherwise, let label be the value of the encoding argument. - nsAutoString label; - if (!aEncoding.WasPassed()) { - label.AssignLiteral("utf-8"); - } else { - label.Assign(aEncoding.Value()); - EncodingUtils::TrimSpaceCharacters(label); - } + nsAutoString label(aEncoding); + EncodingUtils::TrimSpaceCharacters(label); // Run the steps to get an encoding from Encoding. if (!EncodingUtils::FindEncodingForLabel(label, mEncoding)) { // If the steps result in failure, // throw an "EncodingError" exception and terminate these steps. aRv.Throw(NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR); return; }
--- a/dom/encoding/TextEncoder.h +++ b/dom/encoding/TextEncoder.h @@ -23,17 +23,17 @@ class TextEncoder : public nsISupports, { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextEncoder) // The WebIDL constructor. static already_AddRefed<TextEncoder> Constructor(nsISupports* aGlobal, - const Optional<nsAString>& aEncoding, + const nsAString& aEncoding, ErrorResult& aRv) { nsRefPtr<TextEncoder> txtEncoder = new TextEncoder(aGlobal); txtEncoder->Init(aEncoding, aRv); if (aRv.Failed()) { return nullptr; } return txtEncoder.forget(); @@ -93,16 +93,16 @@ private: * Validates provided encoding and throws an exception if invalid encoding. * If no encoding is provided then mEncoding is default initialised to "utf-8". * * @param aEncoding Optional encoding (case insensitive) provided. * (valid values are "utf-8", "utf-16", "utf-16be") * Default value is "utf-8" if no encoding is provided. * @return aRv EncodingError exception else null. */ - void Init(const Optional<nsAString>& aEncoding, + void Init(const nsAString& aEncoding, ErrorResult& aRv); }; } // dom } // mozilla #endif // mozilla_dom_textencoder_h_
--- a/dom/webidl/TextDecoder.webidl +++ b/dom/webidl/TextDecoder.webidl @@ -1,27 +1,25 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * * The origin of this IDL file is - * http://wiki.whatwg.org/wiki/StringEncoding + * http://encoding.spec.whatwg.org/#interface-textdecoder * - * Copyright © 2006 The WHATWG Contributors - * http://wiki.whatwg.org/wiki/WHATWG_Wiki:Copyrights + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ -[Constructor(optional DOMString encoding = "utf-8", - optional TextDecoderOptions options)] +[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options)] interface TextDecoder { [SetterThrows] readonly attribute DOMString encoding; [Throws] - DOMString decode(optional ArrayBufferView? view = null, - optional TextDecodeOptions options); + DOMString decode(optional ArrayBufferView? input = null, optional TextDecodeOptions options); }; dictionary TextDecoderOptions { boolean fatal = false; }; dictionary TextDecodeOptions { boolean stream = false;
--- a/dom/webidl/TextEncoder.webidl +++ b/dom/webidl/TextEncoder.webidl @@ -1,23 +1,23 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * * The origin of this IDL file is - * http://wiki.whatwg.org/wiki/StringEncoding + * http://encoding.spec.whatwg.org/#interface-textencoder * - * Copyright © 2006 The WHATWG Contributors - * http://wiki.whatwg.org/wiki/WHATWG_Wiki:Copyrights + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ -[Constructor(optional DOMString encoding)] +[Constructor(optional DOMString label = "utf-8")] interface TextEncoder { [SetterThrows] readonly attribute DOMString encoding; [Throws] - Uint8Array encode(DOMString? string, optional TextEncodeOptions options); + Uint8Array encode(optional DOMString? input = null, optional TextEncodeOptions options); }; dictionary TextEncodeOptions { boolean stream = false; };