Backed out 3 changesets (bug 1602191, bug 1602194, bug 1602196) for Windows MinGW bustages on WindowsUIUtils.cpp. CLOSED TREE
Backed out changeset 73c93dc0c790 (bug 1602196) Backed out changeset ab3c0af1ec40 (bug 1602194) Backed out changeset f1b308c595c8 (bug 1602191)
This commit is contained in:
@@ -57,29 +57,11 @@
|
||||
|
||||
#define APP_REG_NAME_BASE L"Firefox-"
|
||||
|
||||
#ifdef DEBUG
|
||||
# define NS_ENSURE_HRESULT(hres, ret) \
|
||||
do { \
|
||||
HRESULT result = hres; \
|
||||
if (MOZ_UNLIKELY(FAILED(result))) { \
|
||||
mozilla::SmprintfPointer msg = mozilla::Smprintf( \
|
||||
"NS_ENSURE_HRESULT(%s, %s) failed with " \
|
||||
"result 0x%" PRIX32, \
|
||||
#hres, #ret, static_cast<uint32_t>(result)); \
|
||||
NS_WARNING(msg.get()); \
|
||||
return ret; \
|
||||
} \
|
||||
} while (false)
|
||||
#else
|
||||
# define NS_ENSURE_HRESULT(hres, ret) \
|
||||
if (MOZ_UNLIKELY(FAILED(hres))) return ret
|
||||
#endif
|
||||
|
||||
using mozilla::IsWin8OrLater;
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsWindowsShellService, nsIToolkitShellService,
|
||||
nsIShellService, nsIWindowsShellService)
|
||||
nsIShellService)
|
||||
|
||||
static nsresult OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName,
|
||||
HKEY* aKey) {
|
||||
@@ -697,50 +679,6 @@ nsWindowsShellService::SetDesktopBackgroundColor(uint32_t aColor) {
|
||||
return regKey->Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindowsShellService::CreateShortcut(nsIFile* aBinary,
|
||||
const nsTArray<nsString>& aArguments,
|
||||
const nsAString& aDescription,
|
||||
nsIFile* aIconFile, nsIFile* aTarget) {
|
||||
NS_ENSURE_ARG(aBinary);
|
||||
NS_ENSURE_ARG(aTarget);
|
||||
|
||||
RefPtr<IShellLinkW> link;
|
||||
HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
|
||||
IID_IShellLinkW, getter_AddRefs(link));
|
||||
NS_ENSURE_HRESULT(hr, NS_ERROR_FAILURE);
|
||||
|
||||
nsString path(aBinary->NativePath());
|
||||
link->SetPath(path.get());
|
||||
|
||||
if (!aDescription.IsEmpty()) {
|
||||
link->SetDescription(PromiseFlatString(aDescription).get());
|
||||
}
|
||||
|
||||
// TODO: Properly escape quotes in the string, see bug 1604287.
|
||||
nsString arguments;
|
||||
for (auto& arg : aArguments) {
|
||||
arguments.AppendPrintf("\"%S\" ", arg.get());
|
||||
}
|
||||
|
||||
link->SetArguments(arguments.get());
|
||||
|
||||
if (aIconFile) {
|
||||
nsString icon(aIconFile->NativePath());
|
||||
link->SetIconLocation(icon.get(), 0);
|
||||
}
|
||||
|
||||
RefPtr<IPersistFile> persist;
|
||||
hr = link->QueryInterface(IID_IPersistFile, getter_AddRefs(persist));
|
||||
NS_ENSURE_HRESULT(hr, NS_ERROR_FAILURE);
|
||||
|
||||
nsString target(aTarget->NativePath());
|
||||
hr = persist->Save(target.get(), TRUE);
|
||||
NS_ENSURE_HRESULT(hr, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsWindowsShellService::nsWindowsShellService() {}
|
||||
|
||||
nsWindowsShellService::~nsWindowsShellService() {}
|
||||
|
||||
Reference in New Issue
Block a user