mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
Update any source files to account for refactoring
This commit is contained in:
@@ -77,7 +77,7 @@ static void Output(const char *fmt, ... )
|
||||
#if MOZ_WINCONSOLE
|
||||
fwprintf_s(stderr, wide_msg);
|
||||
#else
|
||||
MessageBoxW(NULL,
|
||||
MessageBoxW(nullptr,
|
||||
wide_msg,
|
||||
L"Pale Moon",
|
||||
MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
@@ -149,7 +149,7 @@ XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
|
||||
#endif
|
||||
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
|
||||
XRE_mainType XRE_main;
|
||||
XRE_DisableWritePoisoningType XRE_DisableWritePoisoning;
|
||||
XRE_StopLateWriteChecksType XRE_StopLateWriteChecks;
|
||||
|
||||
static const nsDynamicFunctionLoad kXULFuncs[] = {
|
||||
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
|
||||
@@ -160,7 +160,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
|
||||
#endif
|
||||
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
|
||||
{ "XRE_main", (NSFuncPtr*) &XRE_main },
|
||||
{ "XRE_DisableWritePoisoning", (NSFuncPtr*) &XRE_DisableWritePoisoning },
|
||||
{ "XRE_StopLateWriteChecks", (NSFuncPtr*) &XRE_StopLateWriteChecks },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
@@ -375,13 +375,13 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
|
||||
}
|
||||
if (absfwurl) {
|
||||
CFURLRef xulurl =
|
||||
CFURLCreateCopyAppendingPathComponent(NULL, absfwurl,
|
||||
CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl,
|
||||
CFSTR("XUL.framework"),
|
||||
true);
|
||||
|
||||
if (xulurl) {
|
||||
CFURLRef xpcomurl =
|
||||
CFURLCreateCopyAppendingPathComponent(NULL, xulurl,
|
||||
CFURLCreateCopyAppendingPathComponent(nullptr, xulurl,
|
||||
CFSTR("libxpcom.dylib"),
|
||||
false);
|
||||
|
||||
@@ -480,7 +480,7 @@ int main(int argc, char* argv[])
|
||||
// at least one such write that we don't control (see bug 826029). For
|
||||
// now we enable writes again and early exits will have to use exit instead
|
||||
// of _exit.
|
||||
XRE_DisableWritePoisoning();
|
||||
XRE_StopLateWriteChecks();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
%palemoonDTD;
|
||||
<!ENTITY % baseMenuDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd" >
|
||||
%baseMenuDTD;
|
||||
<!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetOverlay.dtd" >
|
||||
<!ENTITY % charsetDTD SYSTEM "chrome://browser/locale/charsetOverlay.dtd" >
|
||||
%charsetDTD;
|
||||
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
|
||||
%textcontextDTD;
|
||||
|
||||
@@ -237,7 +237,7 @@ var browserMenuDragging = {
|
||||
|
||||
// If we have not moved to a valid new target clear the drop indicator
|
||||
// this happens when moving out of the popup.
|
||||
let target = event.relatedTarget;
|
||||
target = event.relatedTarget;
|
||||
if (!target)
|
||||
this._indicatorBar.hidden = true;
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ var gPluginHandler = {
|
||||
callback: function() { browser.reload(); },
|
||||
}];
|
||||
|
||||
let notification = notificationBox.appendNotification(messageString, "plugin-crashed",
|
||||
notification = notificationBox.appendNotification(messageString, "plugin-crashed",
|
||||
iconURL, priority, buttons);
|
||||
|
||||
// Add the "learn more" link.
|
||||
|
||||
@@ -38,19 +38,19 @@
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="gBrowserInit.onLoad()" onunload="gBrowserInit.onUnload()" onclose="return WindowIsClosing();"
|
||||
title="&mainWindow.title;@PRE_RELEASE_SUFFIX@"
|
||||
title_normal="&mainWindow.title;@PRE_RELEASE_SUFFIX@"
|
||||
title="&mainWindow.title;"
|
||||
title_normal="&mainWindow.title;"
|
||||
#ifdef XP_MACOSX
|
||||
title_privatebrowsing="&mainWindow.title;@PRE_RELEASE_SUFFIX@&mainWindow.titlemodifiermenuseparator;&mainWindow.titlePrivateBrowsingSuffix;"
|
||||
titledefault="&mainWindow.title;@PRE_RELEASE_SUFFIX@"
|
||||
titledefault="&mainWindow.title;"
|
||||
titlemodifier=""
|
||||
titlemodifier_normal=""
|
||||
titlemodifier_privatebrowsing="&mainWindow.titlePrivateBrowsingSuffix;"
|
||||
#else
|
||||
title_privatebrowsing="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@ &mainWindow.titlePrivateBrowsingSuffix;"
|
||||
titlemodifier="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@"
|
||||
titlemodifier_normal="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@"
|
||||
titlemodifier_privatebrowsing="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@ &mainWindow.titlePrivateBrowsingSuffix;"
|
||||
title_privatebrowsing="&mainWindow.titlemodifier; &mainWindow.titlePrivateBrowsingSuffix;"
|
||||
titlemodifier="&mainWindow.titlemodifier;"
|
||||
titlemodifier_normal="&mainWindow.titlemodifier;"
|
||||
titlemodifier_privatebrowsing="&mainWindow.titlemodifier; &mainWindow.titlePrivateBrowsingSuffix;"
|
||||
#endif
|
||||
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
|
||||
lightweightthemes="true"
|
||||
|
||||
@@ -1791,7 +1791,7 @@
|
||||
// Prevent this tab from showing further dialogs, since we're closing it
|
||||
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
windowUtils.preventFurtherDialogs();
|
||||
windowUtils.disableDialogs();
|
||||
}
|
||||
|
||||
// Remove the tab's filter and progress listener.
|
||||
|
||||
Binary file not shown.
@@ -8,16 +8,20 @@
|
||||
#include "AboutRedirector.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsDOMString.h"
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
NS_IMPL_ISUPPORTS1(AboutRedirector, nsIAboutModule)
|
||||
NS_IMPL_ISUPPORTS(AboutRedirector, nsIAboutModule)
|
||||
|
||||
struct RedirEntry {
|
||||
const char* id;
|
||||
const char* url;
|
||||
uint32_t flags;
|
||||
const char* idbOriginPostfix;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -82,7 +86,7 @@ static RedirEntry kRedirMap[] = {
|
||||
{ "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
|
||||
nsIAboutModule::ALLOW_SCRIPT },
|
||||
};
|
||||
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);
|
||||
static const int kRedirTotal = ArrayLength(kRedirMap);
|
||||
|
||||
static nsAutoCString
|
||||
GetAboutModuleName(nsIURI *aURI)
|
||||
@@ -103,7 +107,9 @@ GetAboutModuleName(nsIURI *aURI)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
|
||||
AboutRedirector::NewChannel(nsIURI* aURI,
|
||||
nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
NS_ASSERTION(result, "must not be null");
|
||||
@@ -148,6 +154,30 @@ AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
nsAutoCString name = GetAboutModuleName(aURI);
|
||||
|
||||
for (int i = 0; i < kRedirTotal; i++) {
|
||||
if (name.Equals(kRedirMap[i].id)) {
|
||||
const char* postfix = kRedirMap[i].idbOriginPostfix;
|
||||
if (!postfix) {
|
||||
break;
|
||||
}
|
||||
|
||||
result.AssignASCII(postfix);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result)
|
||||
{
|
||||
|
||||
@@ -18,12 +18,12 @@ public:
|
||||
NS_DECL_NSIABOUTMODULE
|
||||
|
||||
AboutRedirector() {}
|
||||
virtual ~AboutRedirector() {}
|
||||
|
||||
static nsresult
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
virtual ~AboutRedirector() {}
|
||||
};
|
||||
|
||||
} // namespace browser
|
||||
|
||||
@@ -61,20 +61,20 @@ NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
|
||||
#endif
|
||||
|
||||
static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
|
||||
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
|
||||
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, nullptr, DirectoryProviderConstructor },
|
||||
#if defined(XP_WIN)
|
||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor },
|
||||
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsWindowsShellServiceConstructor },
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor },
|
||||
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsGNOMEShellServiceConstructor },
|
||||
#endif
|
||||
{ &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor },
|
||||
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
|
||||
{ &kNS_FEEDSNIFFER_CID, false, nullptr, nsFeedSnifferConstructor },
|
||||
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create },
|
||||
#if defined(XP_WIN)
|
||||
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, NULL, nsIEHistoryEnumeratorConstructor },
|
||||
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor },
|
||||
#elif defined(XP_MACOSX)
|
||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
|
||||
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor },
|
||||
#endif
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
||||
@@ -110,13 +110,13 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
||||
#elif defined(XP_MACOSX)
|
||||
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
|
||||
#endif
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
|
||||
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
|
||||
{ NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kBrowserModule = {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
NS_IMPL_ISUPPORTS2(DirectoryProvider,
|
||||
NS_IMPL_ISUPPORTS(DirectoryProvider,
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
|
||||
@@ -125,12 +125,11 @@ static void
|
||||
AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray<nsIFile> &array)
|
||||
{
|
||||
nsCOMPtr<nsIFile> searchPlugins;
|
||||
nsresult rv = aDirSvc->Get(XRE_EXECUTABLE_FILE,
|
||||
nsresult rv = aDirSvc->Get(XRE_APP_DISTRIBUTION_DIR,
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(searchPlugins));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
searchPlugins->SetNativeLeafName(NS_LITERAL_CSTRING("distribution"));
|
||||
searchPlugins->AppendNative(NS_LITERAL_CSTRING("searchplugins"));
|
||||
|
||||
bool exists;
|
||||
@@ -254,7 +253,7 @@ DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
|
||||
NS_IMPL_ISUPPORTS(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
class DirectoryProvider MOZ_FINAL : public nsIDirectoryServiceProvider2
|
||||
class DirectoryProvider final : public nsIDirectoryServiceProvider2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@@ -25,7 +25,9 @@ public:
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
|
||||
private:
|
||||
class AppendingEnumerator MOZ_FINAL : public nsISimpleEnumerator
|
||||
~DirectoryProvider() {}
|
||||
|
||||
class AppendingEnumerator final : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@@ -35,6 +37,8 @@ private:
|
||||
char const *const *aAppendList);
|
||||
|
||||
private:
|
||||
~AppendingEnumerator() {}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> mBase;
|
||||
char const *const *const mAppendList;
|
||||
nsCOMPtr<nsIFile> mNext;
|
||||
|
||||
+3
-2
@@ -27,6 +27,7 @@
|
||||
#include "nsIMIMEHeaderParam.h"
|
||||
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIURI.h"
|
||||
#include <algorithm>
|
||||
|
||||
#define TYPE_ATOM "application/atom+xml"
|
||||
@@ -38,7 +39,7 @@
|
||||
|
||||
#define MAX_BYTES 512u
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsFeedSniffer,
|
||||
NS_IMPL_ISUPPORTS(nsFeedSniffer,
|
||||
nsIContentSniffer,
|
||||
nsIStreamListener,
|
||||
nsIRequestObserver)
|
||||
@@ -207,7 +208,7 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request,
|
||||
// Check that this is a GET request, since you can't subscribe to a POST...
|
||||
nsAutoCString method;
|
||||
channel->GetRequestMethod(method);
|
||||
if (!method.Equals("GET")) {
|
||||
if (!method.EqualsLiteral("GET")) {
|
||||
sniffedType.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
+3
-1
@@ -9,7 +9,7 @@
|
||||
#include "nsStringAPI.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsFeedSniffer MOZ_FINAL : public nsIContentSniffer,
|
||||
class nsFeedSniffer final : public nsIContentSniffer,
|
||||
nsIStreamListener
|
||||
{
|
||||
public:
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
uint32_t* writeCount);
|
||||
|
||||
protected:
|
||||
~nsFeedSniffer() {}
|
||||
|
||||
nsresult ConvertEncodedData(nsIRequest* request, const uint8_t* data,
|
||||
uint32_t length);
|
||||
|
||||
+3
-3
@@ -41,11 +41,11 @@ namespace {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIEHistoryEnumerator
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsIEHistoryEnumerator, nsISimpleEnumerator)
|
||||
NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator)
|
||||
|
||||
nsIEHistoryEnumerator::nsIEHistoryEnumerator()
|
||||
{
|
||||
::CoInitialize(NULL);
|
||||
::CoInitialize(nullptr);
|
||||
}
|
||||
|
||||
nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
|
||||
@@ -60,7 +60,7 @@ nsIEHistoryEnumerator::EnsureInitialized()
|
||||
return;
|
||||
|
||||
HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
|
||||
NULL,
|
||||
nullptr,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_IUrlHistoryStg2,
|
||||
getter_AddRefs(mIEHistory));
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class nsIEHistoryEnumerator MOZ_FINAL : public nsISimpleEnumerator
|
||||
class nsIEHistoryEnumerator final : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
+11
-11
@@ -3,7 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGNOMEShellService.h"
|
||||
@@ -116,7 +116,7 @@ nsGNOMEShellService::Init()
|
||||
return appPath->GetNativePath(mAppPath);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsGNOMEShellService, nsIShellService)
|
||||
NS_IMPL_ISUPPORTS(nsGNOMEShellService, nsIShellService)
|
||||
|
||||
bool
|
||||
nsGNOMEShellService::GetAppPathFromLauncher()
|
||||
@@ -152,7 +152,7 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
|
||||
|
||||
gchar *commandPath;
|
||||
if (mUseLocaleFilenames) {
|
||||
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
|
||||
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, nullptr, nullptr, nullptr);
|
||||
if (!nativePath) {
|
||||
NS_ERROR("Error converting path to filesystem encoding");
|
||||
return false;
|
||||
@@ -182,7 +182,7 @@ nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const
|
||||
// The string will be something of the form: [/path/to/]browser "%s"
|
||||
// We want to remove all of the parameters and get just the binary name.
|
||||
|
||||
if (g_shell_parse_argv(command.get(), &argc, &argv, NULL) && argc > 0) {
|
||||
if (g_shell_parse_argv(command.get(), &argc, &argv, nullptr) && argc > 0) {
|
||||
command.Assign(argv[0]);
|
||||
g_strfreev(argv);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString brandShortName;
|
||||
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
|
||||
getter_Copies(brandShortName));
|
||||
|
||||
// use brandShortName as the application id.
|
||||
@@ -380,7 +380,7 @@ WriteImage(const nsCString& aPath, imgIContainer* aImage)
|
||||
if (!pixbuf)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", NULL, NULL);
|
||||
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);
|
||||
|
||||
g_object_unref(pixbuf);
|
||||
return res ? NS_OK : NS_ERROR_FAILURE;
|
||||
@@ -429,7 +429,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
rv = bundleService->CreateBundle(BRAND_PROPERTIES,
|
||||
getter_AddRefs(brandBundle));
|
||||
if (NS_SUCCEEDED(rv) && brandBundle) {
|
||||
rv = brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
rv = brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
|
||||
getter_Copies(brandName));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@@ -454,7 +454,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
gsettings->GetCollectionForSchema(
|
||||
NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
|
||||
if (background_settings) {
|
||||
gchar *file_uri = g_filename_to_uri(filePath.get(), NULL, NULL);
|
||||
gchar *file_uri = g_filename_to_uri(filePath.get(), nullptr, nullptr);
|
||||
if (!file_uri)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@@ -615,7 +615,7 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
|
||||
// Perform shell argument expansion
|
||||
int argc;
|
||||
char **argv;
|
||||
if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, NULL))
|
||||
if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, nullptr))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
char **newArgv = new char*[argc + 1];
|
||||
@@ -630,8 +630,8 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
|
||||
|
||||
newArgv[newArgc] = nullptr;
|
||||
|
||||
gboolean err = g_spawn_async(NULL, newArgv, NULL, G_SPAWN_SEARCH_PATH,
|
||||
NULL, NULL, NULL, NULL);
|
||||
gboolean err = g_spawn_async(nullptr, newArgv, nullptr, G_SPAWN_SEARCH_PATH,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
|
||||
g_strfreev(argv);
|
||||
delete[] newArgv;
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
#include "nsStringAPI.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsGNOMEShellService MOZ_FINAL : public nsIShellService
|
||||
class nsGNOMEShellService final : public nsIShellService
|
||||
{
|
||||
public:
|
||||
nsGNOMEShellService() : mCheckedThisSession(false), mAppIsInPath(false) { }
|
||||
+30
-20
@@ -20,6 +20,9 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsShellService.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
@@ -29,7 +32,7 @@
|
||||
|
||||
#define SAFARI_BUNDLE_IDENTIFIER "com.apple.Safari"
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsMacShellService, nsIMacShellService, nsIShellService, nsIWebProgressListener)
|
||||
NS_IMPL_ISUPPORTS(nsMacShellService, nsIMacShellService, nsIShellService, nsIWebProgressListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
@@ -40,13 +43,13 @@ nsMacShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
|
||||
CFStringRef firefoxID = ::CFBundleGetIdentifier(::CFBundleGetMainBundle());
|
||||
if (!firefoxID) {
|
||||
// CFBundleGetIdentifier is expected to return NULL only if the specified
|
||||
// CFBundleGetIdentifier is expected to return nullptr only if the specified
|
||||
// bundle doesn't have a bundle identifier in its plist. In this case, that
|
||||
// means a failure, since our bundle does have an identifier.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Get the default http handler's bundle ID (or NULL if it has not been explicitly set)
|
||||
// Get the default http handler's bundle ID (or nullptr if it has not been explicitly set)
|
||||
CFStringRef defaultBrowserID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("http"));
|
||||
if (defaultBrowserID) {
|
||||
*aIsDefaultBrowser = ::CFStringCompare(firefoxID, defaultBrowserID, 0) == kCFCompareEqualTo;
|
||||
@@ -192,8 +195,15 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
wbp->SetPersistFlags(flags);
|
||||
wbp->SetProgressListener(this);
|
||||
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
nsCOMPtr<nsISupports> container = content->OwnerDoc()->GetContainer();
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
|
||||
if (docShell) {
|
||||
loadContext = do_QueryInterface(docShell);
|
||||
}
|
||||
|
||||
return wbp->SaveURI(imageURI, nullptr, docURI, nullptr, nullptr,
|
||||
mBackgroundFile, content->OwnerDoc()->GetLoadContext());
|
||||
mBackgroundFile, loadContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -259,7 +269,7 @@ nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
OSStatus status;
|
||||
|
||||
// Convert the path into a FSRef
|
||||
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, NULL);
|
||||
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, nullptr);
|
||||
if (status == noErr) {
|
||||
err = ::FSNewAlias(nil, &pictureRef, &aliasHandle);
|
||||
if (err == noErr && aliasHandle == nil)
|
||||
@@ -312,21 +322,21 @@ nsMacShellService::OpenApplication(int32_t aApplication)
|
||||
case nsIShellService::APPLICATION_MAIL:
|
||||
{
|
||||
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
|
||||
CFSTR("mailto:"), NULL);
|
||||
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, NULL, &appURL);
|
||||
CFSTR("mailto:"), nullptr);
|
||||
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, nullptr, &appURL);
|
||||
::CFRelease(tempURL);
|
||||
}
|
||||
break;
|
||||
case nsIShellService::APPLICATION_NEWS:
|
||||
{
|
||||
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
|
||||
CFSTR("news:"), NULL);
|
||||
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, NULL, &appURL);
|
||||
CFSTR("news:"), nullptr);
|
||||
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, nullptr, &appURL);
|
||||
::CFRelease(tempURL);
|
||||
}
|
||||
break;
|
||||
case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS:
|
||||
err = ::LSGetApplicationForInfo('APPL', 'kcmr', NULL, kLSRolesAll, NULL,
|
||||
err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll, nullptr,
|
||||
&appURL);
|
||||
break;
|
||||
case nsIMacShellService::APPLICATION_NETWORK:
|
||||
@@ -356,7 +366,7 @@ nsMacShellService::OpenApplication(int32_t aApplication)
|
||||
}
|
||||
|
||||
if (appURL && err == noErr) {
|
||||
err = ::LSOpenCFURLRef(appURL, NULL);
|
||||
err = ::LSOpenCFURLRef(appURL, nullptr);
|
||||
rv = err != noErr ? NS_ERROR_FAILURE : NS_OK;
|
||||
|
||||
::CFRelease(appURL);
|
||||
@@ -394,12 +404,12 @@ nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACStrin
|
||||
|
||||
const nsCString spec(aURI);
|
||||
const UInt8* uriString = (const UInt8*)spec.get();
|
||||
CFURLRef uri = ::CFURLCreateWithBytes(NULL, uriString, aURI.Length(),
|
||||
kCFStringEncodingUTF8, NULL);
|
||||
CFURLRef uri = ::CFURLCreateWithBytes(nullptr, uriString, aURI.Length(),
|
||||
kCFStringEncodingUTF8, nullptr);
|
||||
if (!uri)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
CFArrayRef uris = ::CFArrayCreate(NULL, (const void**)&uri, 1, NULL);
|
||||
CFArrayRef uris = ::CFArrayCreate(nullptr, (const void**)&uri, 1, nullptr);
|
||||
if (!uris) {
|
||||
::CFRelease(uri);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -408,11 +418,11 @@ nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACStrin
|
||||
LSLaunchURLSpec launchSpec;
|
||||
launchSpec.appURL = appURL;
|
||||
launchSpec.itemURLs = uris;
|
||||
launchSpec.passThruParams = NULL;
|
||||
launchSpec.passThruParams = nullptr;
|
||||
launchSpec.launchFlags = kLSLaunchDefaults;
|
||||
launchSpec.asyncRefCon = NULL;
|
||||
launchSpec.asyncRefCon = nullptr;
|
||||
|
||||
OSErr err = ::LSOpenFromURLSpec(&launchSpec, NULL);
|
||||
OSErr err = ::LSOpenFromURLSpec(&launchSpec, nullptr);
|
||||
|
||||
::CFRelease(uris);
|
||||
::CFRelease(uri);
|
||||
@@ -433,11 +443,11 @@ nsMacShellService::GetDefaultFeedReader(nsIFile** _retval)
|
||||
kCFStringEncodingASCII);
|
||||
}
|
||||
|
||||
CFURLRef defaultHandlerURL = NULL;
|
||||
CFURLRef defaultHandlerURL = nullptr;
|
||||
OSStatus status = ::LSFindApplicationForInfo(kLSUnknownCreator,
|
||||
defaultHandlerID,
|
||||
NULL, // inName
|
||||
NULL, // outAppRef
|
||||
nullptr, // inName
|
||||
nullptr, // outAppRef
|
||||
&defaultHandlerURL);
|
||||
|
||||
if (status == noErr && defaultHandlerURL) {
|
||||
+118
-105
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "imgIContainer.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
@@ -27,6 +29,7 @@
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
|
||||
#include "windows.h"
|
||||
#include "shellapi.h"
|
||||
@@ -53,7 +56,11 @@
|
||||
|
||||
#define NS_TASKBAR_CONTRACTID "@mozilla.org/windows-taskbar;1"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsWindowsShellService, nsIWindowsShellService, nsIShellService)
|
||||
using mozilla::IsWin8OrLater;
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsWindowsShellService, nsIWindowsShellService, nsIShellService)
|
||||
|
||||
static nsresult
|
||||
OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
|
||||
@@ -116,7 +123,7 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
|
||||
//
|
||||
// - Windows Start Menu (XP SP1 and newer)
|
||||
// -------------------------------------------------
|
||||
// The following keys are set to make Firefox appear in the Start Menu as the
|
||||
// The following keys are set to make PaleMoon appear in the Start Menu as the
|
||||
// browser:
|
||||
//
|
||||
// HKCU\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\
|
||||
@@ -154,14 +161,18 @@ typedef struct {
|
||||
PREFIX MID
|
||||
|
||||
// The DefaultIcon registry key value should never be used when checking if
|
||||
// Firefox is the default browser for file handlers since other applications
|
||||
// PaleMoon is the default browser for file handlers since other applications
|
||||
// (e.g. MS Office) may modify the DefaultIcon registry key value to add Icon
|
||||
// Handlers. see http://msdn2.microsoft.com/en-us/library/aa969357.aspx for
|
||||
// more info. The FTP protocol is not checked so advanced users can set the FTP
|
||||
// handler to another application and still have Firefox check if it is the
|
||||
// handler to another application and still have PaleMoon check if it is the
|
||||
// default HTTP and HTTPS handler.
|
||||
// *** Do not add additional checks here unless you skip them when aForAllTypes
|
||||
// is false below***.
|
||||
static SETTING gSettings[] = {
|
||||
// File Handler Class
|
||||
// ***keep this as the first entry because when aForAllTypes is not set below
|
||||
// it will skip over this check.***
|
||||
{ MAKE_KEY_NAME1("PaleMoonHTML", SOC), VAL_OPEN, OLD_VAL_OPEN },
|
||||
|
||||
// Protocol Handler Class - for Vista and above
|
||||
@@ -175,7 +186,7 @@ static SETTING gSettings[] = {
|
||||
};
|
||||
|
||||
// The settings to disable DDE are separate from the default browser settings
|
||||
// since they are only checked when Firefox is the default browser and if they
|
||||
// since they are only checked when PaleMoon is the default browser and if they
|
||||
// are incorrect they are fixed without notifying the user.
|
||||
static SETTING gDDESettings[] = {
|
||||
// File Handler Class
|
||||
@@ -223,8 +234,8 @@ LaunchHelper(nsAutoString& aPath)
|
||||
STARTUPINFOW si = {sizeof(si), 0};
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
|
||||
if (!CreateProcessW(NULL, (LPWSTR)aPath.get(), NULL, NULL, FALSE, 0, NULL,
|
||||
NULL, &si, &pi)) {
|
||||
if (!CreateProcessW(nullptr, (LPWSTR)aPath.get(), nullptr, nullptr, FALSE,
|
||||
0, nullptr, nullptr, &si, &pi)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -310,16 +321,6 @@ nsWindowsShellService::ShortcutMaintenance()
|
||||
return LaunchHelper(appHelperPath);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsWin8OrLater()
|
||||
{
|
||||
OSVERSIONINFOW osInfo;
|
||||
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
GetVersionExW(&osInfo);
|
||||
return osInfo.dwMajorVersion > 6 ||
|
||||
(osInfo.dwMajorVersion >= 6 && osInfo.dwMinorVersion >= 2);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsAARDefaultHTTP(IApplicationAssociationRegistration* pAAR,
|
||||
bool* aIsDefaultBrowser)
|
||||
@@ -355,13 +356,19 @@ IsAARDefaultHTML(IApplicationAssociationRegistration* pAAR,
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Query's the AAR for the default status.
|
||||
* This only checks for PaleMoonURL and if aCheckAllTypes is set, then
|
||||
* it also checks for PaleMoonHTML. Note that those ProgIDs are shared
|
||||
* by all PaleMoon browsers.
|
||||
*/
|
||||
bool
|
||||
nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
|
||||
bool* aIsDefaultBrowser)
|
||||
{
|
||||
IApplicationAssociationRegistration* pAAR;
|
||||
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
|
||||
NULL,
|
||||
nullptr,
|
||||
CLSCTX_INPROC,
|
||||
IID_IApplicationAssociationRegistration,
|
||||
(void**)&pAAR);
|
||||
@@ -403,23 +410,16 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
if (aStartupCheck)
|
||||
mCheckedThisSession = true;
|
||||
|
||||
// Check if we only care about a lightweight check, and make sure this
|
||||
// only has an effect on Win8 and later.
|
||||
if (!aForAllTypes && IsWin8OrLater()) {
|
||||
return IsDefaultBrowserVista(false,
|
||||
aIsDefaultBrowser) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Assume we're the default unless one of the several checks below tell us
|
||||
// otherwise.
|
||||
*aIsDefaultBrowser = true;
|
||||
|
||||
PRUnichar exePath[MAX_BUF];
|
||||
wchar_t exePath[MAX_BUF];
|
||||
if (!::GetModuleFileNameW(0, exePath, MAX_BUF))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Convert the path to a long path since GetModuleFileNameW returns the path
|
||||
// that was used to launch Firefox which is not necessarily a long path.
|
||||
// that was used to launch PaleMoon which is not necessarily a long path.
|
||||
if (!::GetLongPathNameW(exePath, exePath, MAX_BUF))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@@ -428,12 +428,17 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
HKEY theKey;
|
||||
DWORD res;
|
||||
nsresult rv;
|
||||
PRUnichar currValue[MAX_BUF];
|
||||
wchar_t currValue[MAX_BUF];
|
||||
|
||||
SETTING* settings = gSettings;
|
||||
if (!aForAllTypes && IsWin8OrLater()) {
|
||||
// Skip over the file handler check
|
||||
settings++;
|
||||
}
|
||||
|
||||
SETTING* settings;
|
||||
SETTING* end = gSettings + sizeof(gSettings) / sizeof(SETTING);
|
||||
|
||||
for (settings = gSettings; settings < end; ++settings) {
|
||||
for (; settings < end; ++settings) {
|
||||
NS_ConvertUTF8toUTF16 keyName(settings->keyName);
|
||||
NS_ConvertUTF8toUTF16 valueData(settings->valueData);
|
||||
int32_t offset = valueData.Find("%APPPATH%");
|
||||
@@ -447,17 +452,18 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
DWORD len = sizeof currValue;
|
||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue, &len);
|
||||
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr,
|
||||
(LPBYTE)currValue, &len);
|
||||
// Close the key that was opened.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res) ||
|
||||
!valueData.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
_wcsicmp(valueData.get(), currValue)) {
|
||||
// Key wasn't set or was set to something other than our registry entry.
|
||||
NS_ConvertUTF8toUTF16 oldValueData(settings->oldValueData);
|
||||
offset = oldValueData.Find("%APPPATH%");
|
||||
oldValueData.Replace(offset, 9, appLongPath);
|
||||
// The current registry value doesn't match the current or the old format.
|
||||
if (!oldValueData.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
if (_wcsicmp(oldValueData.get(), currValue)) {
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -466,7 +472,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
0, KEY_SET_VALUE, &theKey);
|
||||
if (REG_FAILED(res)) {
|
||||
// If updating the open command fails try to update it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
// application when setting PaleMoon as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -474,30 +480,30 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
const nsString &flatValue = PromiseFlatString(valueData);
|
||||
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
|
||||
(const BYTE *) flatValue.get(),
|
||||
(flatValue.Length() + 1) * sizeof(PRUnichar));
|
||||
(flatValue.Length() + 1) * sizeof(char16_t));
|
||||
// Close the key that was created.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res)) {
|
||||
// If updating the open command fails try to update it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
// application when setting PaleMoon as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only check if Firefox is the default browser on Vista and above if the
|
||||
// previous checks show that Firefox is the default browser.
|
||||
// Only check if PaleMoon is the default browser on Vista and above if the
|
||||
// previous checks show that PaleMoon is the default browser.
|
||||
if (*aIsDefaultBrowser) {
|
||||
IsDefaultBrowserVista(true, aIsDefaultBrowser);
|
||||
IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser);
|
||||
}
|
||||
|
||||
// To handle the case where DDE isn't disabled due for a user because there
|
||||
// account didn't perform a Firefox update this will check if Firefox is the
|
||||
// account didn't perform a PaleMoon update this will check if PaleMoon is the
|
||||
// default browser and if dde is disabled for each handler
|
||||
// and if it isn't disable it. When Firefox is not the default browser the
|
||||
// and if it isn't disable it. When PaleMoon is not the default browser the
|
||||
// helper application will disable dde for each handler.
|
||||
if (*aIsDefaultBrowser) {
|
||||
if (*aIsDefaultBrowser && aForAllTypes) {
|
||||
// Check ftp settings
|
||||
|
||||
end = gDDESettings + sizeof(gDDESettings) / sizeof(SETTING);
|
||||
@@ -509,39 +515,39 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
if (NS_FAILED(rv)) {
|
||||
::RegCloseKey(theKey);
|
||||
// If disabling DDE fails try to disable it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
// application when setting PaleMoon as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
DWORD len = sizeof currValue;
|
||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
|
||||
&len);
|
||||
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr,
|
||||
(LPBYTE)currValue, &len);
|
||||
// Close the key that was opened.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res) || PRUnichar('\0') != *currValue) {
|
||||
if (REG_FAILED(res) || char16_t('\0') != *currValue) {
|
||||
// Key wasn't set or was set to something other than our registry entry.
|
||||
// Delete the key along with all of its childrean and then recreate it.
|
||||
const nsString &flatName = PromiseFlatString(keyName);
|
||||
::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
|
||||
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
|
||||
&theKey, NULL);
|
||||
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr,
|
||||
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE,
|
||||
nullptr, &theKey, nullptr);
|
||||
if (REG_FAILED(res)) {
|
||||
// If disabling DDE fails try to disable it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
// application when setting PaleMoon as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, (const BYTE *) L"",
|
||||
sizeof(PRUnichar));
|
||||
sizeof(char16_t));
|
||||
// Close the key that was created.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res)) {
|
||||
// If disabling DDE fails try to disable it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
// application when setting PaleMoon as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -564,13 +570,13 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
DWORD len = sizeof currValue;
|
||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
|
||||
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue,
|
||||
&len);
|
||||
|
||||
// Don't update the FTP protocol handler's shell open command when the
|
||||
// current registry value doesn't exist or matches the old format.
|
||||
if (REG_FAILED(res) ||
|
||||
!oldValueOpen.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
_wcsicmp(oldValueOpen.get(), currValue)) {
|
||||
::RegCloseKey(theKey);
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -580,11 +586,11 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
const nsString &flatValue = PromiseFlatString(valueData);
|
||||
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
|
||||
(const BYTE *) flatValue.get(),
|
||||
(flatValue.Length() + 1) * sizeof(PRUnichar));
|
||||
(flatValue.Length() + 1) * sizeof(char16_t));
|
||||
// Close the key that was created.
|
||||
::RegCloseKey(theKey);
|
||||
// If updating the FTP protocol handlers shell open command fails try to
|
||||
// update it using the helper application when setting Firefox as the
|
||||
// update it using the helper application when setting PaleMoon as the
|
||||
// default browser.
|
||||
if (REG_FAILED(res)) {
|
||||
*aIsDefaultBrowser = false;
|
||||
@@ -604,29 +610,26 @@ nsWindowsShellService::GetCanSetDesktopBackground(bool* aResult)
|
||||
static nsresult
|
||||
DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
|
||||
{
|
||||
typedef HRESULT (WINAPI * SHOpenWithDialogPtr)(HWND hwndParent,
|
||||
const OPENASINFO *poainfo);
|
||||
static SHOpenWithDialogPtr SHOpenWithDialogFn = NULL;
|
||||
if (!SHOpenWithDialogFn) {
|
||||
// shell32.dll is in the knownDLLs list so will always be loaded from the
|
||||
// system32 directory.
|
||||
static const PRUnichar kSehllLibraryName[] = L"shell32.dll";
|
||||
HMODULE shellDLL = ::LoadLibraryW(kSehllLibraryName);
|
||||
if (!shellDLL) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SHOpenWithDialogFn =
|
||||
(SHOpenWithDialogPtr)GetProcAddress(shellDLL, "SHOpenWithDialog");
|
||||
FreeLibrary(shellDLL);
|
||||
|
||||
if (!SHOpenWithDialogFn) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// shell32.dll is in the knownDLLs list so will always be loaded from the
|
||||
// system32 directory.
|
||||
static const wchar_t kSehllLibraryName[] = L"shell32.dll";
|
||||
HMODULE shellDLL = ::LoadLibraryW(kSehllLibraryName);
|
||||
if (!shellDLL) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return SUCCEEDED(SHOpenWithDialogFn(hwndParent, poainfo)) ? NS_OK :
|
||||
NS_ERROR_FAILURE;
|
||||
decltype(SHOpenWithDialog)* SHOpenWithDialogFn =
|
||||
(decltype(SHOpenWithDialog)*) GetProcAddress(shellDLL, "SHOpenWithDialog");
|
||||
|
||||
if (!SHOpenWithDialogFn) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
SUCCEEDED(SHOpenWithDialogFn(hwndParent, poainfo)) ? NS_OK :
|
||||
NS_ERROR_FAILURE;
|
||||
FreeLibrary(shellDLL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -650,8 +653,8 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
|
||||
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_SHOWDEFAULT;
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
if (!CreateProcessW(controlEXEPath, params, NULL, NULL, FALSE, 0, NULL,
|
||||
NULL, &si, &pi)) {
|
||||
if (!CreateProcessW(controlEXEPath, params, nullptr, nullptr, FALSE,
|
||||
0, nullptr, nullptr, &si, &pi)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
CloseHandle(pi.hProcess);
|
||||
@@ -665,11 +668,11 @@ nsWindowsShellService::LaunchHTTPHandlerPane()
|
||||
{
|
||||
OPENASINFO info;
|
||||
info.pcszFile = L"http";
|
||||
info.pcszClass = NULL;
|
||||
info.pcszClass = nullptr;
|
||||
info.oaifInFlags = OAIF_FORCE_REGISTRATION |
|
||||
OAIF_URL_PROTOCOL |
|
||||
OAIF_REGISTER_EXT;
|
||||
return DynSHOpenWithDialog(NULL, &info);
|
||||
return DynSHOpenWithDialog(nullptr, &info);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -750,22 +753,25 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsRefPtr<gfxASurface> surface;
|
||||
aImage->GetFrame(imgIContainer::FRAME_FIRST,
|
||||
imgIContainer::FLAG_SYNC_DECODE,
|
||||
getter_AddRefs(surface));
|
||||
RefPtr<SourceSurface> surface =
|
||||
aImage->GetFrame(imgIContainer::FRAME_FIRST,
|
||||
imgIContainer::FLAG_SYNC_DECODE);
|
||||
NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<gfxImageSurface> image(surface->GetAsReadableARGB32ImageSurface());
|
||||
NS_ENSURE_TRUE(image, NS_ERROR_FAILURE);
|
||||
// For either of the following formats we want to set the biBitCount member
|
||||
// of the BITMAPINFOHEADER struct to 32, below. For that value the bitmap
|
||||
// format defines that the A8/X8 WORDs in the bitmap byte stream be ignored
|
||||
// for the BI_RGB value we use for the biCompression member.
|
||||
MOZ_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8A8 ||
|
||||
surface->GetFormat() == SurfaceFormat::B8G8R8X8);
|
||||
|
||||
int32_t width = image->Width();
|
||||
int32_t height = image->Height();
|
||||
RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
|
||||
NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
|
||||
|
||||
uint8_t* bits = image->Data();
|
||||
uint32_t length = image->GetDataSize();
|
||||
uint32_t bpr = uint32_t(image->Stride());
|
||||
int32_t bitCount = bpr/width;
|
||||
int32_t width = dataSurface->GetSize().width;
|
||||
int32_t height = dataSurface->GetSize().height;
|
||||
int32_t bytesPerPixel = 4 * sizeof(uint8_t);
|
||||
uint32_t bytesPerRow = bytesPerPixel * width;
|
||||
|
||||
// initialize these bitmap structs which we will later
|
||||
// serialize directly to the head of the bitmap file
|
||||
@@ -774,9 +780,9 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
|
||||
bmi.biWidth = width;
|
||||
bmi.biHeight = height;
|
||||
bmi.biPlanes = 1;
|
||||
bmi.biBitCount = (WORD)bitCount*8;
|
||||
bmi.biBitCount = (WORD)bytesPerPixel*8;
|
||||
bmi.biCompression = BI_RGB;
|
||||
bmi.biSizeImage = length;
|
||||
bmi.biSizeImage = bytesPerRow * height;
|
||||
bmi.biXPelsPerMeter = 0;
|
||||
bmi.biYPelsPerMeter = 0;
|
||||
bmi.biClrUsed = 0;
|
||||
@@ -794,6 +800,11 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(stream), aFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// write the bitmap headers and rgb pixel data to the file
|
||||
rv = NS_ERROR_FAILURE;
|
||||
if (stream) {
|
||||
@@ -804,11 +815,11 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
|
||||
if (written == sizeof(BITMAPINFOHEADER)) {
|
||||
// write out the image data backwards because the desktop won't
|
||||
// show bitmaps with negative heights for top-to-bottom
|
||||
uint32_t i = length;
|
||||
uint32_t i = map.mStride * height;
|
||||
do {
|
||||
i -= bpr;
|
||||
stream->Write(((const char*)bits) + i, bpr, &written);
|
||||
if (written == bpr) {
|
||||
i -= map.mStride;
|
||||
stream->Write(((const char*)map.mData) + i, bytesPerRow, &written);
|
||||
if (written == bytesPerRow) {
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
@@ -821,6 +832,8 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
|
||||
stream->Close();
|
||||
}
|
||||
|
||||
dataSurface->Unmap();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -866,7 +879,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
// e.g. "Desktop Background.bmp"
|
||||
nsString fileLeafName;
|
||||
rv = shellBundle->GetStringFromName
|
||||
(NS_LITERAL_STRING("desktopBackgroundLeafNameWin").get(),
|
||||
(MOZ_UTF16("desktopBackgroundLeafNameWin"),
|
||||
getter_Copies(fileLeafName));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -876,7 +889,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
getter_AddRefs(file));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// eventually, the path is "%APPDATA%\Mozilla\Firefox\Desktop Background.bmp"
|
||||
// eventually, the path is "%APPDATA%\Mozilla\PaleMoon\Desktop Background.bmp"
|
||||
rv = file->Append(fileLeafName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -965,7 +978,7 @@ nsWindowsShellService::OpenApplication(int32_t aApplication)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRUnichar buf[MAX_BUF];
|
||||
wchar_t buf[MAX_BUF];
|
||||
DWORD type, len = sizeof buf;
|
||||
DWORD res = ::RegQueryValueExW(theKey, EmptyString().get(), 0,
|
||||
&type, (LPBYTE)&buf, &len);
|
||||
@@ -1028,8 +1041,8 @@ nsWindowsShellService::OpenApplication(int32_t aApplication)
|
||||
::ZeroMemory(&si, sizeof(STARTUPINFOW));
|
||||
::ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
BOOL success = ::CreateProcessW(NULL, (LPWSTR)path.get(), NULL,
|
||||
NULL, FALSE, 0, NULL, NULL,
|
||||
BOOL success = ::CreateProcessW(nullptr, (LPWSTR)path.get(), nullptr,
|
||||
nullptr, FALSE, 0, nullptr, nullptr,
|
||||
&si, &pi);
|
||||
if (!success)
|
||||
return NS_ERROR_FAILURE;
|
||||
@@ -1066,7 +1079,7 @@ nsWindowsShellService::SetDesktopBackgroundColor(uint32_t aColor)
|
||||
nsIWindowsRegKey::ACCESS_SET_VALUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUnichar rgb[12];
|
||||
wchar_t rgb[12];
|
||||
_snwprintf(rgb, 12, L"%u %u %u", r, g, b);
|
||||
|
||||
rv = regKey->WriteStringValue(NS_LITERAL_STRING("Background"),
|
||||
@@ -787,7 +787,7 @@ Application.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
#include ../../../toolkit/components/exthelper/extApplication.js
|
||||
#include ../../toolkit/components/exthelper/extApplication.js
|
||||
|
||||
// set the proto, defined in extApplication.js
|
||||
Application.prototype.__proto__ = extApplication.prototype;
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!ENTITY charsetMenu.label "Character Encoding">
|
||||
<!ENTITY charsetMenu.accesskey "C">
|
||||
<!ENTITY charsetMenuAutodet.label "Auto-Detect">
|
||||
<!ENTITY charsetMenuAutodet.accesskey "D"><!-- A reserved for Arabic -->
|
||||
|
||||
<!ENTITY charsetMenuAutodet.off.label "(off)">
|
||||
<!ENTITY charsetMenuAutodet.off.accesskey "o">
|
||||
<!ENTITY charsetMenuAutodet.ja.label "Japanese">
|
||||
<!ENTITY charsetMenuAutodet.ja.accesskey "J">
|
||||
<!ENTITY charsetMenuAutodet.ru.label "Russian">
|
||||
<!ENTITY charsetMenuAutodet.ru.accesskey "R">
|
||||
<!ENTITY charsetMenuAutodet.uk.label "Ukrainian">
|
||||
<!ENTITY charsetMenuAutodet.uk.accesskey "U">
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# LOCALIZATION NOTE: The property keys ending with ".key" are for access keys.
|
||||
# Localizations may add or delete properties where the property key ends with
|
||||
# ".key" as appropriate for the localization. The code that uses this data can
|
||||
# deal with the absence of an access key for an item.
|
||||
#
|
||||
# Make sure the keys defined here don't collide with
|
||||
# charsetMenuAutodet.accesskey in charsetMenu.dtd.
|
||||
#
|
||||
# In the en-US version of this file, access keys are given to the following:
|
||||
# * UTF-8
|
||||
# * All encodings that are the fallback encoding for some locale in Firefox
|
||||
# * All encodings that are the fallback encoding for some locale in IE
|
||||
# * All Japanese encodings
|
||||
#
|
||||
# For the items whose property key does not end in ".key" and whose value
|
||||
# includes "(" U+0028 LEFT PARENTHESIS, the "(" character is significant for
|
||||
# processing by CharsetMenu.jsm. If your localization does not use ASCII
|
||||
# parentheses where en-US does in this file, please file a bug to make
|
||||
# CharsetMenu.jsm also recognize the delimiter your localization uses.
|
||||
# (When this code was developed, all localizations appeared to use
|
||||
# U+0028 LEFT PARENTHESIS for this purpose.)
|
||||
|
||||
# Globally-relevant
|
||||
UTF-8.key = U
|
||||
UTF-8 = Unicode
|
||||
windows-1252.key = W
|
||||
windows-1252 = Western
|
||||
|
||||
# Arabic
|
||||
windows-1256.key = A
|
||||
windows-1256 = Arabic (Windows)
|
||||
ISO-8859-6 = Arabic (ISO)
|
||||
|
||||
# Baltic
|
||||
windows-1257.key = B
|
||||
windows-1257 = Baltic (Windows)
|
||||
ISO-8859-4 = Baltic (ISO)
|
||||
|
||||
# Central European
|
||||
windows-1250.key = E
|
||||
windows-1250 = Central European (Windows)
|
||||
ISO-8859-2.key = l
|
||||
ISO-8859-2 = Central European (ISO)
|
||||
|
||||
# Chinese, Simplified
|
||||
gbk.key = S
|
||||
gbk = Chinese, Simplified (GBK)
|
||||
gb18030 = Chinese, Simplified (GB18030)
|
||||
|
||||
# Chinese, Traditional
|
||||
Big5.key = T
|
||||
Big5 = Chinese, Traditional
|
||||
|
||||
# Cyrillic
|
||||
windows-1251.key = C
|
||||
windows-1251 = Cyrillic (Windows)
|
||||
ISO-8859-5 = Cyrillic (ISO)
|
||||
KOI8-R = Cyrillic (KOI8-R)
|
||||
KOI8-U = Cyrillic (KOI8-U)
|
||||
IBM866 = Cyrillic (DOS)
|
||||
|
||||
# Greek
|
||||
windows-1253.key = G
|
||||
windows-1253 = Greek (Windows)
|
||||
ISO-8859-7.key = O
|
||||
ISO-8859-7 = Greek (ISO)
|
||||
|
||||
# Hebrew
|
||||
windows-1255.key = H
|
||||
windows-1255 = Hebrew
|
||||
# LOCALIZATION NOTE (ISO-8859-8): The value for this item should begin with
|
||||
# the same word for Hebrew as the value for windows-1255 so that this item
|
||||
# sorts right after that one in the collation order for your locale.
|
||||
ISO-8859-8 = Hebrew, Visual
|
||||
|
||||
# Japanese
|
||||
Shift_JIS.key = J
|
||||
Shift_JIS = Japanese (Shift_JIS)
|
||||
EUC-JP.key = p
|
||||
EUC-JP = Japanese (EUC-JP)
|
||||
ISO-2022-JP.key = n
|
||||
ISO-2022-JP = Japanese (ISO-2022-JP)
|
||||
|
||||
# Korean
|
||||
EUC-KR.key = K
|
||||
EUC-KR = Korean
|
||||
|
||||
# Thai
|
||||
windows-874.key = i
|
||||
windows-874 = Thai
|
||||
|
||||
# Turkish
|
||||
windows-1254.key = r
|
||||
windows-1254 = Turkish
|
||||
|
||||
# Vietnamese
|
||||
windows-1258.key = V
|
||||
windows-1258 = Vietnamese
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!-- extracted from charsetOverlay.xul -->
|
||||
<!ENTITY charsetMenu.label "Character Encoding">
|
||||
<!ENTITY charsetMenu.accesskey "C">
|
||||
<!ENTITY charsetMenuAutodet.label "Auto-Detect">
|
||||
<!ENTITY charsetMenuAutodet.accesskey "a">
|
||||
<!ENTITY charsetMenuMore.label "More Encodings">
|
||||
<!ENTITY charsetMenuMore.accesskey "m">
|
||||
<!ENTITY charsetMenuMore1.label "West European">
|
||||
<!ENTITY charsetMenuMore1.accesskey "w">
|
||||
<!ENTITY charsetMenuMore2.label "East European">
|
||||
<!ENTITY charsetMenuMore2.accesskey "E">
|
||||
<!ENTITY charsetMenuMore3.label "East Asian">
|
||||
<!ENTITY charsetMenuMore3.accesskey "A">
|
||||
<!ENTITY charsetMenuMore4.label "SE & SW Asian">
|
||||
<!ENTITY charsetMenuMore4.accesskey "S">
|
||||
<!ENTITY charsetMenuMore5.label "Middle Eastern">
|
||||
<!ENTITY charsetMenuMore5.accesskey "M">
|
||||
<!ENTITY charsetCustomize.label "Customize List…">
|
||||
<!ENTITY charsetCustomize.accesskey "c">
|
||||
Reference in New Issue
Block a user