Skip to content

Commit f137cf6

Browse files
author
Butkovits Atila
committed
Backed out changeset e0f1fa408c70 (bug 1818418) for causing bustages at WindowsUserChoice.cpp. CLOSED TREE
1 parent bf6ab69 commit f137cf6

File tree

5 files changed

+130
-299
lines changed

5 files changed

+130
-299
lines changed

browser/components/shell/WindowsUserChoice.cpp

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
*/
2121

2222
#include <windows.h>
23-
#include <appmodel.h> // for GetPackageFamilyName
2423
#include <sddl.h> // for ConvertSidToStringSidW
2524
#include <wincrypt.h> // for CryptoAPI base64
2625
#include <bcrypt.h> // for CNG MD5
2726
#include <winternl.h> // for NT_SUCCESS()
2827

29-
#include "ErrorList.h"
3028
#include "mozilla/ArrayUtils.h"
3129
#include "mozilla/UniquePtr.h"
3230
#include "nsWindowsHelpers.h"
@@ -422,53 +420,3 @@ bool CheckProgIDExists(const wchar_t* aProgID) {
422420
::RegCloseKey(key);
423421
return true;
424422
}
425-
426-
nsresult GetMsixProgId(const wchar_t* assoc, UniquePtr<wchar_t[]>& aProgId) {
427-
// Retrieve the registry path to the package from registry path:
428-
// clang-format off
429-
// HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages\[Package Full Name]\App\Capabilities\[FileAssociations | URLAssociations]\[File | URL]
430-
// clang-format on
431-
432-
UINT32 pfnLen = 0;
433-
LONG rv = GetCurrentPackageFullName(&pfnLen, nullptr);
434-
NS_ENSURE_TRUE(rv != APPMODEL_ERROR_NO_PACKAGE, NS_ERROR_FAILURE);
435-
436-
auto pfn = mozilla::MakeUnique<wchar_t[]>(pfnLen);
437-
rv = GetCurrentPackageFullName(&pfnLen, pfn.get());
438-
NS_ENSURE_TRUE(rv == ERROR_SUCCESS, NS_ERROR_FAILURE);
439-
440-
const wchar_t* assocSuffix;
441-
if (assoc[0] == L'.') {
442-
// File association.
443-
assocSuffix = LR"(App\Capabilities\FileAssociations)";
444-
} else {
445-
// URL association.
446-
assocSuffix = LR"(App\Capabilities\URLAssociations)";
447-
}
448-
449-
const wchar_t* assocPathFmt =
450-
LR"(Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages\%s\%s)";
451-
int assocPathLen = _scwprintf(assocPathFmt, pfn.get(), assocSuffix);
452-
assocPathLen += 1; // _scwprintf does not include the terminator
453-
454-
auto assocPath = MakeUnique<wchar_t[]>(assocPathLen);
455-
_snwprintf_s(assocPath.get(), assocPathLen, _TRUNCATE, assocPathFmt,
456-
pfn.get(), assocSuffix);
457-
458-
LSTATUS ls;
459-
460-
// Retrieve the package association's ProgID, always in the form `AppX[32 hash
461-
// characters]`.
462-
const size_t appxProgIdLen = 37;
463-
auto progId = MakeUnique<wchar_t[]>(appxProgIdLen);
464-
DWORD progIdLen = appxProgIdLen * sizeof(wchar_t);
465-
ls = ::RegGetValueW(HKEY_CLASSES_ROOT, assocPath.get(), assoc, RRF_RT_REG_SZ,
466-
nullptr, (LPBYTE)progId.get(), &progIdLen);
467-
if (ls != ERROR_SUCCESS) {
468-
return NS_ERROR_WDBA_NO_PROGID;
469-
}
470-
471-
aProgId.swap(progId);
472-
473-
return NS_OK;
474-
}

browser/components/shell/WindowsUserChoice.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,4 @@ mozilla::UniquePtr<wchar_t[]> FormatProgID(const wchar_t* aProgIDBase,
100100
*/
101101
bool CheckProgIDExists(const wchar_t* aProgID);
102102

103-
/*
104-
* Get the ProgID registered by Windows for the given association.
105-
*
106-
* The MSIX `AppManifest.xml` declares supported protocols and file
107-
* type associations. Upon installation, Windows generates
108-
* corresponding ProgIDs for them, of the form `AppX*`. This function
109-
* retrieves those generated ProgIDs (from the Windows registry).
110-
*
111-
* @return ProgID.
112-
*/
113-
nsresult GetMsixProgId(const wchar_t* assoc,
114-
mozilla::UniquePtr<wchar_t[]>& aProgId);
115-
116103
#endif // SHELL_WINDOWSUSERCHOICE_H__

browser/components/shell/nsWindowsShellService.cpp

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -300,41 +300,10 @@ nsWindowsShellService::CheckAllProgIDsExist(bool* aResult) {
300300
if (!mozilla::widget::WinTaskbar::GetAppUserModelID(aumid)) {
301301
return NS_OK;
302302
}
303-
304-
if (widget::WinUtils::HasPackageIdentity()) {
305-
UniquePtr<wchar_t[]> extraProgID;
306-
nsresult rv;
307-
bool result = true;
308-
309-
// "FirefoxURL".
310-
rv = GetMsixProgId(L"https", extraProgID);
311-
if (NS_WARN_IF(NS_FAILED(rv))) {
312-
return rv;
313-
}
314-
result = result && CheckProgIDExists(extraProgID.get());
315-
316-
// "FirefoxHTML".
317-
rv = GetMsixProgId(L".htm", extraProgID);
318-
if (NS_WARN_IF(NS_FAILED(rv))) {
319-
return rv;
320-
}
321-
result = result && CheckProgIDExists(extraProgID.get());
322-
323-
// "FirefoxPDF".
324-
rv = GetMsixProgId(L".pdf", extraProgID);
325-
if (NS_WARN_IF(NS_FAILED(rv))) {
326-
return rv;
327-
}
328-
result = result && CheckProgIDExists(extraProgID.get());
329-
330-
*aResult = result;
331-
} else {
332-
*aResult =
333-
CheckProgIDExists(FormatProgID(L"FirefoxURL", aumid.get()).get()) &&
334-
CheckProgIDExists(FormatProgID(L"FirefoxHTML", aumid.get()).get()) &&
335-
CheckProgIDExists(FormatProgID(L"FirefoxPDF", aumid.get()).get());
336-
}
337-
303+
*aResult =
304+
CheckProgIDExists(FormatProgID(L"FirefoxURL", aumid.get()).get()) &&
305+
CheckProgIDExists(FormatProgID(L"FirefoxHTML", aumid.get()).get()) &&
306+
CheckProgIDExists(FormatProgID(L"FirefoxPDF", aumid.get()).get());
338307
return NS_OK;
339308
}
340309

python/mozbuild/mozbuild/repackaging/msix.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ def get_branding(use_official, topsrcdir, build_app, finder, log=None):
198198
conf_vars = mozpath.join(topsrcdir, build_app, "confvars.sh")
199199

200200
def conf_vars_value(key):
201-
lines = [line.strip() for line in open(conf_vars).readlines()]
201+
lines = open(conf_vars).readlines()
202202
for line in lines:
203+
line = line.strip()
203204
if line and line[0] == "#":
204205
continue
205206
if key not in line:
@@ -832,7 +833,7 @@ def powershell(argstring, check=True):
832833
else:
833834
thumbprint = None
834835

835-
if force or not thumbprint:
836+
if not thumbprint:
836837
thumbprint = (
837838
powershell(
838839
(

0 commit comments

Comments
 (0)