зеркало из https://github.com/mozilla/pjs.git
Bug 518412 - clipboard data added in Private Browsing Mode causes Windows Explorer to crash when accessing menus which include Paste after closing firefox; r=roc a=beltzner
This commit is contained in:
Родитель
3f7f2c534f
Коммит
4e0f3896b3
|
@ -47,6 +47,10 @@
|
|||
#include "nsNetCID.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <ole2.h>
|
||||
#endif
|
||||
|
||||
#define NS_MOZ_DATA_FROM_PRIVATEBROWSING "application/x-moz-private-browsing"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsClipboardPrivacyHandler, nsIObserver, nsISupportsWeakReference)
|
||||
|
@ -105,6 +109,14 @@ nsClipboardPrivacyHandler::Observe(nsISupports *aSubject, char const *aTopic, PR
|
|||
nsIClipboard::kGlobalClipboard,
|
||||
&haveFlavors);
|
||||
if (NS_SUCCEEDED(rv) && haveFlavors) {
|
||||
#ifdef XP_WIN
|
||||
// Workaround for bug 518412. On Windows 7 x64, there is a bug
|
||||
// in handling clipboard data without any formats between
|
||||
// 32-bit/64-bit boundaries, which could lead Explorer to crash.
|
||||
// We work around the problem by clearing the clipboard using
|
||||
// the usual Win32 API.
|
||||
NS_ENSURE_TRUE(S_OK == ::OleSetClipboard(NULL), NS_ERROR_FAILURE);
|
||||
#else
|
||||
// Empty the native clipboard by copying an empty transferable
|
||||
nsCOMPtr<nsITransferable> nullData =
|
||||
do_CreateInstance("@mozilla.org/widget/transferable;1", &rv);
|
||||
|
@ -112,6 +124,7 @@ nsClipboardPrivacyHandler::Observe(nsISupports *aSubject, char const *aTopic, PR
|
|||
rv = clipboard->SetData(nullData, nsnull,
|
||||
nsIClipboard::kGlobalClipboard);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче