Bug 1433030 - Initialize nsTransferable::mPrivateData with false
Initialize mPrivateData to false by default again, because the
change that changed the default value from true to false, i.e.
https://hg.mozilla.org/mozilla-central/rev/9e19b58d6494
prevented the clipboard from being backed by the filesystem,
as shown at https://bugzilla.mozilla.org/show_bug.cgi?id=1433030#c7
MozReview-Commit-ID: DEw5ETVqab8
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -189,17 +189,17 @@ DataStruct::ReadCache(nsISupports** aDat
//-------------------------------------------------------------------------
//
// Transferable constructor
//
//-------------------------------------------------------------------------
nsTransferable::nsTransferable()
- : mPrivateData(true)
+ : mPrivateData(false)
, mContentPolicyType(nsIContentPolicy::TYPE_OTHER)
#ifdef DEBUG
, mInitialized(false)
#endif
{
}
//-------------------------------------------------------------------------
--- a/widget/tests/test_bug1123480.xul
+++ b/widget/tests/test_bug1123480.xul
@@ -78,18 +78,21 @@ https://bugzilla.mozilla.org/show_bug.cg
// Sanitize environment
gClipboardHelper.copyString(SHORT_STRING_NO_CACHE);
var initialFdCount = getClipboardCacheFDCount();
// Overflow a nsTransferable region by using the clipboard helper
gClipboardHelper.copyString(Ipsum);
- // Undefined private browsing mode should not cache to disk
- is(getClipboardCacheFDCount(), initialFdCount, "should avoid caching to disk when PBM is undefined");
+ // gClipboardHelper.copyString also puts the data on the selection
+ // clipboard if the platform supports it.
+ var expectedFdDelta = Services.clipboard.supportsSelectionClipboard() ? 2 : 1;
+ // Undefined private browsing mode should cache to disk
+ is(getClipboardCacheFDCount(), initialFdCount + expectedFdDelta, "should cache to disk when PBM is undefined");
// Sanitize environment again.
gClipboardHelper.copyString(SHORT_STRING_NO_CACHE);
is(getClipboardCacheFDCount(), initialFdCount, "should have cleared the clipboard data");
// Repeat procedure of plain text selection with private browsing
// disabled and enabled
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");