Bug 1132655. Don't allow conversions from DOMString to const XPCOM string references, since it's meant to be an outparam only. r=smaug

This commit is contained in:
Boris Zbarsky 2015-02-12 18:39:26 -05:00
parent c1347d4d64
commit 4c68880cf9
4 changed files with 9 additions and 4 deletions

View File

@ -55,6 +55,11 @@ public:
return AsAString();
}
// It doesn't make any sense to convert a DOMString to a const nsString or
// nsAString reference; this class is meant for outparams only.
operator const nsString&() = delete;
operator const nsAString&() = delete;
nsString& AsAString()
{
MOZ_ASSERT(!mStringBuffer, "We already have a stringbuffer?");

View File

@ -97,7 +97,7 @@ public:
{
DOMString value;
GetSrc(value);
aText = value;
value.ToString(aText);
}
virtual void SetItemValueText(const nsAString& aText) MOZ_OVERRIDE
{

View File

@ -250,7 +250,7 @@ ServiceWorkerClients::GetServiced(ErrorResult& aRv)
MOZ_ASSERT(workerPrivate);
workerPrivate->AssertIsOnWorkerThread();
DOMString scope;
nsString scope;
mWorkerScope->GetScope(scope);
nsRefPtr<Promise> promise = Promise::Create(mWorkerScope, aRv);

View File

@ -203,9 +203,9 @@ public:
JS::MutableHandle<JSObject*> aReflector) MOZ_OVERRIDE;
void
GetScope(DOMString& aScope) const
GetScope(nsString& aScope) const
{
aScope.AsAString() = mScope;
aScope = mScope;
}
void