зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1701791 p2: Don't initialize COM on the image IO thread when win32k is locked down. r=tnikkel
COM is required for calls to SHGetFileInfo for moz-icon, but we only currently require that for the file content process. We may want to use it in the future for the privileged about content process, in which case we will have to forgo win32k lockdown there unless moz-icon is remoted. Depends on D112960 Differential Revision: https://phabricator.services.mozilla.com/D112961
This commit is contained in:
Родитель
c0ca93fed8
Коммит
9ec086e0e5
|
@ -29,6 +29,7 @@
|
|||
|
||||
#if defined(XP_WIN)
|
||||
# include <objbase.h>
|
||||
# include "mozilla/WindowsProcessMitigations.h"
|
||||
#endif
|
||||
|
||||
using std::max;
|
||||
|
@ -90,8 +91,10 @@ DecodePool::DecodePool() : mMutex("image::IOThread") {
|
|||
// On Windows we use the io thread to get icons from the system. Any thread
|
||||
// that makes system calls needs to call CoInitialize. And these system calls
|
||||
// (SHGetFileInfo) should only be called from one thread at a time, in case
|
||||
// we ever create more than on io thread.
|
||||
nsCOMPtr<nsIRunnable> initer = new IOThreadIniter();
|
||||
// we ever create more than one io thread. If win32k is locked down, we can't
|
||||
// call SHGetFileInfo anyway, so we don't need the initializer.
|
||||
nsCOMPtr<nsIRunnable> initer =
|
||||
IsWin32kLockedDown() ? nullptr : new IOThreadIniter();
|
||||
nsresult rv = NS_NewNamedThread("ImageIO", getter_AddRefs(mIOThread), initer);
|
||||
#else
|
||||
nsresult rv = NS_NewNamedThread("ImageIO", getter_AddRefs(mIOThread));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/WindowsProcessMitigations.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIconChannel.h"
|
||||
|
@ -447,6 +448,13 @@ static UINT GetSizeInfoFlag(uint32_t aDesiredImageSize) {
|
|||
}
|
||||
|
||||
nsresult nsIconChannel::GetHIconFromFile(bool aNonBlocking, HICON* hIcon) {
|
||||
if (IsWin32kLockedDown()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false,
|
||||
"GetHIconFromFile requires call to SHGetFileInfo, "
|
||||
"which cannot be used when win32k is disabled.");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCString contentType;
|
||||
nsCString fileExt;
|
||||
nsCOMPtr<nsIFile> localFile; // file we want an icon for
|
||||
|
|
Загрузка…
Ссылка в новой задаче