Bug 1489047 - Remove C++ support for, and testing of, the XPIDL DOMString type. r=nika

--HG--
extra : rebase_source : 21df3192cfff8f9d9254306a5be4f8ad84397eb7
This commit is contained in:
Nicholas Nethercote 2018-09-06 18:03:18 +10:00
Родитель 8478f8d66e
Коммит 0979695a1a
18 изменённых файлов: 18 добавлений и 121 удалений

Просмотреть файл

@ -778,7 +778,6 @@ txMozillaXSLTProcessor::SetParameter(const nsAString& aNamespaceURI,
// String
case nsIDataType::VTYPE_CHAR:
case nsIDataType::VTYPE_WCHAR:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_CHAR_STR:
case nsIDataType::VTYPE_WCHAR_STR:
case nsIDataType::VTYPE_STRING_SIZE_IS:
@ -1357,7 +1356,6 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)
// String
case nsIDataType::VTYPE_CHAR:
case nsIDataType::VTYPE_WCHAR:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_CHAR_STR:
case nsIDataType::VTYPE_WCHAR_STR:
case nsIDataType::VTYPE_STRING_SIZE_IS:

Просмотреть файл

@ -205,9 +205,6 @@ XPCConvert::NativeData2JS(MutableHandleValue d, const void* s,
}
case nsXPTType::T_ASTRING:
// Fall through to T_DOMSTRING case
case nsXPTType::T_DOMSTRING:
{
const nsAString* p = static_cast<const nsAString*>(s);
if (!p || p->IsVoid()) {
@ -607,38 +604,25 @@ XPCConvert::JSData2Native(JSContext* cx,
}
case nsXPTType::T_ASTRING:
{
if (s.isUndefined()) {
((nsAString*)d)->SetIsVoid(true);
return true;
}
MOZ_FALLTHROUGH;
}
case nsXPTType::T_DOMSTRING:
{
nsAString* ws = (nsAString*)d;
if (s.isNull()) {
if (s.isUndefined() || s.isNull()) {
ws->SetIsVoid(true);
return true;
}
size_t length = 0;
JSString* str = nullptr;
if (!s.isUndefined()) {
str = ToString(cx, s);
if (!str) {
return false;
}
length = JS_GetStringLength(str);
if (!length) {
ws->Truncate();
return true;
}
JSString* str = ToString(cx, s);
if (!str) {
return false;
}
if (!str) {
ws->AssignLiteral(u"undefined");
} else if (XPCStringConvert::IsDOMString(str)) {
length = JS_GetStringLength(str);
if (!length) {
ws->Truncate();
return true;
}
if (XPCStringConvert::IsDOMString(str)) {
// The characters represent an existing nsStringBuffer that
// was shared by XPCStringConvert::ReadableToJSVal.
const char16_t* chars = JS_GetTwoByteExternalStringChars(str);
@ -1685,7 +1669,6 @@ xpc::InnerCleanupValue(const nsXPTType& aType, void* aValue, uint32_t aArrayLen)
break;
// String types
case nsXPTType::T_DOMSTRING:
case nsXPTType::T_ASTRING:
((nsAString*)aValue)->Truncate();
break;

Просмотреть файл

@ -498,14 +498,6 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
}
return XPCConvert::NativeData2JS(pJSVal, &astring, { TD_ASTRING }, &iid, 0, pErr);
}
case nsIDataType::VTYPE_DOMSTRING:
{
nsAutoString astring;
if (NS_FAILED(variant->GetAsAString(astring))) {
return false;
}
return XPCConvert::NativeData2JS(pJSVal, &astring, { TD_DOMSTRING }, &iid, 0, pErr);
}
case nsIDataType::VTYPE_CSTRING:
{
nsAutoCString cString;
@ -671,7 +663,6 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
// The rest are illegal.
case nsIDataType::VTYPE_VOID:
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_CSTRING:
case nsIDataType::VTYPE_UTF8STRING:
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
@ -799,13 +790,6 @@ NS_IMETHODIMP XPCVariant::GetAsAString(nsAString & _retval)
return mData.ConvertToAString(_retval);
}
NS_IMETHODIMP XPCVariant::GetAsDOMString(nsAString & _retval)
{
// A DOMString maps to an AString internally, so we can re-use
// ConvertToAString here.
return mData.ConvertToAString(_retval);
}
NS_IMETHODIMP XPCVariant::GetAsACString(nsACString & _retval)
{
return mData.ConvertToACString(_retval);

Просмотреть файл

@ -3212,7 +3212,7 @@ nsIPrincipal* GetObjectPrincipal(JSObject* obj);
// This method expects a value of the following types:
// TD_PNSIID
// value : nsID* (free)
// TD_DOMSTRING, TD_ASTRING, TD_CSTRING, TD_UTF8STRING
// TD_ASTRING, TD_CSTRING, TD_UTF8STRING
// value : ns[C]String* (truncate)
// TD_PSTRING, TD_PWSTRING, TD_PSTRING_SIZE_IS, TD_PWSTRING_SIZE_IS
// value : char[16_t]** (free)

Просмотреть файл

@ -353,7 +353,7 @@ bool Base64Decode(JSContext* cx, JS::HandleValue val, JS::MutableHandleValue out
bool NonVoidStringToJsval(JSContext* cx, nsAString& str, JS::MutableHandleValue rval);
inline bool StringToJsval(JSContext* cx, nsAString& str, JS::MutableHandleValue rval)
{
// From the T_DOMSTRING case in XPCConvert::NativeData2JS.
// From the T_ASTRING case in XPCConvert::NativeData2JS.
if (str.IsVoid()) {
rval.setNull();
return true;

Просмотреть файл

@ -59,7 +59,6 @@ TestParams.prototype = {
testString: f,
testWchar: f,
testWstring: f,
testDOMString: f,
testAString: f,
testAUTF8String: f,
testACString: f,

Просмотреть файл

@ -162,12 +162,6 @@ NS_IMETHODIMP nsXPCTestParams::TestWstring(const char16_t * a, char16_t * *b, ch
return NS_OK;
}
NS_IMETHODIMP nsXPCTestParams::TestDOMString(const nsAString & a, nsAString & b, nsAString & _retval)
{
STRING_METHOD_IMPL;
}
NS_IMETHODIMP nsXPCTestParams::TestAString(const nsAString & a, nsAString & b, nsAString & _retval)
{
STRING_METHOD_IMPL;

Просмотреть файл

@ -33,7 +33,6 @@ interface nsIXPCTestParams : nsISupports {
string testString(in string a, inout string b);
wchar testWchar(in wchar a, inout wchar b);
wstring testWstring(in wstring a, inout wstring b);
DOMString testDOMString(in DOMString a, inout DOMString b);
AString testAString(in AString a, inout AString b);
AUTF8String testAUTF8String(in AUTF8String a, inout AUTF8String b);
ACString testACString(in ACString a, inout ACString b);

Просмотреть файл

@ -124,7 +124,6 @@ function test_component(contractid) {
doTest("testString", "someString", "another string");
doTest("testWstring", "Why wasnt this", "turned on before? ಠ_ಠ");
doTest("testWchar", "z", "ア");
doTestWorkaround("testDOMString", "Beware: ☠ s");
doTestWorkaround("testAString", "Frosty the ☃ ;-)");
doTestWorkaround("testAUTF8String", "We deliver 〠!");
doTestWorkaround("testACString", "Just a regular C string.");

Просмотреть файл

@ -159,13 +159,6 @@ Variant_base::GetAsID(nsID *)
return NS_ERROR_CANNOT_CONVERT_DATA;
}
inline
NS_IMETHODIMP
Variant_base::GetAsDOMString(nsAString &)
{
return NS_ERROR_CANNOT_CONVERT_DATA;
}
inline
NS_IMETHODIMP
Variant_base::GetAsString(char **)

Просмотреть файл

@ -208,7 +208,6 @@ convertVariantToStorageVariant(nsIVariant* aVariant)
return new UTF8TextVariant(v);
}
case nsIDataType::VTYPE_WCHAR:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_WCHAR_STR:
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
case nsIDataType::VTYPE_ASTRING: {

Просмотреть файл

@ -75,7 +75,6 @@ variantToSQLiteT(T aObj,
return sqlite3_T_text(aObj, value);
}
case nsIDataType::VTYPE_WCHAR:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_WCHAR_STR:
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
case nsIDataType::VTYPE_ASTRING:

Просмотреть файл

@ -192,7 +192,6 @@ nsAnnotationService::SetItemAnnotation(int64_t aItemId,
}
case nsIDataType::VTYPE_CHAR:
case nsIDataType::VTYPE_WCHAR:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_CHAR_STR:
case nsIDataType::VTYPE_WCHAR_STR:
case nsIDataType::VTYPE_STRING_SIZE_IS:

Просмотреть файл

@ -532,7 +532,6 @@ ScalarString::SetValue(nsIVariant* aValue)
aValue->GetDataType(&type);
if (type != nsIDataType::VTYPE_CHAR &&
type != nsIDataType::VTYPE_WCHAR &&
type != nsIDataType::VTYPE_DOMSTRING &&
type != nsIDataType::VTYPE_CHAR_STR &&
type != nsIDataType::VTYPE_WCHAR_STR &&
type != nsIDataType::VTYPE_STRING_SIZE_IS &&

Просмотреть файл

@ -34,7 +34,6 @@ struct nsIDataType
VTYPE_WCHAR = TD_WCHAR ,
VTYPE_VOID = TD_VOID ,
VTYPE_ID = TD_PNSIID ,
VTYPE_DOMSTRING = TD_DOMSTRING ,
VTYPE_CHAR_STR = TD_PSTRING ,
VTYPE_WCHAR_STR = TD_PWSTRING ,
VTYPE_INTERFACE = TD_INTERFACE_TYPE ,
@ -82,7 +81,6 @@ interface nsIVariant : nsISupports
[noscript] wchar getAsWChar();
[notxpcom] nsresult getAsID(out nsID retval);
[noscript] AString getAsAString();
[noscript] DOMString getAsDOMString();
[noscript] ACString getAsACString();
[noscript] AUTF8String getAsAUTF8String();
[noscript] string getAsString();
@ -133,7 +131,6 @@ interface nsIWritableVariant : nsIVariant
void setAsWChar(in wchar aValue);
void setAsID(in nsIDRef aValue);
void setAsAString(in AString aValue);
void setAsDOMString(in DOMString aValue);
void setAsACString(in ACString aValue);
void setAsAUTF8String(in AUTF8String aValue);
void setAsString(in string aValue);

Просмотреть файл

@ -115,7 +115,6 @@ nsDiscriminatedUnion::ToManageableNumber(nsDiscriminatedUnion* aOutData) const
}
aOutData->mType = nsIDataType::VTYPE_DOUBLE;
return NS_OK;
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_ASTRING:
rv = AString2Double(*u.mAStringValue, &aOutData->u.mDoubleValue);
if (NS_FAILED(rv)) {
@ -219,7 +218,6 @@ nsDiscriminatedUnion::FreeArray()
// The rest are illegal.
case nsIDataType::VTYPE_VOID:
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_UTF8STRING:
case nsIDataType::VTYPE_CSTRING:
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
@ -310,7 +308,6 @@ CloneArray(uint16_t aInType, const nsIID* aInIID,
// The rest are illegal.
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_UTF8STRING:
case nsIDataType::VTYPE_CSTRING:
case nsIDataType::VTYPE_STRING_SIZE_IS:
@ -415,7 +412,6 @@ CloneArray(uint16_t aInType, const nsIID* aInIID,
case nsIDataType::VTYPE_EMPTY_ARRAY:
case nsIDataType::VTYPE_EMPTY:
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_UTF8STRING:
case nsIDataType::VTYPE_CSTRING:
case nsIDataType::VTYPE_STRING_SIZE_IS:
@ -660,7 +656,6 @@ nsDiscriminatedUnion::String2ID(nsID* aPid) const
case nsIDataType::VTYPE_UTF8STRING:
return aPid->Parse(PromiseFlatUTF8String(*u.mUTF8StringValue).get());
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
pString = u.mAStringValue;
break;
case nsIDataType::VTYPE_WCHAR_STR:
@ -698,7 +693,6 @@ nsDiscriminatedUnion::ConvertToID(nsID* aResult) const
*aResult = u.iface.mInterfaceID;
return NS_OK;
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_UTF8STRING:
case nsIDataType::VTYPE_CSTRING:
case nsIDataType::VTYPE_CHAR_STR:
@ -725,7 +719,6 @@ nsDiscriminatedUnion::ToString(nsACString& aOutString) const
switch (mType) {
// all the stuff we don't handle...
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_UTF8STRING:
case nsIDataType::VTYPE_CSTRING:
case nsIDataType::VTYPE_CHAR_STR:
@ -816,7 +809,6 @@ nsDiscriminatedUnion::ConvertToAString(nsAString& aResult) const
{
switch (mType) {
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
aResult.Assign(*u.mAStringValue);
return NS_OK;
case nsIDataType::VTYPE_CSTRING:
@ -859,7 +851,6 @@ nsDiscriminatedUnion::ConvertToACString(nsACString& aResult) const
{
switch (mType) {
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
LossyCopyUTF16toASCII(*u.mAStringValue, aResult);
return NS_OK;
case nsIDataType::VTYPE_CSTRING:
@ -902,7 +893,6 @@ nsDiscriminatedUnion::ConvertToAUTF8String(nsAUTF8String& aResult) const
{
switch (mType) {
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
CopyUTF16toUTF8(*u.mAStringValue, aResult);
return NS_OK;
case nsIDataType::VTYPE_CSTRING:
@ -977,7 +967,6 @@ nsDiscriminatedUnion::ConvertToStringWithSize(uint32_t* aSize, char** aStr) cons
switch (mType) {
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
*aSize = u.mAStringValue->Length();
*aStr = ToNewCString(*u.mAStringValue);
break;
@ -1049,7 +1038,6 @@ nsDiscriminatedUnion::ConvertToWStringWithSize(uint32_t* aSize, char16_t** aStr)
switch (mType) {
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
*aSize = u.mAStringValue->Length();
*aStr = ToNewUnicode(*u.mAStringValue);
break;
@ -1246,7 +1234,6 @@ nsDiscriminatedUnion::SetFromVariant(nsIVariant* aValue)
CASE__SET_FROM_VARIANT_TYPE(VTYPE_ID, mIDValue, ID)
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
case nsIDataType::VTYPE_WCHAR_STR:
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
CASE__SET_FROM_VARIANT_VTYPE_PROLOGUE(VTYPE_ASTRING);
@ -1409,14 +1396,6 @@ nsDiscriminatedUnion::SetFromAString(const nsAString& aValue)
DATA_SETTER_EPILOGUE(VTYPE_ASTRING);
}
void
nsDiscriminatedUnion::SetFromDOMString(const nsAString& aValue)
{
DATA_SETTER_PROLOGUE;
u.mAStringValue = new nsString(aValue);
DATA_SETTER_EPILOGUE(VTYPE_DOMSTRING);
}
void
nsDiscriminatedUnion::SetFromACString(const nsACString& aValue)
{
@ -1563,7 +1542,6 @@ nsDiscriminatedUnion::Cleanup()
case nsIDataType::VTYPE_ID:
break;
case nsIDataType::VTYPE_ASTRING:
case nsIDataType::VTYPE_DOMSTRING:
delete u.mAStringValue;
break;
case nsIDataType::VTYPE_CSTRING:
@ -1736,14 +1714,6 @@ nsVariantBase::GetAsAString(nsAString& aResult)
return mData.ConvertToAString(aResult);
}
NS_IMETHODIMP
nsVariantBase::GetAsDOMString(nsAString& aResult)
{
// A DOMString maps to an AString internally, so we can re-use
// ConvertToAString here.
return mData.ConvertToAString(aResult);
}
NS_IMETHODIMP
nsVariantBase::GetAsACString(nsACString& aResult)
{
@ -1979,17 +1949,6 @@ nsVariantBase::SetAsAString(const nsAString& aValue)
return NS_OK;
}
NS_IMETHODIMP
nsVariantBase::SetAsDOMString(const nsAString& aValue)
{
if (!mWritable) {
return NS_ERROR_OBJECT_IS_IMMUTABLE;
}
mData.SetFromDOMString(aValue);
return NS_OK;
}
NS_IMETHODIMP
nsVariantBase::SetAsACString(const nsACString& aValue)
{

Просмотреть файл

@ -92,7 +92,6 @@ public:
void SetFromWChar(char16_t aValue);
void SetFromID(const nsID& aValue);
void SetFromAString(const nsAString& aValue);
void SetFromDOMString(const nsAString& aValue);
void SetFromAUTF8String(const nsAUTF8String& aValue);
void SetFromACString(const nsACString& aValue);
MOZ_MUST_USE nsresult SetFromString(const char* aValue);

Просмотреть файл

@ -205,12 +205,11 @@ enum nsXPTTypeTag : uint8_t
// - Always passed indirectly,
// - Outparams must be initialized by caller,
// - Supported in xptcall due to indirection.
TD_DOMSTRING = 24,
TD_UTF8STRING = 25,
TD_CSTRING = 26,
TD_ASTRING = 27,
TD_JSVAL = 28,
TD_ARRAY = 29,
TD_UTF8STRING = 24,
TD_CSTRING = 25,
TD_ASTRING = 26,
TD_JSVAL = 27,
TD_ARRAY = 28,
_TD_LAST_COMPLEX = TD_ARRAY
};
@ -360,7 +359,6 @@ public:
TD_ALIAS_(T_WCHAR , TD_WCHAR );
TD_ALIAS_(T_VOID , TD_VOID );
TD_ALIAS_(T_IID , TD_PNSIID );
TD_ALIAS_(T_DOMSTRING , TD_DOMSTRING );
TD_ALIAS_(T_CHAR_STR , TD_PSTRING );
TD_ALIAS_(T_WCHAR_STR , TD_PWSTRING );
TD_ALIAS_(T_INTERFACE , TD_INTERFACE_TYPE );
@ -708,7 +706,6 @@ GetString(uint32_t aIndex)
macro(TD_PROMISE, mozilla::dom::Promise*)
#define XPT_FOR_EACH_COMPLEX_TYPE(macro) \
macro(TD_DOMSTRING, nsString) \
macro(TD_UTF8STRING, nsCString) \
macro(TD_CSTRING, nsCString) \
macro(TD_ASTRING, nsString) \