summaryrefslogtreecommitdiffstats
path: root/toolkit/components/alerts/nsAlertsService.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-19 10:00:25 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-19 10:00:25 +0100
commitc7668971968e044e85446d79362d7744846efdd0 (patch)
treee2d5b4f54edebe1373684ceb007cad39f2399c0f /toolkit/components/alerts/nsAlertsService.cpp
parent85edb1c711f7816ed1a30edd07b37d314fac216a (diff)
downloadUXP-c7668971968e044e85446d79362d7744846efdd0.tar
UXP-c7668971968e044e85446d79362d7744846efdd0.tar.gz
UXP-c7668971968e044e85446d79362d7744846efdd0.tar.lz
UXP-c7668971968e044e85446d79362d7744846efdd0.tar.xz
UXP-c7668971968e044e85446d79362d7744846efdd0.zip
Remove the use of GetProcAddress() for shell32
This avoids manually hooking into shell32.dll and using the native shell API instead. Tag #22.
Diffstat (limited to 'toolkit/components/alerts/nsAlertsService.cpp')
-rw-r--r--toolkit/components/alerts/nsAlertsService.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp
index 35418dd17..dd67ad983 100644
--- a/toolkit/components/alerts/nsAlertsService.cpp
+++ b/toolkit/components/alerts/nsAlertsService.cpp
@@ -22,6 +22,10 @@
#include "nsIFaviconService.h"
#endif // MOZ_PLACES
+#ifdef XP_WIN
+#include <shellapi.h>
+#endif
+
using namespace mozilla;
using mozilla::dom::ContentChild;
@@ -154,23 +158,12 @@ bool nsAlertsService::ShouldShowAlert()
bool result = true;
#ifdef XP_WIN
- HMODULE shellDLL = ::LoadLibraryW(L"shell32.dll");
- if (!shellDLL)
- return result;
-
- SHQueryUserNotificationStatePtr pSHQueryUserNotificationState =
- (SHQueryUserNotificationStatePtr) ::GetProcAddress(shellDLL, "SHQueryUserNotificationState");
-
- if (pSHQueryUserNotificationState) {
- MOZ_QUERY_USER_NOTIFICATION_STATE qstate;
- if (SUCCEEDED(pSHQueryUserNotificationState(&qstate))) {
- if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
- result = false;
- }
+ QUERY_USER_NOTIFICATION_STATE qstate;
+ if (SUCCEEDED(SHQueryUserNotificationState(&qstate))) {
+ if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
+ result = false;
}
}
-
- ::FreeLibrary(shellDLL);
#endif
return result;