зеркало из https://github.com/mozilla/pjs.git
Bug 611503 Constructing an nsTDependentString from an nsTAString makes no sense r=dbaron,dwitte
This commit is contained in:
Родитель
7c4b08f775
Коммит
f25a6bc977
|
@ -8120,7 +8120,7 @@ nsDOMStringMapSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRUint32 i = 0; i < properties.Length(); ++i) {
|
||||
nsDependentString prop(properties[i]);
|
||||
nsString& prop(properties[i]);
|
||||
*_retval = JS_DefineUCProperty(cx, obj, prop.get(), prop.Length(),
|
||||
JSVAL_VOID, nsnull, nsnull,
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED);
|
||||
|
|
|
@ -312,8 +312,7 @@ gfxFT2FontList::GetDefaultFont(const gfxFontStyle* aStyle, PRBool& aNeedsBold)
|
|||
}
|
||||
#elif defined(ANDROID)
|
||||
nsAutoString resolvedName;
|
||||
if (ResolveFontName(nsDependentString(NS_LITERAL_STRING("Droid Sans")),
|
||||
resolvedName))
|
||||
if (ResolveFontName(NS_LITERAL_STRING("Droid Sans"), resolvedName))
|
||||
return FindFontForFamily(resolvedName, aStyle, aNeedsBold);
|
||||
#endif
|
||||
/* TODO: what about Qt or other platforms that may use this? */
|
||||
|
|
|
@ -922,8 +922,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
|||
aResult.Append(NS_LITERAL_STRING("-moz-element(#"));
|
||||
nsAutoString tmpStr;
|
||||
GetStringValue(tmpStr);
|
||||
nsStyleUtil::AppendEscapedCSSIdent(
|
||||
nsDependentString(tmpStr), aResult);
|
||||
nsStyleUtil::AppendEscapedCSSIdent(tmpStr, aResult);
|
||||
aResult.Append(NS_LITERAL_STRING(")"));
|
||||
}
|
||||
else if (eCSSUnit_Percent == unit) {
|
||||
|
|
|
@ -95,8 +95,9 @@ CookieServiceParent::RecvSetCookieString(const IPC::URI& aHost,
|
|||
if (!hostURI)
|
||||
return false;
|
||||
|
||||
nsDependentCString cookieString(aCookieString, 0);
|
||||
mCookieService->SetCookieStringInternal(hostURI, aIsForeign,
|
||||
aCookieString, aServerTime,
|
||||
cookieString, aServerTime,
|
||||
aFromHttp);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1493,11 +1493,11 @@ nsCookieService::SetCookieStringCommon(nsIURI *aHostURI,
|
|||
}
|
||||
|
||||
void
|
||||
nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
|
||||
bool aIsForeign,
|
||||
const nsCString &aCookieHeader,
|
||||
const nsCString &aServerTime,
|
||||
PRBool aFromHttp)
|
||||
nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
|
||||
bool aIsForeign,
|
||||
nsDependentCString &aCookieHeader,
|
||||
const nsCString &aServerTime,
|
||||
PRBool aFromHttp)
|
||||
{
|
||||
NS_ASSERTION(aHostURI, "null host!");
|
||||
|
||||
|
@ -1550,9 +1550,8 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
|
|||
}
|
||||
|
||||
// process each cookie in the header
|
||||
nsDependentCString cookieHeader(aCookieHeader);
|
||||
while (SetCookieInternal(aHostURI, baseDomain, requireHostMatch,
|
||||
cookieStatus, cookieHeader, serverTime, aFromHttp)) {
|
||||
while (SetCookieInternal(aHostURI, baseDomain, requireHostMatch, cookieStatus,
|
||||
aCookieHeader, serverTime, aFromHttp)) {
|
||||
// document.cookie can only set one cookie at a time
|
||||
if (!aFromHttp)
|
||||
break;
|
||||
|
|
|
@ -263,7 +263,7 @@ class nsCookieService : public nsICookieService
|
|||
nsresult GetCookieStringCommon(nsIURI *aHostURI, nsIChannel *aChannel, bool aHttpBound, char** aCookie);
|
||||
void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, PRBool aHttpBound, nsCString &aCookie);
|
||||
nsresult SetCookieStringCommon(nsIURI *aHostURI, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, bool aFromHttp);
|
||||
void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, const nsCString &aCookieHeader, const nsCString &aServerTime, PRBool aFromHttp);
|
||||
void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, nsDependentCString &aCookieHeader, const nsCString &aServerTime, PRBool aFromHttp);
|
||||
PRBool SetCookieInternal(nsIURI *aHostURI, const nsCString& aBaseDomain, PRBool aRequireHostMatch, CookieStatus aStatus, nsDependentCString &aCookieHeader, PRInt64 aServerTime, PRBool aFromHttp);
|
||||
void AddInternal(const nsCString& aBaseDomain, nsCookie *aCookie, PRInt64 aCurrentTimeInUsec, nsIURI *aHostURI, const char *aCookieHeader, PRBool aFromHttp);
|
||||
void RemoveCookieFromList(const nsListIter &aIter, mozIStorageBindingParamsArray *aParamsArray = NULL);
|
||||
|
|
|
@ -89,7 +89,7 @@ nsMIMEInfoAndroid::GetMimeInfoForMimeType(const nsACString& aMimeType,
|
|||
info->mPrefApp = systemDefault;
|
||||
|
||||
nsCAutoString fileExt;
|
||||
bridge->GetExtensionFromMimeType(nsDependentCString(aMimeType), fileExt);
|
||||
bridge->GetExtensionFromMimeType(aMimeType, fileExt);
|
||||
info->SetPrimaryExtension(fileExt);
|
||||
|
||||
PRUint32 len;
|
||||
|
|
|
@ -494,7 +494,7 @@ AndroidBridge::GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString&
|
|||
}
|
||||
|
||||
void
|
||||
AndroidBridge::GetExtensionFromMimeType(const nsCString& aMimeType, nsACString& aFileExt)
|
||||
AndroidBridge::GetExtensionFromMimeType(const nsACString& aMimeType, nsACString& aFileExt)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::GetExtensionFromMimeType");
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
const nsAString& aTitle = EmptyString());
|
||||
|
||||
void GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString& aMimeType);
|
||||
void GetExtensionFromMimeType(const nsCString& aMimeType, nsACString& aFileExt);
|
||||
void GetExtensionFromMimeType(const nsACString& aMimeType, nsACString& aFileExt);
|
||||
|
||||
void MoveTaskToBack();
|
||||
|
||||
|
|
|
@ -330,9 +330,7 @@ nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
|
|||
if (!colorStr.IsEmpty()) {
|
||||
nscolor thecolor;
|
||||
if (colorStr[0] == PRUnichar('#')) {
|
||||
if (NS_HexToRGB(nsDependentString(
|
||||
Substring(colorStr, 1, colorStr.Length() - 1)),
|
||||
&thecolor)) {
|
||||
if (NS_HexToRGB(nsDependentString(colorStr, 1), &thecolor)) {
|
||||
PRInt32 id = NS_PTR_TO_INT32(index);
|
||||
CACHE_COLOR(id, thecolor);
|
||||
}
|
||||
|
|
|
@ -91,11 +91,10 @@ class nsTDependentString_CharT : public nsTString_CharT
|
|||
AssertValid();
|
||||
}
|
||||
|
||||
explicit
|
||||
nsTDependentString_CharT( const substring_type& str )
|
||||
: string_type(const_cast<char_type*>(str.Data()), str.Length(), F_TERMINATED)
|
||||
nsTDependentString_CharT( const string_type& str, PRUint32 startPos )
|
||||
: string_type()
|
||||
{
|
||||
AssertValid();
|
||||
Rebind(str, startPos);
|
||||
}
|
||||
|
||||
// Create a nsTDependentSubstring to be bound later
|
||||
|
@ -124,6 +123,8 @@ class nsTDependentString_CharT : public nsTString_CharT
|
|||
Rebind(start, PRUint32(end - start));
|
||||
}
|
||||
|
||||
void Rebind( const string_type&, PRUint32 startPos );
|
||||
|
||||
private:
|
||||
|
||||
// NOT USED
|
||||
|
|
|
@ -48,3 +48,20 @@ nsTDependentString_CharT::Rebind( const char_type* data, size_type length )
|
|||
SetDataFlags(F_TERMINATED);
|
||||
AssertValid();
|
||||
}
|
||||
|
||||
void
|
||||
nsTDependentString_CharT::Rebind( const string_type& str, PRUint32 startPos )
|
||||
{
|
||||
// If we currently own a buffer, release it.
|
||||
Finalize();
|
||||
|
||||
size_type strLength = str.Length();
|
||||
|
||||
if (startPos > strLength)
|
||||
startPos = strLength;
|
||||
|
||||
mData = const_cast<char_type*>(str.Data()) + startPos;
|
||||
mLength = strLength - startPos;
|
||||
|
||||
SetDataFlags(F_TERMINATED);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче