mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 773760: Save privacy status of transferable during cross-process clipboard transfer. r=ehsan
This commit is contained in:
parent
4879213d80
commit
c200656eac
@ -686,7 +686,9 @@ ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissio
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvSetClipboardText(const nsString& text, const PRInt32& whichClipboard)
|
||||
ContentParent::RecvSetClipboardText(const nsString& text,
|
||||
const bool& isPrivateData,
|
||||
const PRInt32& whichClipboard)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID, &rv));
|
||||
@ -705,6 +707,7 @@ ContentParent::RecvSetClipboardText(const nsString& text, const PRInt32& whichCl
|
||||
|
||||
// If our data flavor has already been added, this will fail. But we don't care
|
||||
trans->AddDataFlavor(kUnicodeMime);
|
||||
trans->SetIsPrivateData(isPrivateData);
|
||||
|
||||
nsCOMPtr<nsISupports> nsisupportsDataWrapper =
|
||||
do_QueryInterface(dataWrapper);
|
||||
|
@ -201,7 +201,7 @@ private:
|
||||
|
||||
virtual bool RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions);
|
||||
|
||||
virtual bool RecvSetClipboardText(const nsString& text, const PRInt32& whichClipboard);
|
||||
virtual bool RecvSetClipboardText(const nsString& text, const bool& isPrivateData, const PRInt32& whichClipboard);
|
||||
virtual bool RecvGetClipboardText(const PRInt32& whichClipboard, nsString* text);
|
||||
virtual bool RecvEmptyClipboard();
|
||||
virtual bool RecvClipboardHasText(bool* hasText);
|
||||
|
@ -279,7 +279,7 @@ parent:
|
||||
|
||||
// These clipboard methods are only really used on Android since
|
||||
// the clipboard is not available in the content process.
|
||||
SetClipboardText(nsString text, PRInt32 whichClipboard);
|
||||
SetClipboardText(nsString text, bool isPrivateData, PRInt32 whichClipboard);
|
||||
sync GetClipboardText(PRInt32 whichClipboard)
|
||||
returns (nsString text);
|
||||
EmptyClipboard();
|
||||
|
@ -50,7 +50,10 @@ nsClipboard::SetData(nsITransferable *aTransferable,
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
} else {
|
||||
ContentChild::GetSingleton()->SendSetClipboardText(buffer, aWhichClipboard);
|
||||
bool isPrivateData = false;
|
||||
aTransferable->GetIsPrivateData(&isPrivateData);
|
||||
ContentChild::GetSingleton()->SendSetClipboardText(buffer, isPrivateData,
|
||||
aWhichClipboard);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -81,7 +81,7 @@ interface nsIFlavorDataProvider : nsISupports
|
||||
};
|
||||
|
||||
|
||||
[scriptable, uuid(983cb266-535b-4ca5-8ef2-2cee08d061e6)]
|
||||
[scriptable, uuid(5a611a60-e5b5-11e1-aff1-0800200c9a66)]
|
||||
interface nsITransferable : nsISupports
|
||||
{
|
||||
const long kFlavorHasDataProvider = 0;
|
||||
@ -172,7 +172,12 @@ interface nsITransferable : nsISupports
|
||||
|
||||
attribute nsIFormatConverter converter;
|
||||
|
||||
[noscript] readonly attribute boolean isPrivateData;
|
||||
/**
|
||||
* Use of the SetIsPrivateData() method generated by isPrivateData attribute should
|
||||
* be avoided as much as possible because the value set may not reflect the status
|
||||
* of the context in which the transferable was created.
|
||||
*/
|
||||
[noscript] attribute boolean isPrivateData;
|
||||
|
||||
};
|
||||
|
||||
|
@ -621,3 +621,14 @@ nsTransferable::GetIsPrivateData(bool *aIsPrivateData)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransferable::SetIsPrivateData(bool aIsPrivateData)
|
||||
{
|
||||
MOZ_ASSERT(mInitialized);
|
||||
|
||||
mPrivateData = aIsPrivateData;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user