Skip to content

Commit b408758

Browse files
committed
Backed out changeset 45ab2db62a65 (bug 1818418) for causing bustages in WindowsUserChoice.h
1 parent 94f2323 commit b408758

File tree

5 files changed

+130
-300
lines changed

5 files changed

+130
-300
lines changed

browser/components/shell/WindowsUserChoice.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@
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"
32-
#include "nsDebug.h"
3330
#include "nsWindowsHelpers.h"
3431

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

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)