diff options
Diffstat (limited to 'application')
105 files changed, 2897 insertions, 2057 deletions
diff --git a/application/palemoon/app.mozbuild b/application/palemoon/app.mozbuild index 0cbce0f72..1727d4f6b 100644 --- a/application/palemoon/app.mozbuild +++ b/application/palemoon/app.mozbuild @@ -13,5 +13,5 @@ DIRS += ['/%s' % CONFIG['MOZ_BRANDING_DIRECTORY']] # Never add tier dirs after browser because they apparently won't get # packaged properly on Mac. -DIRS += ['/browser'] +DIRS += ['/application/palemoon'] diff --git a/application/palemoon/app/blocklist.xml b/application/palemoon/app/blocklist.xml index 9c64af987..296b8ad24 100644 --- a/application/palemoon/app/blocklist.xml +++ b/application/palemoon/app/blocklist.xml @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<blocklist lastupdate="1508456048000" +<blocklist lastupdate="1521130300000" xmlns="http://www.mozilla.org/2006/addons-blocklist"> <emItems> <emItem blockID="i545" id="superlrcs@svenyor.net"> @@ -2441,6 +2441,18 @@ xmlns="http://www.mozilla.org/2006/addons-blocklist"> <versionRange minVersion="4.0.0a" maxVersion="4.1.20a" severity="1" /> </emItem> + <emItem blockID="2447476f-043b-4d0b-9d3c-8e859c97d950" id="{44e4b2cf-77ba-4f76-aca7-f3fcbc2dda2f}"> + <prefs/> + <versionRange minVersion="0" maxVersion="*" severity="3"/> + </emItem> + <emItem blockID="f58729ec-f93c-41d9-870d-dd9c9fd811b6" id="/^(addon@fasterweb\.com|\{5f398d3f-25db-47f5-b422-aa2364ff6c0b\}|addon@fasterp\.com|addon@calculator)$/"> + <prefs/> + <versionRange minVersion="0" maxVersion="*" severity="3"/> + </emItem> + <emItem blockID="3d55fab0-ec1a-4bca-84c9-3b74f5d01509" id="/^.*extension.*@asdf\.pl$/"> + <prefs/> + <versionRange minVersion="0" maxVersion="*" severity="3"/> + </emItem> <emItem blockID="pm100" id="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}"> <versionRange minVersion="0" maxVersion="*" severity="1"> </versionRange> diff --git a/application/palemoon/app/macbuild/Contents/Info.plist.in b/application/palemoon/app/macbuild/Contents/Info.plist.in index c77ab1ec5..b224064cf 100644 --- a/application/palemoon/app/macbuild/Contents/Info.plist.in +++ b/application/palemoon/app/macbuild/Contents/Info.plist.in @@ -205,6 +205,11 @@ <true/> <key>LSApplicationCategoryType</key> <string>public.app-category.productivity</string> + <key>LSEnvironment</key> + <dict> + <key>MallocNanoZone</key> + <string>0</string> + </dict> <key>LSMinimumSystemVersion</key> <string>10.6</string> <key>LSMinimumSystemVersionByArchitecture</key> diff --git a/application/palemoon/app/moz.build b/application/palemoon/app/moz.build index 929139a6a..8b358b622 100644 --- a/application/palemoon/app/moz.build +++ b/application/palemoon/app/moz.build @@ -7,12 +7,9 @@ DIRS += ['profile/extensions'] -if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_ASAN']: - GoannaProgram(CONFIG['MOZ_APP_NAME']) -else: - GoannaProgram(CONFIG['MOZ_APP_NAME'], msvcrt='static') +GeckoProgram(CONFIG['MOZ_APP_NAME']) -JS_PREFERENCE_FILES += [ +JS_PREFERENCE_PP_FILES += [ 'profile/palemoon.js', ] @@ -30,14 +27,8 @@ FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js'] DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] -for var in ('MOZILLA_OFFICIAL', 'LIBXUL_SDK'): - if CONFIG[var]: - DEFINES[var] = True - -DEFINES['XPCOM_GLUE'] = True - -GENERATED_INCLUDES += [ - '/build', +LOCAL_INCLUDES += [ + '!/build', ] LOCAL_INCLUDES += [ @@ -46,11 +37,9 @@ LOCAL_INCLUDES += [ '/xpcom/build', ] -DELAYLOAD_DLLS += [ - 'mozglue.dll', +USE_LIBS += [ + 'mozglue', ] -USE_STATIC_LIBS = True - if CONFIG['_MSC_VER']: # Always enter a Windows program through wmain, whether or not we're @@ -72,16 +61,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']: LDFLAGS += ['/HEAP:0x40000'] -if CONFIG['OS_ARCH'] == 'WINNT': - USE_LIBS += [ - 'mozglue', - 'xpcomglue_staticruntime', - ] -else: - USE_LIBS += [ - 'xpcomglue', - ] - DISABLE_STL_WRAPPING = True if CONFIG['MOZ_LINKER']: diff --git a/application/palemoon/app/nsBrowserApp.cpp b/application/palemoon/app/nsBrowserApp.cpp index f9645b0c6..5b866d6b4 100644 --- a/application/palemoon/app/nsBrowserApp.cpp +++ b/application/palemoon/app/nsBrowserApp.cpp @@ -8,25 +8,13 @@ #include "application.ini.h" #include "nsXPCOMGlue.h" #if defined(XP_WIN) -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <windows.h> -#include <winbase.h> -#include <VersionHelpers.h> #include <stdlib.h> -#include <io.h> -#include <fcntl.h> #elif defined(XP_UNIX) #include <sys/resource.h> -#include <time.h> #include <unistd.h> #endif -#ifdef XP_MACOSX -#include <mach/mach_time.h> -#include "MacQuirks.h" -#endif - #include <stdio.h> #include <stdarg.h> #include <time.h> @@ -35,20 +23,26 @@ #include "nsIFile.h" #include "nsStringGlue.h" -// Easy access to a five second startup delay used to get -// a debugger attached in the metro environment. -// #define DEBUG_delay_start_metro - #ifdef XP_WIN -// we want a wmain entry point -#include "nsWindowsWMain.cpp" -#define snprintf _snprintf +#define XRE_WANT_ENVIRON #define strcasecmp _stricmp +#ifdef MOZ_SANDBOX +#include "mozilla/sandboxing/SandboxInitialization.h" +#endif #endif #include "BinaryPath.h" #include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL -#include "mozilla/StartupTimeline.h" + +#include "mozilla/Sprintf.h" +#include "mozilla/Telemetry.h" +#include "mozilla/WindowsDllBlocklist.h" + +#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID) \ + && !(defined(XP_LINUX) && defined(MOZ_SANDBOX)) +#define MOZ_BROWSER_CAN_BE_CONTENTPROC +#include "../../ipc/contentproc/plugin-container.cpp" +#endif using namespace mozilla; @@ -56,12 +50,6 @@ using namespace mozilla; #define kOSXResourcesFolder "Resources" #endif #define kDesktopFolder "browser" -#define kMetroFolder "metro" -#define kMetroAppIniFilename "metroapp.ini" -#ifdef XP_WIN -#define kMetroTestFile "tests.ini" -const char* kMetroConsoleIdParam = "testconsoleid="; -#endif static void Output(const char *fmt, ... ) { @@ -84,10 +72,19 @@ static void Output(const char *fmt, ... ) #if MOZ_WINCONSOLE fwprintf_s(stderr, wide_msg); #else - MessageBoxW(nullptr, - wide_msg, - L"Pale Moon", - MB_OK | MB_ICONERROR | MB_SETFOREGROUND); + // Linking user32 at load-time interferes with the DLL blocklist (bug 932100). + // This is a rare codepath, so we can load user32 at run-time instead. + HMODULE user32 = LoadLibraryW(L"user32.dll"); + if (user32) { + decltype(MessageBoxW)* messageBoxW = + (decltype(MessageBoxW)*) GetProcAddress(user32, "MessageBoxW"); + if (messageBoxW) { + messageBoxW(nullptr, wide_msg, L"Pale Moon", MB_OK + | MB_ICONERROR + | MB_SETFOREGROUND); + } + FreeLibrary(user32); + } #endif #endif @@ -114,76 +111,60 @@ static bool IsArg(const char* arg, const char* s) return false; } -#ifdef XP_WIN -/* - * AttachToTestHarness - Windows helper for when we are running - * in the immersive environment. Firefox is launched by Windows in - * response to a request by metrotestharness, which is launched by - * runtests.py. As such stdout in fx doesn't point to the right - * stream. This helper touches up stdout such that test output gets - * routed to a named pipe metrotestharness creates and dumps to its - * stdout. - */ -static void AttachToTestHarness() -{ - // attach to the metrotestharness named logging pipe - HANDLE winOut = CreateFileA("\\\\.\\pipe\\metrotestharness", - GENERIC_WRITE, - FILE_SHARE_WRITE, 0, - OPEN_EXISTING, 0, 0); - - if (winOut == INVALID_HANDLE_VALUE) { - OutputDebugStringW(L"Could not create named logging pipe.\n"); - return; - } - - // Set the c runtime handle - int stdOut = _open_osfhandle((intptr_t)winOut, _O_APPEND); - if (stdOut == -1) { - OutputDebugStringW(L"Could not open c-runtime handle.\n"); - return; - } - FILE *fp = _fdopen(stdOut, "a"); - *stdout = *fp; -} -#endif - XRE_GetFileFromPathType XRE_GetFileFromPath; XRE_CreateAppDataType XRE_CreateAppData; XRE_FreeAppDataType XRE_FreeAppData; -#ifdef XRE_HAS_DLL_BLOCKLIST -XRE_SetupDllBlocklistType XRE_SetupDllBlocklist; -#endif +XRE_TelemetryAccumulateType XRE_TelemetryAccumulate; XRE_StartupTimelineRecordType XRE_StartupTimelineRecord; XRE_mainType XRE_main; XRE_StopLateWriteChecksType XRE_StopLateWriteChecks; +XRE_XPCShellMainType XRE_XPCShellMain; +XRE_GetProcessTypeType XRE_GetProcessType; +XRE_SetProcessTypeType XRE_SetProcessType; +XRE_InitChildProcessType XRE_InitChildProcess; +XRE_EnableSameExecutableForContentProcType XRE_EnableSameExecutableForContentProc; +#ifdef LIBFUZZER +XRE_LibFuzzerSetMainType XRE_LibFuzzerSetMain; +XRE_LibFuzzerGetFuncsType XRE_LibFuzzerGetFuncs; +#endif static const nsDynamicFunctionLoad kXULFuncs[] = { { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath }, { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData }, { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData }, -#ifdef XRE_HAS_DLL_BLOCKLIST - { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist }, -#endif + { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate }, { "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord }, { "XRE_main", (NSFuncPtr*) &XRE_main }, { "XRE_StopLateWriteChecks", (NSFuncPtr*) &XRE_StopLateWriteChecks }, + { "XRE_XPCShellMain", (NSFuncPtr*) &XRE_XPCShellMain }, + { "XRE_GetProcessType", (NSFuncPtr*) &XRE_GetProcessType }, + { "XRE_SetProcessType", (NSFuncPtr*) &XRE_SetProcessType }, + { "XRE_InitChildProcess", (NSFuncPtr*) &XRE_InitChildProcess }, + { "XRE_EnableSameExecutableForContentProc", (NSFuncPtr*) &XRE_EnableSameExecutableForContentProc }, +#ifdef LIBFUZZER + { "XRE_LibFuzzerSetMain", (NSFuncPtr*) &XRE_LibFuzzerSetMain }, + { "XRE_LibFuzzerGetFuncs", (NSFuncPtr*) &XRE_LibFuzzerGetFuncs }, +#endif { nullptr, nullptr } }; -static int do_main(int argc, char* argv[], nsIFile *xreDirectory) +#ifdef LIBFUZZER +int libfuzzer_main(int argc, char **argv); + +/* This wrapper is used by the libFuzzer main to call into libxul */ + +void libFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, + LibFuzzerTestingFunc* testingFunc) { + return XRE_LibFuzzerGetFuncs(moduleName, initFunc, testingFunc); +} +#endif + +static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory) { nsCOMPtr<nsIFile> appini; nsresult rv; uint32_t mainFlags = 0; -#ifdef XP_WIN - if (!IsWindowsVistaOrGreater()) { - Output("Couldn't load valid PE image.\n"); - return 255; - } - -#endif // Allow palemoon.exe to launch XULRunner apps via -app <application.ini> // Note that -app must be the *first* argument. const char *appDataFile = getenv("XUL_APP_FILE"); @@ -207,14 +188,26 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) } char appEnv[MAXPATHLEN]; - snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]); - if (putenv(appEnv)) { + SprintfLiteral(appEnv, "XUL_APP_FILE=%s", argv[2]); + if (putenv(strdup(appEnv))) { Output("Couldn't set %s.\n", appEnv); return 255; } argv[2] = argv[0]; argv += 2; argc -= 2; + } else if (argc > 1 && IsArg(argv[1], "xpcshell")) { + for (int i = 1; i < argc; i++) { + argv[i] = argv[i + 1]; + } + + XREShellData shellData; +#if defined(XP_WIN) && defined(MOZ_SANDBOX) + shellData.sandboxBrokerServices = + sandboxing::GetInitializedBrokerServices(); +#endif + + return XRE_XPCShellMain(--argc, argv, envp, &shellData); } if (appini) { @@ -224,6 +217,13 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) Output("Couldn't read application.ini"); return 255; } +#if defined(HAS_DLL_BLOCKLIST) + // The dll blocklist operates in the exe vs. xullib. Pass a flag to + // xullib so automated tests can check the result once the browser + // is up and running. + appData->flags |= + DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0; +#endif // xreDirectory already has a refcount from NS_NewLocalFile appData->xreDirectory = xreDirectory; int result = XRE_main(argc, argv, appData, mainFlags); @@ -231,7 +231,6 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) return result; } - // Desktop browser launch ScopedAppData appData(&sAppData); nsCOMPtr<nsIFile> exeFile; rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile)); @@ -243,10 +242,7 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) nsCOMPtr<nsIFile> greDir; exeFile->GetParent(getter_AddRefs(greDir)); #ifdef XP_MACOSX - nsCOMPtr<nsIFile> parent; - greDir->GetParent(getter_AddRefs(parent)); - greDir = parent.forget(); - greDir->AppendNative(NS_LITERAL_CSTRING(kOSXResourcesFolder)); + greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder)); #endif nsCOMPtr<nsIFile> appSubdir; greDir->Clone(getter_AddRefs(appSubdir)); @@ -256,33 +252,29 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) // xreDirectory already has a refcount from NS_NewLocalFile appData.xreDirectory = xreDirectory; - return XRE_main(argc, argv, &appData, mainFlags); -} +#if defined(HAS_DLL_BLOCKLIST) + appData.flags |= + DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0; +#endif -/** - * Local TimeStamp::Now()-compatible implementation used to record timestamps - * which will be passed to XRE_StartupTimelineRecord(). - */ -static uint64_t -TimeStamp_Now() -{ -#ifdef XP_WIN - LARGE_INTEGER freq; - ::QueryPerformanceFrequency(&freq); - return GetTickCount64() * freq.QuadPart; -#elif defined(XP_MACOSX) - return mach_absolute_time(); -#elif defined(HAVE_CLOCK_MONOTONIC) - struct timespec ts; - int rv = clock_gettime(CLOCK_MONOTONIC, &ts); - - if (rv != 0) { - return 0; +#if defined(XP_WIN) && defined(MOZ_SANDBOX) + sandbox::BrokerServices* brokerServices = + sandboxing::GetInitializedBrokerServices(); +#if defined(MOZ_CONTENT_SANDBOX) + if (!brokerServices) { + Output("Couldn't initialize the broker services.\n"); + return 255; } +#endif + appData.sandboxBrokerServices = brokerServices; +#endif - uint64_t baseNs = (uint64_t)ts.tv_sec * 1000000000; - return baseNs + (uint64_t)ts.tv_nsec; +#ifdef LIBFUZZER + if (getenv("LIBFUZZER")) + XRE_LibFuzzerSetMain(argc, argv, libfuzzer_main); #endif + + return XRE_main(argc, argv, &appData, mainFlags); } static bool @@ -298,11 +290,6 @@ FileExists(const char *path) #endif } -#ifdef LIBXUL_SDK -# define XPCOM_PATH "xulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL -#else -# define XPCOM_PATH XPCOM_DLL -#endif static nsresult InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory) { @@ -315,55 +302,13 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory) } char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]); - if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_PATH) - 1)) + if (!lastSlash || + (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_DLL) - 1)) return NS_ERROR_FAILURE; - strcpy(lastSlash + 1, XPCOM_PATH); - lastSlash += sizeof(XPCOM_PATH) - sizeof(XPCOM_DLL); + strcpy(lastSlash + 1, XPCOM_DLL); if (!FileExists(exePath)) { -#if defined(LIBXUL_SDK) && defined(XP_MACOSX) - // Check for <bundle>/Contents/Frameworks/XUL.framework/libxpcom.dylib - bool greFound = false; - CFBundleRef appBundle = CFBundleGetMainBundle(); - if (!appBundle) - return NS_ERROR_FAILURE; - CFURLRef fwurl = CFBundleCopyPrivateFrameworksURL(appBundle); - CFURLRef absfwurl = nullptr; - if (fwurl) { - absfwurl = CFURLCopyAbsoluteURL(fwurl); - CFRelease(fwurl); - } - if (absfwurl) { - CFURLRef xulurl = - CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl, - CFSTR("XUL.framework"), - true); - - if (xulurl) { - CFURLRef xpcomurl = - CFURLCreateCopyAppendingPathComponent(nullptr, xulurl, - CFSTR("libxpcom.dylib"), - false); - - if (xpcomurl) { - if (CFURLGetFileSystemRepresentation(xpcomurl, true, - (UInt8*) exePath, - sizeof(exePath)) && - access(tbuffer, R_OK | X_OK) == 0) { - if (realpath(tbuffer, exePath)) { - greFound = true; - } - } - CFRelease(xpcomurl); - } - CFRelease(xulurl); - } - CFRelease(absfwurl); - } - } - if (!greFound) { -#endif Output("Could not find the Mozilla runtime.\n"); return NS_ERROR_FAILURE; } @@ -383,45 +328,72 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory) return rv; } + // This will set this thread as the main thread. NS_LogInit(); - // chop XPCOM_DLL off exePath - *lastSlash = '\0'; + if (xreDirectory) { + // chop XPCOM_DLL off exePath + *lastSlash = '\0'; #ifdef XP_MACOSX - lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]); - strcpy(lastSlash + 1, kOSXResourcesFolder); + lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]); + strcpy(lastSlash + 1, kOSXResourcesFolder); #endif #ifdef XP_WIN - rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false, - xreDirectory); + rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false, + xreDirectory); #else - rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false, - xreDirectory); + rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false, + xreDirectory); #endif + } return rv; } -int main(int argc, char* argv[]) +int main(int argc, char* argv[], char* envp[]) { -#ifdef DEBUG_delay_start_metro - Sleep(5000); + mozilla::TimeStamp start = mozilla::TimeStamp::Now(); + +#ifdef HAS_DLL_BLOCKLIST + DllBlocklist_Initialize(); + +#ifdef DEBUG + // In order to be effective against AppInit DLLs, the blocklist must be + // initialized before user32.dll is loaded into the process (bug 932100). + if (GetModuleHandleA("user32.dll")) { + fprintf(stderr, "DLL blocklist was unable to intercept AppInit DLLs.\n"); + } +#endif #endif - uint64_t start = TimeStamp_Now(); -#ifdef XP_MACOSX - TriggerQuirks(); +#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC + // We are launching as a content process, delegate to the appropriate + // main + if (argc > 1 && IsArg(argv[1], "contentproc")) { +#if defined(XP_WIN) && defined(MOZ_SANDBOX) + // We need to initialize the sandbox TargetServices before InitXPCOMGlue + // because we might need the sandbox broker to give access to some files. + if (IsSandboxedProcess() && !sandboxing::GetInitializedTargetServices()) { + Output("Failed to initialize the sandbox target services."); + return 255; + } #endif - int gotCounters; -#if defined(XP_UNIX) - struct rusage initialRUsage; - gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage); -#elif defined(XP_WIN) - IO_COUNTERS ioCounters; - gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters); + nsresult rv = InitXPCOMGlue(argv[0], nullptr); + if (NS_FAILED(rv)) { + return 255; + } + + int result = content_process_main(argc, argv); + + // InitXPCOMGlue calls NS_LogInit, so we need to balance it here. + NS_LogTerm(); + + return result; + } #endif + nsIFile *xreDirectory; nsresult rv = InitXPCOMGlue(argv[0], &xreDirectory); @@ -431,11 +403,11 @@ int main(int argc, char* argv[]) XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start); -#ifdef XRE_HAS_DLL_BLOCKLIST - XRE_SetupDllBlocklist(); +#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC + XRE_EnableSameExecutableForContentProc(); #endif - int result = do_main(argc, argv, xreDirectory); + int result = do_main(argc, argv, envp, xreDirectory); NS_LogTerm(); diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js index 7338a83a2..ee4a95d38 100644 --- a/application/palemoon/app/profile/palemoon.js +++ b/application/palemoon/app/profile/palemoon.js @@ -1036,6 +1036,9 @@ pref("browser.newtab.preload", false); // Toggles the content of 'about:newtab'. Shows the grid when enabled. pref("browser.newtabpage.enabled", true); +// XXX: Remove this when "enhanced" tiles are dead +pref("browser.newtabpage.enhanced", false); + // number of columns of newtab grid pref("browser.newtabpage.columns", 4); diff --git a/application/palemoon/base/content/autorecovery.js b/application/palemoon/base/content/autorecovery.js index 29ccaed3f..01a092f5c 100644 --- a/application/palemoon/base/content/autorecovery.js +++ b/application/palemoon/base/content/autorecovery.js @@ -10,9 +10,9 @@ * have been properly initialized already. */ -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; // Services = object with smart getters for common XPCOM services Cu.import("resource://gre/modules/Services.jsm"); diff --git a/application/palemoon/base/content/baseMenuOverlay.xul b/application/palemoon/base/content/baseMenuOverlay.xul index c6c1b16dc..f61348c9f 100644 --- a/application/palemoon/base/content/baseMenuOverlay.xul +++ b/application/palemoon/base/content/baseMenuOverlay.xul @@ -29,7 +29,7 @@ <menuitem id="menu_mac_show_all" label="&showAllAppsCmdMac.label;"/> </menupopup> <!-- Mac window menu --> -#include ../../../toolkit/content/macWindowMenu.inc +#include ../../../../toolkit/content/macWindowMenu.inc #endif #ifdef XP_WIN diff --git a/application/palemoon/base/content/browser-appmenu.inc b/application/palemoon/base/content/browser-appmenu.inc index 835bf22bc..cfc855484 100644 --- a/application/palemoon/base/content/browser-appmenu.inc +++ b/application/palemoon/base/content/browser-appmenu.inc @@ -132,38 +132,8 @@ </splitmenu> <menuseparator class="appmenu-menuseparator"/> <splitmenu id="appmenu_webDeveloper" - command="Tools:DevToolbox" label="&appMenuWebDeveloper.label;"> <menupopup id="appmenu_webDeveloper_popup"> -#ifdef MOZ_DEVTOOLS - <menuitem id="appmenu_devToolbox" - observes="devtoolsMenuBroadcaster_DevToolbox"/> - <menuseparator id="appmenu_devtools_separator"/> - <menuitem id="appmenu_devToolbar" - observes="devtoolsMenuBroadcaster_DevToolbar"/> - <menuitem id="appmenu_chromeDebugger" - observes="devtoolsMenuBroadcaster_ChromeDebugger"/> - <menuitem id="appmenu_browserConsole" - observes="devtoolsMenuBroadcaster_BrowserConsole"/> - <menuitem id="appmenu_responsiveUI" - observes="devtoolsMenuBroadcaster_ResponsiveUI"/> - <menuitem id="appmenu_eyedropper" - observes="devtoolsMenuBroadcaster_Eyedropper"/> - <menuitem id="appmenu_scratchpad" - observes="devtoolsMenuBroadcaster_Scratchpad"/> -#endif - <menuitem id="appmenu_pageSource" - observes="devtoolsMenuBroadcaster_PageSource"/> - <menuitem id="appmenu_errorConsole" - observes="devtoolsMenuBroadcaster_ErrorConsole"/> -#ifdef MOZ_DEVTOOLS - <menuitem id="appmenu_devtools_connect" - observes="devtoolsMenuBroadcaster_connect"/> -#endif - <menuseparator id="appmenu_devToolsEndSeparator"/> - <menuitem id="appmenu_getMoreDevtools" - observes="devtoolsMenuBroadcaster_GetMoreTools"/> - <menuseparator/> #define ID_PREFIX appmenu_developer_ #define OMIT_ACCESSKEYS #include browser-charsetmenu.inc @@ -173,6 +143,11 @@ type="checkbox" observes="workOfflineMenuitemState" oncommand="BrowserOffline.toggleOfflineStatus();"/> + <menuseparator/> + <menuitem id="appmenu_pageSource" + observes="devtoolsMenuBroadcaster_PageSource"/> + <menuitem id="appmenu_javascriptConsole" + observes="devtoolsMenuBroadcaster_ErrorConsole"/> </menupopup> </splitmenu> <menuseparator class="appmenu-menuseparator"/> diff --git a/application/palemoon/base/content/browser-fullScreen.js b/application/palemoon/base/content/browser-fullScreen.js index b8a29199e..400340e77 100644 --- a/application/palemoon/base/content/browser-fullScreen.js +++ b/application/palemoon/base/content/browser-fullScreen.js @@ -304,7 +304,7 @@ var FullScreen = { }, _cancelAnimation: function() { - window.mozCancelAnimationFrame(this._animationHandle); + window.cancelAnimationFrame(this._animationHandle); this._animationHandle = 0; clearTimeout(this._animationTimeout); this._isAnimating = false; diff --git a/application/palemoon/base/content/browser-fullZoom.js b/application/palemoon/base/content/browser-fullZoom.js index 0837bf7c2..890cd8440 100644 --- a/application/palemoon/base/content/browser-fullZoom.js +++ b/application/palemoon/base/content/browser-fullZoom.js @@ -1,14 +1,6 @@ -/* -#ifdef 0 - * This Source Code Form is subject to the terms of the Mozilla Public +/* 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/. -#endif - */ - -// One of the possible values for the mousewheel.* preferences. -// From nsEventStateManager.cpp. -const MOUSE_SCROLL_ZOOM = 3; + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * Controls the "full zoom" setting and its site-specific preferences. @@ -36,7 +28,6 @@ var FullZoom = { return this._siteSpecificPref; }, - //**************************************************************************// // nsISupports QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener, @@ -45,12 +36,10 @@ var FullZoom = { Ci.nsISupportsWeakReference, Ci.nsISupports]), - //**************************************************************************// // Initialization & Destruction init: function FullZoom_init() { - // Listen for scrollwheel events so we can save scrollwheel-based changes. - window.addEventListener("DOMMouseScroll", this, false); + gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this); // Register ourselves with the service so we know when our pref changes. this._cps2 = Cc["@mozilla.org/content-pref/service;1"]. @@ -74,76 +63,30 @@ var FullZoom = { } // This should be nulled after initialization. - this._initialLocations.clear(); this._initialLocations = null; }, destroy: function FullZoom_destroy() { gPrefService.removeObserver("browser.zoom.", this); this._cps2.removeObserverForName(this.name, this); - window.removeEventListener("DOMMouseScroll", this, false); + gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this); }, - //**************************************************************************// // Event Handlers // nsIDOMEventListener handleEvent: function FullZoom_handleEvent(event) { switch (event.type) { - case "DOMMouseScroll": - this._handleMouseScrolled(event); + case "ZoomChangeUsingMouseWheel": + let browser = this._getTargetedBrowser(event); + this._ignorePendingZoomAccesses(browser); + this._applyZoomToPref(browser); break; } }, - _handleMouseScrolled: function FullZoom__handleMouseScrolled(event) { - // Construct the "mousewheel action" pref key corresponding to this event. - // Based on nsEventStateManager::WheelPrefs::GetBasePrefName(). - var pref = "mousewheel."; - - var pressedModifierCount = event.shiftKey + event.ctrlKey + event.altKey + - event.metaKey + event.getModifierState("OS"); - if (pressedModifierCount != 1) { - pref += "default."; - } else if (event.shiftKey) { - pref += "with_shift."; - } else if (event.ctrlKey) { - pref += "with_control."; - } else if (event.altKey) { - pref += "with_alt."; - } else if (event.metaKey) { - pref += "with_meta."; - } else { - pref += "with_win."; - } - - pref += "action"; - - // Don't do anything if this isn't a "zoom" scroll event. - var isZoomEvent = false; - try { - isZoomEvent = (gPrefService.getIntPref(pref) == MOUSE_SCROLL_ZOOM); - } catch (e) {} - if (!isZoomEvent) - return; - - // XXX Lazily cache all the possible action prefs so we don't have to get - // them anew from the pref service for every scroll event? We'd have to - // make sure to observe them so we can update the cache when they change. - - // We have to call _applyZoomToPref in a timeout because we handle the - // event before the event state manager has a chance to apply the zoom - // during nsEventStateManager::PostHandleEvent. - let browser = gBrowser.selectedBrowser; - let token = this._getBrowserToken(browser); - window.setTimeout(function () { - if (token.isCurrent) - this._applyZoomToPref(browser); - }.bind(this), 0); - }, - // nsIObserver observe: function (aSubject, aTopic, aData) { @@ -165,12 +108,12 @@ var FullZoom = { // nsIContentPrefObserver - onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue) { - this._onContentPrefChanged(aGroup, aValue); + onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) { + this._onContentPrefChanged(aGroup, aValue, aIsPrivate); }, - onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName) { - this._onContentPrefChanged(aGroup, undefined); + onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName, aIsPrivate) { + this._onContentPrefChanged(aGroup, undefined, aIsPrivate); }, /** @@ -181,7 +124,7 @@ var FullZoom = { * @param aValue The new value of the changed preference. Pass undefined to * indicate the preference's removal. */ - _onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue) { + _onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) { if (this._isNextContentPrefChangeInternal) { // Ignore changes that FullZoom itself makes. This works because the // content pref service calls callbacks before notifying observers, and it @@ -194,9 +137,10 @@ var FullZoom = { if (!browser.currentURI) return; + let ctxt = this._loadContextFromBrowser(browser); let domain = this._cps2.extractDomain(browser.currentURI.spec); if (aGroup) { - if (aGroup == domain) + if (aGroup == domain && ctxt.usePrivateBrowsing == aIsPrivate) this._applyPrefToZoom(aValue, browser); return; } @@ -208,10 +152,9 @@ var FullZoom = { // zoom should be set to the new global preference now that the global // preference has changed. let hasPref = false; - let ctxt = this._loadContextFromBrowser(browser); let token = this._getBrowserToken(browser); this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, { - handleResult: function () hasPref = true, + handleResult: function () { hasPref = true; }, handleCompletion: function () { if (!hasPref && token.isCurrent) this._applyPrefToZoom(undefined, browser); @@ -234,6 +177,7 @@ var FullZoom = { */ onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) { let browser = aBrowser || gBrowser.selectedBrowser; + // If we haven't been initialized yet but receive an onLocationChange // notification then let's store and replay it upon initialization. if (this._initialLocations) { @@ -247,14 +191,14 @@ var FullZoom = { this._ignorePendingZoomAccesses(browser); if (!aURI || (aIsTabSwitch && !this.siteSpecific)) { - this._notifyOnLocationChange(); + this._notifyOnLocationChange(browser); return; } // Avoid the cps roundtrip and apply the default/global pref. if (aURI.spec == "about:blank") { this._applyPrefToZoom(undefined, browser, - this._notifyOnLocationChange.bind(this)); + this._notifyOnLocationChange.bind(this, browser)); return; } @@ -262,7 +206,7 @@ var FullZoom = { if (!aIsTabSwitch && browser.isSyntheticDocument) { ZoomManager.setZoomForBrowser(browser, 1); // _ignorePendingZoomAccesses already called above, so no need here. - this._notifyOnLocationChange(); + this._notifyOnLocationChange(browser); return; } @@ -271,7 +215,7 @@ var FullZoom = { let pref = this._cps2.getCachedByDomainAndName(aURI.spec, this.name, ctxt); if (pref) { this._applyPrefToZoom(pref.value, browser, - this._notifyOnLocationChange.bind(this)); + this._notifyOnLocationChange.bind(this, browser)); return; } @@ -279,14 +223,14 @@ var FullZoom = { let value = undefined; let token = this._getBrowserToken(browser); this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, { - handleResult: function (resultPref) value = resultPref.value, + handleResult: function (resultPref) { value = resultPref.value; }, handleCompletion: function () { if (!token.isCurrent) { - this._notifyOnLocationChange(); + this._notifyOnLocationChange(browser); return; } this._applyPrefToZoom(value, browser, - this._notifyOnLocationChange.bind(this)); + this._notifyOnLocationChange.bind(this, browser)); }.bind(this) }); }, @@ -299,7 +243,6 @@ var FullZoom = { menuItem.setAttribute("checked", !ZoomManager.useFullZoom); }, - //**************************************************************************// // Setting & Pref Manipulation /** @@ -323,19 +266,32 @@ var FullZoom = { }, /** - * Sets the zoom level of the page in the current browser to the global zoom + * Sets the zoom level for the given browser to the given floating + * point value, where 1 is the default zoom level. + */ + setZoom: function (value, browser = gBrowser.selectedBrowser) { + ZoomManager.setZoomForBrowser(browser, value); + this._ignorePendingZoomAccesses(browser); + this._applyZoomToPref(browser); + }, + + /** + * Sets the zoom level of the page in the given browser to the global zoom * level. + * + * @return A promise which resolves when the zoom reset has been applied. */ - reset: function FullZoom_reset() { - let browser = gBrowser.selectedBrowser; + reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) { let token = this._getBrowserToken(browser); - this._getGlobalValue(browser, function (value) { + let result = this._getGlobalValue(browser).then(value => { if (token.isCurrent) { ZoomManager.setZoomForBrowser(browser, value === undefined ? 1 : value); this._ignorePendingZoomAccesses(browser); + Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", ""); } }); this._removePref(browser); + return result; }, /** @@ -383,7 +339,7 @@ var FullZoom = { } let token = this._getBrowserToken(aBrowser); - this._getGlobalValue(aBrowser, function (value) { + this._getGlobalValue(aBrowser).then(value => { if (token.isCurrent) { ZoomManager.setZoomForBrowser(aBrowser, value === undefined ? 1 : value); this._ignorePendingZoomAccesses(aBrowser); @@ -399,6 +355,7 @@ var FullZoom = { * @param browser The zoom of this browser will be saved. Required. */ _applyZoomToPref: function FullZoom__applyZoomToPref(browser) { + Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", ""); if (!this.siteSpecific || gInPrintPreviewMode || browser.isSyntheticDocument) @@ -419,6 +376,7 @@ var FullZoom = { * @param browser The zoom of this browser will be removed. Required. */ _removePref: function FullZoom__removePref(browser) { + Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", ""); if (browser.isSyntheticDocument) return; let ctxt = this._loadContextFromBrowser(browser); @@ -429,7 +387,6 @@ var FullZoom = { }); }, - //**************************************************************************// // Utilities /** @@ -462,6 +419,30 @@ var FullZoom = { }, /** + * Returns the browser that the supplied zoom event is associated with. + * @param event The ZoomChangeUsingMouseWheel event. + * @return The associated browser element, if one exists, otherwise null. + */ + _getTargetedBrowser: function FullZoom__getTargetedBrowser(event) { + let target = event.originalTarget; + + // With remote content browsers, the event's target is the browser + // we're looking for. + const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + if (target instanceof window.XULElement && + target.localName == "browser" && + target.namespaceURI == XUL_NS) + return target; + + // With in-process content browsers, the event's target is the content + // document. + if (target.nodeType == Node.DOCUMENT_NODE) + return gBrowser.getBrowserForDocument(target); + + throw new Error("Unexpected ZoomChangeUsingMouseWheel event source"); + }, + + /** * Increments the zoom change token for the given browser so that pending * async operations know that it may be unsafe to access they zoom when they * finish. @@ -491,54 +472,49 @@ var FullZoom = { /** * Gets the global browser.content.full-zoom content preference. * - * WARNING: callback may be called synchronously or asynchronously. The - * reason is that it's usually desirable to avoid turns of the event loop - * where possible, since they can lead to visible, jarring jumps in zoom - * level. It's not always possible to avoid them, though. As a convenience, - * then, this method takes a callback and returns nothing. - * - * @param browser The content browser pertaining to the zoom. - * @param callback Synchronously or asynchronously called when done. It's - * bound to this object (FullZoom) and called as: - * callback(prefValue) + * @param browser The browser pertaining to the zoom. + * @returns Promise<prefValue> + * Resolves to the preference value when done. */ - _getGlobalValue: function FullZoom__getGlobalValue(browser, callback) { + _getGlobalValue: function FullZoom__getGlobalValue(browser) { // * !("_globalValue" in this) => global value not yet cached. // * this._globalValue === undefined => global value known not to exist. // * Otherwise, this._globalValue is a number, the global value. - if ("_globalValue" in this) { - callback.call(this, this._globalValue, true); - return; - } - let value = undefined; - this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), { - handleResult: function (pref) value = pref.value, - handleCompletion: function (reason) { - this._globalValue = this._ensureValid(value); - callback.call(this, this._globalValue); - }.bind(this) + return new Promise(resolve => { + if ("_globalValue" in this) { + resolve(this._globalValue); + return; + } + let value = undefined; + this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), { + handleResult: function (pref) { value = pref.value; }, + handleCompletion: (reason) => { + this._globalValue = this._ensureValid(value); + resolve(this._globalValue); + } + }); }); }, /** - * Gets the load context from the given content browser. + * Gets the load context from the given Browser. * * @param Browser The Browser whose load context will be returned. - * @return The nsILoadContext of the given Browser. + * @return The nsILoadContext of the given Browser. */ _loadContextFromBrowser: function FullZoom__loadContextFromBrowser(browser) { return browser.loadContext; }, /** - * Asynchronously broadcasts a "browser-fullZoom:locationChange" notification - * so that tests can select tabs, load pages, etc. and be notified when the - * zoom levels on those pages change. The notification is always asynchronous - * so that observers are guaranteed a consistent behavior. + * Asynchronously broadcasts "browser-fullZoom:location-change" so that + * listeners can be notified when the zoom levels on those pages change. + * The notification is always asynchronous so that observers are guaranteed a + * consistent behavior. */ - _notifyOnLocationChange: function FullZoom__notifyOnLocationChange() { + _notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) { this._executeSoon(function () { - Services.obs.notifyObservers(null, "browser-fullZoom:locationChange", ""); + Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", ""); }); }, diff --git a/application/palemoon/base/content/browser-menubar.inc b/application/palemoon/base/content/browser-menubar.inc index fa9d7f0f4..fc6bc7694 100644 --- a/application/palemoon/base/content/browser-menubar.inc +++ b/application/palemoon/base/content/browser-menubar.inc @@ -534,43 +534,12 @@ label="&webDeveloperMenu.label;" accesskey="&webDeveloperMenu.accesskey;"> <menupopup id="menuWebDeveloperPopup"> -#ifdef MOZ_DEVTOOLS - <menuitem id="menu_devToolbox" - observes="devtoolsMenuBroadcaster_DevToolbox" - accesskey="&devToolboxMenuItem.accesskey;"/> - <menuseparator id="menu_devtools_separator"/> - <menuitem id="menu_devToolbar" - observes="devtoolsMenuBroadcaster_DevToolbar" - accesskey="&devToolbarMenu.accesskey;"/> - <menuitem id="menu_chromeDebugger" - observes="devtoolsMenuBroadcaster_ChromeDebugger"/> - <menuitem id="menu_browserConsole" - observes="devtoolsMenuBroadcaster_BrowserConsole" - accesskey="&browserConsoleCmd.accesskey;"/> - <menuitem id="menu_responsiveUI" - observes="devtoolsMenuBroadcaster_ResponsiveUI" - accesskey="&responsiveDesignTool.accesskey;"/> - <menuitem id="menu_eyedropper" - observes="devtoolsMenuBroadcaster_Eyedropper" - accesskey="&eyedropper.accesskey;"/> - <menuitem id="menu_scratchpad" - observes="devtoolsMenuBroadcaster_Scratchpad" - accesskey="&scratchpad.accesskey;"/> -#endif <menuitem id="menu_pageSource" observes="devtoolsMenuBroadcaster_PageSource" accesskey="&pageSourceCmd.accesskey;"/> <menuitem id="javascriptConsole" observes="devtoolsMenuBroadcaster_ErrorConsole" accesskey="&errorConsoleCmd.accesskey;"/> -#ifdef MOZ_DEVTOOLS - <menuitem id="menu_devtools_connect" - observes="devtoolsMenuBroadcaster_connect"/> -#endif - <menuseparator id="devToolsEndSeparator"/> - <menuitem id="getMoreDevtools" - observes="devtoolsMenuBroadcaster_GetMoreTools" - accesskey="&getMoreDevtoolsCmd.accesskey;"/> </menupopup> </menu> <menuitem id="menu_pageInfo" diff --git a/application/palemoon/base/content/browser-sets.inc b/application/palemoon/base/content/browser-sets.inc index 78cfb7faa..64228678e 100644 --- a/application/palemoon/base/content/browser-sets.inc +++ b/application/palemoon/base/content/browser-sets.inc @@ -92,24 +92,9 @@ <command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/> <command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/> -#ifdef MOZ_DEVTOOLS - <command id="Tools:DevToolbox" oncommand="gDevToolsBrowser.toggleToolboxCommand(gBrowser);"/> - <command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true" hidden="true"/> - <command id="Tools:DevToolbarFocus" oncommand="DeveloperToolbar.focusToggle();" disabled="true"/> - <command id="Tools:DevAppMgr" oncommand="gDevToolsBrowser.openAppManager(gBrowser);" disabled="true" hidden="true"/> - <command id="Tools:WebIDE" oncommand="gDevToolsBrowser.openWebIDE();" disabled="true" hidden="true"/> - <command id="Tools:ChromeDebugger" oncommand="BrowserToolboxProcess.init();" disabled="true" hidden="true"/> - <command id="Tools:BrowserConsole" oncommand="HUDService.openBrowserConsoleOrFocus();"/> - <command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true" hidden="true"/> - <command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();" disabled="true" hidden="true"/> - <command id="Tools:Eyedropper" oncommand="openEyedropper();"/> -#endif <command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/> <command id="Tools:Permissions" oncommand="BrowserOpenPermissionsMgr();"/> <command id="Tools:ErrorConsole" oncommand="toJavaScriptConsole()" disabled="true" hidden="true"/> -#ifdef MOZ_DEVTOOLS - <command id="Tools:DevToolsConnect" oncommand="gDevToolsBrowser.openConnectScreen(gBrowser)" disabled="true" hidden="true"/> -#endif <command id="Tools:Sanitize" oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/> <command id="Tools:PrivateBrowsing" @@ -170,46 +155,6 @@ #endif <broadcaster id="workOfflineMenuitemState"/> -#ifdef MOZ_DEVTOOLS - <!-- DevTools broadcasters --> - <broadcaster id="devtoolsMenuBroadcaster_DevToolbox" - label="&devToolboxMenuItem.label;" - type="checkbox" autocheck="false" - command="Tools:DevToolbox" - key="key_devToolbox"/> - <broadcaster id="devtoolsMenuBroadcaster_DevToolbar" - label="&devToolbarMenu.label;" - type="checkbox" autocheck="false" - command="Tools:DevToolbar" - key="key_devToolbar"/> - <broadcaster id="devtoolsMenuBroadcaster_DevAppMgr" - label="&devAppMgrMenu.label;" - command="Tools:DevAppMgr"/> - <broadcaster id="devtoolsMenuBroadcaster_webide" - label="&webide.label;" - command="Tools:WebIDE" - key="key_webide"/> - <broadcaster id="devtoolsMenuBroadcaster_ChromeDebugger" - label="&chromeDebuggerMenu.label;" - command="Tools:ChromeDebugger"/> - <broadcaster id="devtoolsMenuBroadcaster_BrowserConsole" - label="&browserConsoleCmd.label;" - key="key_browserConsole" - command="Tools:BrowserConsole"/> - <broadcaster id="devtoolsMenuBroadcaster_Scratchpad" - label="&scratchpad.label;" - command="Tools:Scratchpad" - key="key_scratchpad"/> - <broadcaster id="devtoolsMenuBroadcaster_ResponsiveUI" - label="&responsiveDesignTool.label;" - type="checkbox" autocheck="false" - command="Tools:ResponsiveUI" - key="key_responsiveUI"/> - <broadcaster id="devtoolsMenuBroadcaster_Eyedropper" - label="&eyedropper.label;" - type="checkbox" autocheck="false" - command="Tools:Eyedropper"/> -#endif <broadcaster id="devtoolsMenuBroadcaster_PageSource" label="&pageSourceCmd.label;" key="key_viewSource" @@ -217,14 +162,6 @@ <broadcaster id="devtoolsMenuBroadcaster_ErrorConsole" label="&errorConsoleCmd.label;" command="Tools:ErrorConsole"/> - <broadcaster id="devtoolsMenuBroadcaster_GetMoreTools" - label="&getMoreDevtoolsCmd.label;" - oncommand="openUILinkIn(gPrefService.getCharPref('browser.getdevtools.url'), 'tab');"/> -#ifdef MOZ_DEVTOOLS - <broadcaster id="devtoolsMenuBroadcaster_connect" - label="&devtoolsConnect.label;" - command="Tools:DevToolsConnect"/> -#endif </broadcasterset> <keyset id="mainKeyset"> @@ -271,21 +208,6 @@ <key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/> #endif <key id="key_openAddons" key="&addons.commandkey;" command="Tools:Addons" modifiers="accel,shift"/> -#ifdef MOZ_DEVTOOLS - <key id="key_browserConsole" key="&browserConsoleCmd.commandkey;" command="Tools:BrowserConsole" modifiers="accel,shift"/> - <key id="key_devToolbox" keycode="VK_F12" keytext="F12" command="Tools:DevToolbox"/> - <key id="key_devToolbar" keycode="&devToolbar.keycode;" modifiers="shift" - keytext="&devToolbar.keytext;" command="Tools:DevToolbarFocus"/> - <key id="key_responsiveUI" key="&responsiveDesignTool.commandkey;" command="Tools:ResponsiveUI" -#ifdef XP_MACOSX - modifiers="accel,alt" -#else - modifiers="accel,shift" -#endif - /> - <key id="key_scratchpad" keycode="&scratchpad.keycode;" modifiers="shift" - keytext="&scratchpad.keytext;" command="Tools:Scratchpad"/> -#endif <key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/> <key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/> <key id="printKb" key="&printCmd.commandkey;" command="cmd_print" modifiers="accel"/> diff --git a/application/palemoon/base/content/browser-thumbnails.js b/application/palemoon/base/content/browser-thumbnails.js index dbe33e3ed..b06dfd503 100644 --- a/application/palemoon/base/content/browser-thumbnails.js +++ b/application/palemoon/base/content/browser-thumbnails.js @@ -92,7 +92,12 @@ let gBrowserThumbnails = { filterForThumbnailExpiration: function Thumbnails_filterForThumbnailExpiration(aCallback) { - aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]); + // Tycho: aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]); + let result = []; + for (let browser of gBrowser.browsers) { + result.push(browser.currentURI.spec); + } + aCallback(result); }, /** @@ -137,7 +142,7 @@ let gBrowserThumbnails = { // FIXME Bug 720575 - Don't capture thumbnails for SVG or XML documents as // that currently regresses Talos SVG tests. - if (doc instanceof SVGDocument || doc instanceof XMLDocument) + if (doc instanceof XMLDocument) return false; // There's no point in taking screenshot of loading pages. diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css index 2c8ba3e69..e6a84421b 100644 --- a/application/palemoon/base/content/browser.css +++ b/application/palemoon/base/content/browser.css @@ -115,8 +115,17 @@ toolbar[printpreview="true"] { #titlebar { -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox"); + -moz-window-dragging: drag; } +%ifdef XP_WIN +#main-window[tabsontop="true"] #TabsToolbar, +#main-window[tabsontop="true"] #toolbar-menubar, +#main-window[tabsontop="true"] #navigator-toolbox > toolbar:-moz-lwtheme { + -moz-window-dragging: drag; +} +%endif + #titlebar-spacer { pointer-events: none; } diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 34b91b6cb..8cc091e85 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -3,8 +3,8 @@ # 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/. -let Ci = Components.interfaces; -let Cu = Components.utils; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/RecentWindow.jsm"); @@ -109,20 +109,6 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () { } }); -#ifdef MOZ_DEVTOOLS -XPCOMUtils.defineLazyGetter(this, "DeveloperToolbar", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/DeveloperToolbar.jsm", tmp); - return new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar")); -}); - -XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/ToolboxProcess.jsm", tmp); - return tmp.BrowserToolboxProcess; -}); -#endif - XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs", "resource://gre/modules/PageThumbs.jsm"); @@ -152,7 +138,11 @@ let gInitialPages = [ #include browser-plugins.js #include browser-tabPreviews.js #include browser-thumbnails.js + +#ifdef MOZ_WEBRTC #include browser-webrtcUI.js +#endif + #include browser-gestureSupport.js #ifdef MOZ_SERVICES_SYNC @@ -336,6 +326,48 @@ const gSessionHistoryObserver = { } }; +var gURLBarSettings = { + prefSuggest: "browser.urlbar.suggest.", + /* + For searching in the source code: + browser.urlbar.suggest.bookmark + browser.urlbar.suggest.history + browser.urlbar.suggest.openpage + */ + prefSuggests: [ + "bookmark", + "history", + "openpage" + ], + prefKeyword: "keyword.enabled", + + observe: function(aSubject, aTopic, aData) { + if (aTopic != "nsPref:changed") + return; + + this.writePlaceholder(); + }, + + writePlaceholder: function() { + let attribute = "placeholder"; + let prefs = this.prefSuggests.map(pref => { + return this.prefSuggest + pref; + }); + prefs.push(this.prefKeyword); + let placeholderDefault = prefs.some(pref => { + return gPrefService.getBoolPref(pref); + }); + + if (placeholderDefault) { + gURLBar.setAttribute( + attribute, gNavigatorBundle.getString("urlbar.placeholder")); + } else { + gURLBar.setAttribute( + attribute, gNavigatorBundle.getString("urlbar.placeholderURLOnly")); + } + } +}; + /** * Given a starting docshell and a URI to look up, find the docshell the URI * is loaded in. @@ -663,6 +695,8 @@ const gXSSObserver = { }; var gBrowserInit = { + delayedStartupFinished: false, + onLoad: function() { gMultiProcessBrowser = gPrefService.getBoolPref("browser.tabs.remote"); @@ -968,11 +1002,18 @@ var gBrowserInit = { Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false); Services.obs.addObserver(gXSSObserver, "xss-on-violate-policy", false); + gPrefService.addObserver(gURLBarSettings.prefSuggest, gURLBarSettings, false); + gPrefService.addObserver(gURLBarSettings.prefKeyword, gURLBarSettings, false); + + gURLBarSettings.writePlaceholder(); + BrowserOffline.init(); OfflineApps.init(); IndexedDBPromptHelper.init(); AddonManager.addAddonListener(AddonsMgrListener); +#ifdef MOZ_WEBRTC WebrtcIndicator.init(); +#endif // Ensure login manager is up and running. Services.logins; @@ -1114,27 +1155,6 @@ var gBrowserInit = { setUrlAndSearchBarWidthForConditionalForwardButton(); }); -#ifdef MOZ_DEVTOOLS - // Enable Chrome Debugger? - let chromeEnabled = gPrefService.getBoolPref("devtools.chrome.enabled"); - let remoteEnabled = chromeEnabled && - gPrefService.getBoolPref("devtools.debugger.chrome-enabled") && - gPrefService.getBoolPref("devtools.debugger.remote-enabled"); - if (remoteEnabled) { - let cmd = document.getElementById("Tools:ChromeDebugger"); - cmd.removeAttribute("disabled"); - cmd.removeAttribute("hidden"); - } - - // Enable Scratchpad in the UI, if the preference allows this. - let scratchpadEnabled = gPrefService.getBoolPref(Scratchpad.prefEnabledName); - if (scratchpadEnabled) { - let cmd = document.getElementById("Tools:Scratchpad"); - cmd.removeAttribute("disabled"); - cmd.removeAttribute("hidden"); - } -#endif - // Enable Error Console? let consoleEnabled = gPrefService.getBoolPref("devtools.errorconsole.enabled"); if (consoleEnabled) { @@ -1152,19 +1172,6 @@ var gBrowserInit = { document.getElementById("appmenu_charsetMenu").hidden = true; #endif -#ifdef MOZ_DEVTOOLS - // Enable Responsive UI? - let responsiveUIEnabled = gPrefService.getBoolPref("devtools.responsiveUI.enabled"); - if (responsiveUIEnabled) { - let cmd = document.getElementById("Tools:ResponsiveUI"); - cmd.removeAttribute("disabled"); - cmd.removeAttribute("hidden"); - } - - // Add Devtools menuitems and listeners - gDevToolsBrowser.registerBrowserWindow(window); -#endif - let appMenuButton = document.getElementById("appmenu-button"); let appMenuPopup = document.getElementById("appmenu-popup"); if (appMenuButton && appMenuPopup) { @@ -1205,6 +1212,8 @@ var gBrowserInit = { setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0); }); + this.delayedStartupFinished = true; + Services.obs.notifyObservers(window, "browser-delayed-startup-finished", ""); }, @@ -1240,15 +1249,6 @@ var gBrowserInit = { if (!this._loadHandled) return; -#ifdef MOZ_DEVTOOLS - gDevToolsBrowser.forgetBrowserWindow(window); - - let desc = Object.getOwnPropertyDescriptor(window, "DeveloperToolbar"); - if (desc && !desc.get) { - DeveloperToolbar.destroy(); - } -#endif - // First clean up services initialized in gBrowserInit.onLoad (or those whose // uninit methods don't depend on the services having been initialized). @@ -1314,6 +1314,13 @@ var gBrowserInit = { Services.obs.removeObserver(gXSSObserver, "xss-on-violate-policy"); try { + gPrefService.removeObserver(gURLBarSettings.prefSuggest, gURLBarSettings); + gPrefService.removeObserver(gURLBarSettings.prefKeyword, gURLBarSettings); + } catch (ex) { + Cu.reportError(ex); + } + + try { gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton); } catch (ex) { Cu.reportError(ex); @@ -6825,20 +6832,9 @@ var TabContextMenu = { }; #ifdef MOZ_DEVTOOLS +// Note: Do not delete! It is used for: base/content/nsContextMenu.js XPCOMUtils.defineLazyModuleGetter(this, "gDevTools", - "resource://gre/modules/devtools/gDevTools.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "gDevToolsBrowser", - "resource://gre/modules/devtools/gDevTools.jsm"); - -Object.defineProperty(this, "HUDService", { - get: function HUDService_getter() { - let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; - return devtools.require("devtools/webconsole/hudservice").HUDService; - }, - configurable: true, - enumerable: true -}); + "resource://devtools/client/framework/gDevTools.jsm"); #endif // Prompt user to restart the browser in safe mode or normally @@ -6929,49 +6925,6 @@ function toggleAddonBar() { setToolbarVisibility(addonBar, addonBar.collapsed); } -#ifdef MOZ_DEVTOOLS -var Scratchpad = { - prefEnabledName: "devtools.scratchpad.enabled", - - openScratchpad: function SP_openScratchpad() { - return this.ScratchpadManager.openScratchpad(); - } -}; - -XPCOMUtils.defineLazyGetter(Scratchpad, "ScratchpadManager", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/scratchpad-manager.jsm", tmp); - return tmp.ScratchpadManager; -}); - -var ResponsiveUI = { - toggle: function RUI_toggle() { - this.ResponsiveUIManager.toggle(window, gBrowser.selectedTab); - } -}; - -XPCOMUtils.defineLazyGetter(ResponsiveUI, "ResponsiveUIManager", function() { - let tmp = {}; - Cu.import("resource://gre/modules/devtools/responsivedesign.jsm", tmp); - return tmp.ResponsiveUIManager; -}); - -function openEyedropper() { - var eyedropper = new this.Eyedropper(this, { context: "menu", - copyOnSelect: true }); - eyedropper.open(); -} - -Object.defineProperty(this, "Eyedropper", { - get: function() { - let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; - return devtools.require("devtools/eyedropper/eyedropper").Eyedropper; - }, - configurable: true, - enumerable: true -}); -#endif - XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () { #ifdef XP_WIN // Only show resizers on Windows 2000 and XP diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index f83010023..0a0ce01dc 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/base/content/browser.xul @@ -410,7 +410,7 @@ <toolbaritem id="urlbar-container" align="center" flex="400" persist="width" combined="true" title="&locationItem.title;" class="chromeclass-location" removable="true"> <textbox id="urlbar" flex="1" - placeholder="&urlbar.placeholder2;" + placeholder="" type="autocomplete" autocompletesearch="urlinline history" autocompletesearchparam="enable-actions" @@ -440,8 +440,10 @@ <image id="alert-plugins-notification-icon" class="notification-anchor-icon" role="button"/> <image id="blocked-plugins-notification-icon" class="notification-anchor-icon" role="button"/> <image id="mixed-content-blocked-notification-icon" class="notification-anchor-icon" role="button"/> +#ifdef MOZ_WEBRTC <image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon" role="button"/> <image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon" role="button"/> +#endif <image id="pointerLock-notification-icon" class="notification-anchor-icon" role="button"/> <image id="servicesInstall-notification-icon" class="notification-anchor-icon" role="button"/> </box> @@ -513,7 +515,7 @@ flex="100" persist="width" removable="true"> <searchbar id="searchbar" flex="1"/> </toolbaritem> - +#ifdef MOZ_WEBRTC <toolbarbutton id="webrtc-status-button" class="toolbarbutton-1 chromeclass-toolbar-additional" type="menu" @@ -525,7 +527,7 @@ onpopuphiding="WebrtcIndicator.clearPopup(this);" oncommand="WebrtcIndicator.menuCommand(event.target);"/> </toolbarbutton> - +#endif <toolbarbutton id="bookmarks-menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional" persist="class" @@ -971,33 +973,6 @@ <vbox id="browser-bottombox" layer="true"> <notificationbox id="global-notificationbox"/> -#ifdef MOZ_DEVTOOLS - <toolbar id="developer-toolbar" - class="devtools-toolbar" - hidden="true"> -#ifdef XP_MACOSX - <toolbarbutton id="developer-toolbar-closebutton" - class="devtools-closebutton" - oncommand="DeveloperToolbar.hide();" - tooltiptext="&devToolbarCloseButton.tooltiptext;"/> -#endif - <stack class="gclitoolbar-stack-node" flex="1"> - <textbox class="gclitoolbar-input-node" rows="1"/> - <hbox class="gclitoolbar-complete-node"/> - </stack> - <toolbarbutton id="developer-toolbar-toolbox-button" - class="developer-toolbar-button" - observes="devtoolsMenuBroadcaster_DevToolbox" - tooltiptext="&devToolbarToolsButton.tooltip;"/> -#ifndef XP_MACOSX - <toolbarbutton id="developer-toolbar-closebutton" - class="devtools-closebutton" - oncommand="DeveloperToolbar.hide();" - tooltiptext="&devToolbarCloseButton.tooltiptext;"/> -#endif - </toolbar> -#endif - <toolbar id="addon-bar" toolbarname="&statusBar.label;" accesskey="&statusBar.accesskey;" collapsed="true" diff --git a/application/palemoon/base/content/content.js b/application/palemoon/base/content/content.js index 19032eb84..19c8b0682 100644 --- a/application/palemoon/base/content/content.js +++ b/application/palemoon/base/content/content.js @@ -3,9 +3,9 @@ * 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/. */ -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -13,6 +13,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", "resource://gre/modules/BrowserUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent", "resource://gre/modules/LoginManagerContent.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "LoginFormFactory", + "resource://gre/modules/LoginManagerContent.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "InsecurePasswordUtils", "resource://gre/modules/InsecurePasswordUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "FormSubmitObserver", @@ -47,8 +49,9 @@ addMessageListener("Browser:HideSessionRestoreButton", function (message) { }); addEventListener("DOMFormHasPassword", function(event) { - InsecurePasswordUtils.checkForInsecurePasswords(event.target); - LoginManagerContent.onFormPassword(event); + LoginManagerContent.onDOMFormHasPassword(event, content); + let formLike = LoginFormFactory.createFromForm(event.target); + InsecurePasswordUtils.reportInsecurePasswords(formLike); }); addEventListener("DOMAutoComplete", function(event) { LoginManagerContent.onUsernameInput(event); @@ -61,4 +64,8 @@ addEventListener("blur", function(event) { addMessageListener("Finder:Initialize", function () { let {RemoteFinderListener} = Cu.import("resource://gre/modules/RemoteFinder.jsm", {}); new RemoteFinderListener(global); -});
\ No newline at end of file +}); + +addEventListener("DOMWebNotificationClicked", function(event) { + sendAsyncMessage("DOMWebNotificationClicked", {}); +}, false); diff --git a/application/palemoon/base/content/newtab/grid.js b/application/palemoon/base/content/newtab/grid.js index 37559a063..3b7dfc35f 100644 --- a/application/palemoon/base/content/newtab/grid.js +++ b/application/palemoon/base/content/newtab/grid.js @@ -109,7 +109,12 @@ let gGrid = { // (Re-)initialize all cells. let cellElements = this.node.querySelectorAll(".newtab-cell"); - this._cells = [new Cell(this, cell) for (cell of cellElements)]; + // Tycho: this._cells = [new Cell(this, cell) for (cell of cellElements)]; + this.cells = []; + + for (let cellItem of cellElements) { + this.cells.push(new Cell(this, cellItem)); + } }, /** diff --git a/application/palemoon/base/content/newtab/newTab.js b/application/palemoon/base/content/newtab/newTab.js index 77c929125..6d8647ab6 100644 --- a/application/palemoon/base/content/newtab/newTab.js +++ b/application/palemoon/base/content/newtab/newTab.js @@ -4,8 +4,8 @@ "use strict"; -let Cu = Components.utils; -let Ci = Components.interfaces; +var Cu = Components.utils; +var Ci = Components.interfaces; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index 8e6bc96c2..f914f5841 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -422,12 +422,17 @@ nsContextMenu.prototype = { }, inspectNode: function CM_inspectNode() { - let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); + let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); let gBrowser = this.browser.ownerDocument.defaultView.gBrowser; - let tt = devtools.TargetFactory.forTab(gBrowser.selectedTab); - return gDevTools.showToolbox(tt, "inspector").then(function(toolbox) { + let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); + + return gDevTools.showToolbox(target, "inspector").then(function(toolbox) { let inspector = toolbox.getCurrentPanel(); - inspector.selection.setNode(this.target, "browser-context-menu"); + + this.browser.messageManager.sendAsyncMessage("debug:inspect", {}, {node: this.target}); + inspector.walker.findInspectingNode().then(nodeFront => { + inspector.selection.setNodeFront(nodeFront, "browser-context-menu"); + }); }.bind(this)); }, diff --git a/application/palemoon/base/content/padlock.js b/application/palemoon/base/content/padlock.js index 53477fd17..9c29524ce 100644 --- a/application/palemoon/base/content/padlock.js +++ b/application/palemoon/base/content/padlock.js @@ -1,6 +1,6 @@ -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); var padlock_PadLock = diff --git a/application/palemoon/base/content/pageinfo/pageInfo.js b/application/palemoon/base/content/pageinfo/pageInfo.js index ba93ee817..83f0ddb91 100644 --- a/application/palemoon/base/content/pageinfo/pageInfo.js +++ b/application/palemoon/base/content/pageinfo/pageInfo.js @@ -359,7 +359,7 @@ function loadPageInfo() makeTabs(gDocument, gWindow); initFeedTab(); - onLoadPermission(); + onLoadPermission(gDocument.nodePrincipal); /* Call registered overlay init functions */ onLoadRegistry.forEach(function(func) { func(); }); @@ -857,7 +857,7 @@ function onBlockImage() if (checkbox.checked) permissionManager.add(uri, "image", nsIPermissionManager.DENY_ACTION); else - permissionManager.remove(uri.host, "image"); + permissionManager.remove(uri, "image"); } function onImageSelect() diff --git a/application/palemoon/base/content/pageinfo/permissions.js b/application/palemoon/base/content/pageinfo/permissions.js index 7a0006b61..2fa0cc303 100644 --- a/application/palemoon/base/content/pageinfo/permissions.js +++ b/application/palemoon/base/content/pageinfo/permissions.js @@ -12,9 +12,10 @@ const IMAGE_DENY = 2; const COOKIE_DENY = 2; const COOKIE_SESSION = 2; -const nsIQuotaManager = Components.interfaces.nsIQuotaManager; +const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService; var gPermURI; +var gPermPrincipal; var gPrefs; var gUsageRequest; @@ -107,7 +108,7 @@ var permissionObserver = { } }; -function onLoadPermission() +function onLoadPermission(principal) { gPrefs = Components.classes[PREFERENCES_CONTRACTID] .getService(Components.interfaces.nsIPrefBranch); @@ -116,6 +117,7 @@ function onLoadPermission() var permTab = document.getElementById("permTab"); if (/^https?$/.test(uri.scheme)) { gPermURI = uri; + gPermPrincipal = principal; var hostText = document.getElementById("hostText"); hostText.value = gPermURI.host; @@ -187,7 +189,7 @@ function onCheckboxClick(aPartId) var command = document.getElementById("cmd_" + aPartId + "Toggle"); var checkbox = document.getElementById(aPartId + "Def"); if (checkbox.checked) { - permissionManager.remove(gPermURI.host, aPartId); + permissionManager.remove(gPermURI, aPartId); command.setAttribute("disabled", "true"); var perm = gPermObj[aPartId](); setRadioState(aPartId, perm); @@ -211,7 +213,7 @@ function onRadioClick(aPartId) var id = radioGroup.selectedItem.id; var permission = id.split('#')[1]; if (permission == UNKNOWN) { - permissionManager.remove(gPermURI.host, aPartId); + permissionManager.remove(gPermURI, aPartId); } else { permissionManager.add(gPermURI, aPartId, permission); } @@ -230,10 +232,13 @@ function initIndexedDBRow() row.appendChild(extras); - var quotaManager = Components.classes["@mozilla.org/dom/quota/manager;1"] - .getService(nsIQuotaManager); + var quotaManagerService = + Components.classes["@mozilla.org/dom/quota-manager-service;1"] + .getService(nsIQuotaManagerService); + gUsageRequest = - quotaManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback); + quotaManagerService.getUsageForPrincipal(gPermPrincipal, + onIndexedDBUsageCallback); var status = document.getElementById("indexedDBStatus"); var button = document.getElementById("indexedDBClear"); @@ -245,22 +250,24 @@ function initIndexedDBRow() function onIndexedDBClear() { - Components.classes["@mozilla.org/dom/quota/manager;1"] - .getService(nsIQuotaManager) - .clearStoragesForURI(gPermURI); + Components.classes["@mozilla.org/dom/quota-manager-service;1"] + .getService(nsIQuotaManagerService) + .clearStoragesForPrincipal(gPermPrincipal); var permissionManager = Components.classes[PERMISSION_CONTRACTID] .getService(nsIPermissionManager); - permissionManager.remove(gPermURI.host, "indexedDB"); + permissionManager.remove(gPermURI, "indexedDB"); initIndexedDBRow(); } -function onIndexedDBUsageCallback(uri, usage, fileUsage) +function onIndexedDBUsageCallback(request) { + let uri = request.principal.URI; if (!uri.equals(gPermURI)) { - throw new Error("Callback received for bad URI: " + uri); + throw new Error("Callback received for bad URI: " + uri.spec); } + let usage = request.result.usage; if (usage) { if (!("DownloadUtils" in window)) { Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); @@ -355,20 +362,33 @@ function initPluginsRow() { } } - let entries = [ - { + // Tycho: + // let entries = [ + // { + // "permission": item[0], + // "obj": item[1], + // } + // for (item of permissionMap) + // ]; + let entries = []; + for (let item of permissionMap) { + entries.push({ "permission": item[0], - "obj": item[1], - } - for (item of permissionMap) - ]; + "obj": item[1] + }); + } entries.sort(function(a, b) { return ((a.obj.name < b.obj.name) ? -1 : (a.obj.name == b.obj.name ? 0 : 1)); }); - let permissionEntries = [ - fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries) - ]; + // Tycho: + // let permissionEntries = [ + // fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries) + // ]; + let permissionEntries = []; + entries.forEach(function (p) { + permissionEntries.push(fillInPluginPermissionTemplate(p.permission, p.obj)); + }); let permPluginsRow = document.getElementById("permPluginsRow"); clearPluginPermissionTemplate(); diff --git a/application/palemoon/base/content/popup-notifications.inc b/application/palemoon/base/content/popup-notifications.inc index 04f4cb5b7..7be975b7f 100644 --- a/application/palemoon/base/content/popup-notifications.inc +++ b/application/palemoon/base/content/popup-notifications.inc @@ -54,7 +54,7 @@ </hbox> </panel> - +#ifdef MOZ_WEBRTC <popupnotification id="webRTC-shareDevices-notification" hidden="true"> <popupnotificationcontent id="webRTC-selectCamera" orient="vertical"> <separator class="thin"/> @@ -75,7 +75,7 @@ </menulist> </popupnotificationcontent> </popupnotification> - +#endif <popupnotification id="servicesInstall-notification" hidden="true"> <popupnotificationcontent orient="vertical" align="start"> <!-- XXX bug 974146, tests are looking for this, can't remove yet. --> @@ -89,6 +89,14 @@ </popupnotificationcontent> </popupnotification> + <popupnotification id="password-notification" hidden="true"> + <popupnotificationcontent orient="vertical"> + <textbox id="password-notification-username"/> + <textbox id="password-notification-password" type="password" show-content=""/> + <checkbox id="password-notification-visibilityToggle" hidden="true"/> + </popupnotificationcontent> + </popupnotification> + <popupnotification id="mixed-content-blocked-notification" hidden="true"> <popupnotificationcontent orient="vertical" align="start"> <separator/> diff --git a/application/palemoon/base/content/sanitize.js b/application/palemoon/base/content/sanitize.js index 89843c86d..fccec6c98 100644 --- a/application/palemoon/base/content/sanitize.js +++ b/application/palemoon/base/content/sanitize.js @@ -15,7 +15,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise", XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "console", - "resource://gre/modules/devtools/Console.jsm"); + "resource://gre/modules/Console.jsm"); function Sanitizer() {} Sanitizer.prototype = { diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index b8d5f3e41..b5395bbd9 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -73,7 +73,7 @@ .getService(Components.interfaces.nsIFaviconService); </field> <field name="_placesAutocomplete" readonly="true"> - Components.classes["@mozilla.org/autocomplete/search;1?name=history"] + Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"] .getService(Components.interfaces.mozIPlacesAutoComplete); </field> <field name="mTabBox" readonly="true"> @@ -302,6 +302,16 @@ </body> </method> + <method name="getBrowserForContentWindow"> + <parameter name="aWindow"/> + <body> + <![CDATA[ + var tab = this._getTabForContentWindow(aWindow); + return tab ? tab.linkedBrowser : null; + ]]> + </body> + </method> + <method name="getBrowserForOuterWindowID"> <parameter name="aID"/> <body> @@ -707,7 +717,8 @@ let autocomplete = this.mTabBrowser._placesAutocomplete; if (this.mBrowser.registeredOpenURI) { - autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI); + autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI, + this.mBrowser.getAttribute("usercontextid") || 0); delete this.mBrowser.registeredOpenURI; } // Tabs in private windows aren't registered as "Open" so @@ -715,7 +726,8 @@ if (!isBlankPageURL(aLocation.spec) && (!PrivateBrowsingUtils.isWindowPrivate(window) || PrivateBrowsingUtils.permanentPrivateBrowsing)) { - autocomplete.registerOpenPage(aLocation); + autocomplete.registerOpenPage(aLocation, + this.mBrowser.getAttribute("usercontextid") || 0); this.mBrowser.registeredOpenURI = aLocation; } } @@ -1566,7 +1578,7 @@ } if (animate) { - mozRequestAnimationFrame(function () { + requestAnimationFrame(function () { this.tabContainer._handleTabTelemetryStart(t, aURI); // kick the animation off @@ -1865,7 +1877,8 @@ this.mTabListeners[aTab._tPos].destroy(); if (browser.registeredOpenURI && !aTabWillBeMoved) { - this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI); + this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI, + browser.getAttribute("usercontextid") || 0); delete browser.registeredOpenURI; } @@ -2209,7 +2222,8 @@ <![CDATA[ // If the current URI is registered as open remove it from the list. if (aOurBrowser.registeredOpenURI) { - this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI); + this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI, + aOurBrowser.getAttribute("usercontextid") || 0); delete aOurBrowser.registeredOpenURI; } @@ -2950,13 +2964,23 @@ let browser = aMessage.target; switch (aMessage.name) { - case "DOMTitleChanged": + case "DOMTitleChanged": { let tab = this.getTabForBrowser(browser); if (!tab) return; let titleChanged = this.setTabTitle(tab); if (titleChanged && !tab.selected && !tab.hasAttribute("busy")) tab.setAttribute("titlechanged", "true"); + break; + } + case "DOMWebNotificationClicked": { + let tab = this.getTabForBrowser(browser); + if (!tab) + return; + this.selectedTab = tab; + window.focus(); + break; + } } ]]></body> </method> @@ -3022,6 +3046,7 @@ this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID, this.mCurrentBrowser); } + messageManager.addMessageListener("DOMWebNotificationClicked", this); ]]> </constructor> @@ -3055,7 +3080,8 @@ for (var i = 0; i < this.mTabListeners.length; ++i) { let browser = this.getBrowserAtIndex(i); if (browser.registeredOpenURI) { - this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI); + this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI, + browser.getAttribute("usercontextid") || 0); delete browser.registeredOpenURI; } browser.webProgress.removeProgressListener(this.mTabFilters[i]); diff --git a/application/palemoon/branding/official/moz.build b/application/palemoon/branding/official/moz.build index 847510ec0..8cb90130f 100644 --- a/application/palemoon/branding/official/moz.build +++ b/application/palemoon/branding/official/moz.build @@ -4,4 +4,10 @@ # 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/. +DIRS += ['content', 'locales'] + +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') + include('../shared/branding.mozbuild') +ApplicationBranding() diff --git a/application/palemoon/branding/shared/branding.mozbuild b/application/palemoon/branding/shared/branding.mozbuild index 0636be64a..fc832dbe7 100644 --- a/application/palemoon/branding/shared/branding.mozbuild +++ b/application/palemoon/branding/shared/branding.mozbuild @@ -4,52 +4,49 @@ # 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/. -DIRS += ['content', 'locales'] - -DIST_SUBDIR = 'browser' -export('DIST_SUBDIR') - -JS_PREFERENCE_FILES += [ - 'pref/palemoon-branding.js', -] - -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': - FINAL_TARGET_FILES['..'] += [ - 'palemoon.VisualElementsManifest.xml', - ] - FINAL_TARGET_FILES.VisualElements += [ - 'VisualElements_150.png', - 'VisualElements_70.png', - ] - BRANDING_FILES += [ - '../shared/newtab.ico', - '../shared/newwindow.ico', - '../shared/pbmode.ico', - 'appname.bmp', - 'branding.nsi', - 'document.ico', - 'firefox.ico', - 'wizHeader.bmp', - 'wizHeaderRTL.bmp', - 'wizWatermark.bmp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - BRANDING_FILES += [ - '../shared/background.png', - 'disk.icns', - 'document.icns', - 'dsstore', - 'firefox.icns', - ] -elif CONFIG['MOZ_WIDGET_GTK']: - BRANDING_FILES += [ - 'default16.png', - 'default32.png', - 'default48.png', - 'mozicon128.png', +@template +def ApplicationBranding(): + JS_PREFERENCE_PP_FILES += [ + 'pref/palemoon-branding.js', ] -DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] -DEFINES['MOZ_BRANDING_DIRECTORY'] = CONFIG['MOZ_BRANDING_DIRECTORY'] -DEFINES['MOZILLA_UAVERSION_U'] = CONFIG['MOZILLA_UAVERSION_U'] -DEFINES['MOZILLA_COMPATVERSION_U'] = CONFIG['MOZILLA_COMPATVERSION_U']
\ No newline at end of file + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': + FINAL_TARGET_FILES['..'] += [ + 'palemoon.VisualElementsManifest.xml', + ] + FINAL_TARGET_FILES.VisualElements += [ + 'VisualElements_150.png', + 'VisualElements_70.png', + ] + BRANDING_FILES += [ + '../shared/newtab.ico', + '../shared/newwindow.ico', + '../shared/pbmode.ico', + 'appname.bmp', + 'branding.nsi', + 'document.ico', + 'firefox.ico', + 'wizHeader.bmp', + 'wizHeaderRTL.bmp', + 'wizWatermark.bmp', + ] + elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + BRANDING_FILES += [ + '../shared/background.png', + 'disk.icns', + 'document.icns', + 'dsstore', + 'firefox.icns', + ] + elif CONFIG['MOZ_WIDGET_GTK']: + BRANDING_FILES += [ + 'default16.png', + 'default32.png', + 'default48.png', + 'mozicon128.png', + ] + + DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] + DEFINES['MOZ_BRANDING_DIRECTORY'] = CONFIG['MOZ_BRANDING_DIRECTORY'] + DEFINES['MOZILLA_UAVERSION_U'] = CONFIG['MOZILLA_UAVERSION_U'] + DEFINES['MOZILLA_COMPATVERSION_U'] = "52.9" diff --git a/application/palemoon/branding/shared/pref/preferences.inc b/application/palemoon/branding/shared/pref/preferences.inc index a45870b01..a3cfcd138 100644 --- a/application/palemoon/branding/shared/pref/preferences.inc +++ b/application/palemoon/branding/shared/pref/preferences.inc @@ -119,3 +119,11 @@ pref("browser.sessionstore.interval",60000); //every minute instead of every 10 pref("accessibility.force_disabled", 1); // ============================================================================ + +// ===| DevTools |============================================================= + +// Number of usages of the web console or scratchpad. +// If this is less than 5, then pasting code into the web console or scratchpad is disabled +pref("devtools.selfxss.count", 100); + +// ============================================================================ diff --git a/application/palemoon/branding/shared/pref/uaoverrides.inc b/application/palemoon/branding/shared/pref/uaoverrides.inc index 20cc3ab86..db9ccaffa 100644 --- a/application/palemoon/branding/shared/pref/uaoverrides.inc +++ b/application/palemoon/branding/shared/pref/uaoverrides.inc @@ -36,6 +36,7 @@ pref("@GUAO_PREF@.yahoo.com","Mozilla/5.0 (@OS_SLICE@ rv:99.9) @GK_SLICE@ Firefo pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0 @PM_SLICE@");
pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0");
+pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
pref("@GUAO_PREF@.players.brightcove.net","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
// The never-ending Facebook debacle...
@@ -60,7 +61,6 @@ pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (@OS_SLICE@ rv:52.0) @GK_SLICE@ // The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
pref("@GUAO_PREF@.deviantart.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
pref("@GUAO_PREF@.deviantart.net","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
-pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
// UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!)
pref("@GUAO_PREF@.humblebundle.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
diff --git a/application/palemoon/branding/unofficial/moz.build b/application/palemoon/branding/unofficial/moz.build index 847510ec0..8cb90130f 100644 --- a/application/palemoon/branding/unofficial/moz.build +++ b/application/palemoon/branding/unofficial/moz.build @@ -4,4 +4,10 @@ # 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/. +DIRS += ['content', 'locales'] + +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') + include('../shared/branding.mozbuild') +ApplicationBranding() diff --git a/application/palemoon/branding/unstable/moz.build b/application/palemoon/branding/unstable/moz.build index 847510ec0..8cb90130f 100644 --- a/application/palemoon/branding/unstable/moz.build +++ b/application/palemoon/branding/unstable/moz.build @@ -4,4 +4,10 @@ # 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/. +DIRS += ['content', 'locales'] + +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') + include('../shared/branding.mozbuild') +ApplicationBranding() diff --git a/application/palemoon/build.mk b/application/palemoon/build.mk index fc692eda5..ae490aca7 100644 --- a/application/palemoon/build.mk +++ b/application/palemoon/build.mk @@ -3,40 +3,40 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. installer: - @$(MAKE) -C browser/installer installer + @$(MAKE) -C application/palemoon/installer installer package: - @$(MAKE) -C browser/installer + @$(MAKE) -C application/palemoon/installer package-compare: - @$(MAKE) -C browser/installer package-compare + @$(MAKE) -C application/palemoon/installer package-compare stage-package: - @$(MAKE) -C browser/installer stage-package + @$(MAKE) -C application/palemoon/installer stage-package install:: - @$(MAKE) -C browser/installer install + @$(MAKE) -C application/palemoon/installer install clean:: - @$(MAKE) -C browser/installer clean + @$(MAKE) -C application/palemoon/installer clean distclean:: - @$(MAKE) -C browser/installer distclean + @$(MAKE) -C application/palemoon/installer distclean source-package:: - @$(MAKE) -C browser/installer source-package + @$(MAKE) -C application/palemoon/installer source-package upload:: - @$(MAKE) -C browser/installer upload + @$(MAKE) -C application/palemoon/installer upload source-upload:: - @$(MAKE) -C browser/installer source-upload + @$(MAKE) -C application/palemoon/installer source-upload hg-bundle:: - @$(MAKE) -C browser/installer hg-bundle + @$(MAKE) -C application/palemoon/installer hg-bundle l10n-check:: - @$(MAKE) -C browser/locales l10n-check + @$(MAKE) -C application/palemoon/locales l10n-check ifdef ENABLE_TESTS # Implemented in testing/testsuite-targets.mk diff --git a/application/palemoon/components/about/AboutRedirector.cpp b/application/palemoon/components/about/AboutRedirector.cpp index d927b7936..d52b873b9 100644 --- a/application/palemoon/components/about/AboutRedirector.cpp +++ b/application/palemoon/components/about/AboutRedirector.cpp @@ -9,8 +9,6 @@ #include "nsNetUtil.h" #include "nsIScriptSecurityManager.h" #include "mozilla/ArrayUtils.h" -#include "nsDOMString.h" - namespace mozilla { namespace browser { @@ -21,7 +19,6 @@ struct RedirEntry { const char* id; const char* url; uint32_t flags; - const char* idbOriginPostfix; }; /* @@ -33,17 +30,47 @@ struct RedirEntry { URI_SAFE_FOR_UNTRUSTED_CONTENT. */ static RedirEntry kRedirMap[] = { - { "certerror", "chrome://browser/content/certerror/aboutCertError.xhtml", + { + "certerror", "chrome://browser/content/certerror/aboutCertError.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "feeds", "chrome://browser/content/feeds/subscribe.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "feeds", "chrome://browser/content/feeds/subscribe.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, - { "rights", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "home", "chrome://browser/content/abouthome/aboutHome.xhtml", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::MAKE_LINKABLE | + nsIAboutModule::ALLOW_SCRIPT + }, + { + "newtab", "chrome://browser/content/newtab/newTab.xul", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "palemoon", "chrome://global/content/memoriam.xhtml", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "permissions", "chrome://browser/content/preferences/aboutPermissions.xul", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "rights", #ifdef MOZ_OFFICIAL_BRANDING "chrome://global/content/aboutRights.xhtml", #else @@ -51,34 +78,27 @@ static RedirEntry kRedirMap[] = { #endif nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::MAKE_LINKABLE | - nsIAboutModule::ALLOW_SCRIPT }, - { "palemoon", "chrome://global/content/palemoon.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "robots", "chrome://browser/content/aboutRobots.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "logopage", "chrome://global/content/logopage.xhtml", - nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "robots", "chrome://browser/content/aboutRobots.xhtml", - nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::ALLOW_SCRIPT }, - { "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, + nsIAboutModule::ALLOW_SCRIPT + }, + { + "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, #ifdef MOZ_SERVICES_SYNC - { "sync-progress", "chrome://browser/content/sync/progress.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, - { "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul", - nsIAboutModule::ALLOW_SCRIPT }, + { + "sync-progress", "chrome://browser/content/sync/progress.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul", + nsIAboutModule::ALLOW_SCRIPT + }, #endif - { "home", "chrome://browser/content/abouthome/aboutHome.xhtml", - nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::MAKE_LINKABLE | - nsIAboutModule::ALLOW_SCRIPT }, - { "newtab", "chrome://browser/content/newtab/newTab.xul", - nsIAboutModule::ALLOW_SCRIPT }, - { "permissions", "chrome://browser/content/preferences/aboutPermissions.xul", - nsIAboutModule::ALLOW_SCRIPT }, - { "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul", - nsIAboutModule::ALLOW_SCRIPT }, }; static const int kRedirTotal = ArrayLength(kRedirMap); @@ -148,30 +168,6 @@ 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) { diff --git a/application/palemoon/components/build/moz.build b/application/palemoon/components/build/moz.build index f8073907e..5bc4858d7 100644 --- a/application/palemoon/components/build/moz.build +++ b/application/palemoon/components/build/moz.build @@ -24,11 +24,17 @@ LOCAL_INCLUDES += [ if CONFIG['OS_ARCH'] == 'WINNT': OS_LIBS += [ + 'esent', + 'netapi32', 'ole32', 'shell32', 'shlwapi', 'version', ] + DELAYLOAD_DLLS += [ + 'esent.dll', + 'netapi32.dll', + ] # Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code) # GTK2: Need to link with glib for GNOME shell service diff --git a/application/palemoon/components/build/nsModule.cpp b/application/palemoon/components/build/nsModule.cpp index d5b79b455..fad87d831 100644 --- a/application/palemoon/components/build/nsModule.cpp +++ b/application/palemoon/components/build/nsModule.cpp @@ -91,7 +91,6 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = { { NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "palemoon", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, - { NS_ABOUT_MODULE_CONTRACTID_PREFIX "logopage", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, #ifdef MOZ_SERVICES_SYNC diff --git a/application/palemoon/components/dirprovider/DirectoryProvider.cpp b/application/palemoon/components/dirprovider/DirectoryProvider.cpp index 4d3993b7f..85728b351 100644 --- a/application/palemoon/components/dirprovider/DirectoryProvider.cpp +++ b/application/palemoon/components/dirprovider/DirectoryProvider.cpp @@ -34,57 +34,7 @@ NS_IMPL_ISUPPORTS(DirectoryProvider, NS_IMETHODIMP DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult) { - nsresult rv; - - *aResult = nullptr; - - // NOTE: This function can be reentrant through the NS_GetSpecialDirectory - // call, so be careful not to cause infinite recursion. - - nsCOMPtr<nsIFile> file; - - char const* leafName = nullptr; - - if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) { - leafName = "bookmarks.html"; - - nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefs) { - nsCString path; - rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path)); - if (NS_SUCCEEDED(rv)) { - NS_NewNativeLocalFile(path, true, getter_AddRefs(file)); - } - } - } - else { - return NS_ERROR_FAILURE; - } - - nsDependentCString leafstr(leafName); - - nsCOMPtr<nsIFile> parentDir; - if (file) { - rv = file->GetParent(getter_AddRefs(parentDir)); - if (NS_FAILED(rv)) - return rv; - } - else { - rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(parentDir)); - if (NS_FAILED(rv)) - return rv; - - rv = parentDir->Clone(getter_AddRefs(file)); - if (NS_FAILED(rv)) - return rv; - - file->AppendNative(leafstr); - } - - *aPersist = true; - NS_ADDREF(*aResult = file); - - return NS_OK; + return NS_ERROR_FAILURE; } static void diff --git a/application/palemoon/components/downloads/DownloadsCommon.jsm b/application/palemoon/components/downloads/DownloadsCommon.jsm index b90baaf9c..0921f8400 100644 --- a/application/palemoon/components/downloads/DownloadsCommon.jsm +++ b/application/palemoon/components/downloads/DownloadsCommon.jsm @@ -867,9 +867,19 @@ DownloadsDataCtor.prototype = { // Sort backwards by start time, ensuring that the most recent // downloads are added first regardless of their state. - let loadedItemsArray = [dataItem - for each (dataItem in this.dataItems) - if (dataItem)]; + // Tycho: + //let loadedItemsArray = [dataItem + // for each (dataItem in this.dataItems) + // if (dataItem)]; + + let loadedItemsArray = []; + + for each (let dataItem in this.dataItems) { + if (dataItem) { + loadedItemsArray.push(dataItem); + } + } + loadedItemsArray.sort(function(a, b) b.startTime - a.startTime); loadedItemsArray.forEach( function (dataItem) aView.onDataItemAdded(dataItem, false) diff --git a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js index e1d0e75d4..9d90b20e1 100644 --- a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js +++ b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js @@ -8,9 +8,9 @@ * ON IT AS AN API. */ -let Cu = Components.utils; -let Ci = Components.interfaces; -let Cc = Components.classes; +var Cu = Components.utils; +var Ci = Components.interfaces; +var Cc = Components.classes; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -1408,7 +1408,12 @@ DownloadsPlacesView.prototype = { _copySelectedDownloadsToClipboard: function DPV__copySelectedDownloadsToClipboard() { let selectedElements = this._richlistbox.selectedItems; - let urls = [e._shell.downloadURI for each (e in selectedElements)]; + // Tycho: let urls = [e._shell.downloadURI for each (e in selectedElements)]; + let urls = []; + + for each (e in selectedElements) { + urls.push(e._shell.downloadURI); + } Cc["@mozilla.org/widget/clipboardhelper;1"]. getService(Ci.nsIClipboardHelper).copyString(urls.join("\n"), document); diff --git a/application/palemoon/components/feeds/moz.build b/application/palemoon/components/feeds/moz.build index 1dea0ce77..7ae9141aa 100644 --- a/application/palemoon/components/feeds/moz.build +++ b/application/palemoon/components/feeds/moz.build @@ -35,5 +35,3 @@ for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): LOCAL_INCLUDES += [ '../build', ] - -FAIL_ON_WARNINGS = True diff --git a/application/palemoon/components/feeds/nsFeedSniffer.cpp b/application/palemoon/components/feeds/nsFeedSniffer.cpp index 61cc77bdd..f314d3d3b 100644 --- a/application/palemoon/components/feeds/nsFeedSniffer.cpp +++ b/application/palemoon/components/feeds/nsFeedSniffer.cpp @@ -135,7 +135,7 @@ FindChar(char c, const char *begin, const char *end) * it's possible that someone embedded one of these tags inside a document of * another type, e.g. a HTML document, and we don't want to show the preview * page if the document isn't actually a feed. - * + * * @param start * The beginning of the data being sniffed * @param end @@ -331,7 +331,7 @@ nsFeedSniffer::OnStartRequest(nsIRequest* request, nsISupports* context) return NS_OK; } -NS_METHOD +nsresult nsFeedSniffer::AppendSegmentToString(nsIInputStream* inputStream, void* closure, const char* rawSegment, diff --git a/application/palemoon/components/feeds/nsFeedSniffer.h b/application/palemoon/components/feeds/nsFeedSniffer.h index 57e10d954..a0eb9862c 100644 --- a/application/palemoon/components/feeds/nsFeedSniffer.h +++ b/application/palemoon/components/feeds/nsFeedSniffer.h @@ -10,7 +10,7 @@ #include "mozilla/Attributes.h" class nsFeedSniffer final : public nsIContentSniffer, - nsIStreamListener + nsIStreamListener { public: NS_DECL_ISUPPORTS @@ -18,12 +18,12 @@ public: NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER - static NS_METHOD AppendSegmentToString(nsIInputStream* inputStream, - void* closure, - const char* rawSegment, - uint32_t toOffset, - uint32_t count, - uint32_t* writeCount); + static nsresult AppendSegmentToString(nsIInputStream* inputStream, + void* closure, + const char* rawSegment, + uint32_t toOffset, + uint32_t count, + uint32_t* writeCount); protected: ~nsFeedSniffer() {} diff --git a/application/palemoon/components/fuel/fuelApplication.js b/application/palemoon/components/fuel/fuelApplication.js index 89d568ae1..017813143 100644 --- a/application/palemoon/components/fuel/fuelApplication.js +++ b/application/palemoon/components/fuel/fuelApplication.js @@ -729,7 +729,7 @@ var ApplicationFactory = { }; -#include ../../../toolkit/components/exthelper/extApplication.js +#include ../../../../toolkit/components/exthelper/extApplication.js //================================================= // Application constructor diff --git a/application/palemoon/components/migration/MigrationUtils.jsm b/application/palemoon/components/migration/MigrationUtils.jsm index fcd73a798..882c7cf32 100644 --- a/application/palemoon/components/migration/MigrationUtils.jsm +++ b/application/palemoon/components/migration/MigrationUtils.jsm @@ -176,7 +176,13 @@ this.MigratorPrototype = { * @see nsIBrowserProfileMigrator */ getMigrateData: function MP_getMigrateData(aProfile) { - let types = [r.type for each (r in this._getMaybeCachedResources(aProfile))]; + // Tycho: let types = [r.type for each (r in this._getMaybeCachedResources(aProfile))]; + let types = []; + + for each (r in this._getMaybeCachedResources(aProfile)) { + types.push(r.type); + } + return types.reduce(function(a, b) a |= b, 0); }, @@ -192,7 +198,14 @@ this.MigratorPrototype = { throw new Error("migrate called for a non-existent source"); if (aItems != Ci.nsIBrowserProfileMigrator.ALL) - resources = [r for each (r in resources) if (aItems & r.type)]; + // Tycho: resources = [r for each (r in resources) if (aItems & r.type)]; + resources = []; + + for each (r in resources) { + if (aItems & r.type) { + resources.push(r); + } + } // Called either directly or through the bookmarks import callback. function doMigrate() { diff --git a/application/palemoon/components/migration/SafariProfileMigrator.js b/application/palemoon/components/migration/SafariProfileMigrator.js index 70804793d..e3f73c2c8 100644 --- a/application/palemoon/components/migration/SafariProfileMigrator.js +++ b/application/palemoon/components/migration/SafariProfileMigrator.js @@ -4,9 +4,9 @@ "use strict"; -let Cc = Components.classes; -let Ci = Components.interfaces; -let Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); diff --git a/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp b/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp index 7fe31a666..0b377d27e 100644 --- a/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp +++ b/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp @@ -1,139 +1,119 @@ -/* 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/. */
-
-#include "nsIEHistoryEnumerator.h"
-
-#include <urlhist.h>
-#include <shlguid.h>
-
-#include "nsStringAPI.h"
-#include "nsNetUtil.h"
-#include "nsIVariant.h"
-#include "nsCOMArray.h"
-#include "nsArrayEnumerator.h"
-
-namespace {
-
- PRTime FileTimeToPRTime(FILETIME* filetime)
- {
- SYSTEMTIME st;
- ::FileTimeToSystemTime(filetime, &st);
- PRExplodedTime prt;
- prt.tm_year = st.wYear;
- // SYSTEMTIME's day-of-month parameter is 1-based,
- // PRExplodedTime's is 0-based.
- prt.tm_month = st.wMonth - 1;
- prt.tm_mday = st.wDay;
- prt.tm_hour = st.wHour;
- prt.tm_min = st.wMinute;
- prt.tm_sec = st.wSecond;
- prt.tm_usec = st.wMilliseconds * 1000;
- prt.tm_wday = 0;
- prt.tm_yday = 0;
- prt.tm_params.tp_gmt_offset = 0;
- prt.tm_params.tp_dst_offset = 0;
- return PR_ImplodeTime(&prt);
- }
-
-} // Anonymous namespace.
-
-////////////////////////////////////////////////////////////////////////////////
-//// nsIEHistoryEnumerator
-
-NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator)
-
-nsIEHistoryEnumerator::nsIEHistoryEnumerator()
-{
- ::CoInitialize(nullptr);
-}
-
-nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
-{
- ::CoUninitialize();
-}
-
-void
-nsIEHistoryEnumerator::EnsureInitialized()
-{
- if (mURLEnumerator)
- return;
-
- HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
- nullptr,
- CLSCTX_INPROC_SERVER,
- IID_IUrlHistoryStg2,
- getter_AddRefs(mIEHistory));
- if (FAILED(hr))
- return;
-
- hr = mIEHistory->EnumUrls(getter_AddRefs(mURLEnumerator));
- if (FAILED(hr))
- return;
-}
-
-NS_IMETHODIMP
-nsIEHistoryEnumerator::HasMoreElements(bool* _retval)
-{
- *_retval = false;
-
- EnsureInitialized();
- MOZ_ASSERT(mURLEnumerator, "Should have instanced an IE History URLEnumerator");
- if (!mURLEnumerator)
- return NS_OK;
-
- STATURL statURL;
- ULONG fetched;
-
- // First argument is not implemented, so doesn't matter what we pass.
- HRESULT hr = mURLEnumerator->Next(1, &statURL, &fetched);
- if (FAILED(hr) || fetched != 1UL) {
- // Reached the last entry.
- return NS_OK;
- }
-
- nsCOMPtr<nsIURI> uri;
- if (statURL.pwcsUrl) {
- nsDependentString url(statURL.pwcsUrl);
- nsresult rv = NS_NewURI(getter_AddRefs(uri), url);
- ::CoTaskMemFree(statURL.pwcsUrl);
- if (NS_FAILED(rv)) {
- // Got a corrupt or invalid URI, continue to the next entry.
- return HasMoreElements(_retval);
- }
- }
-
- nsDependentString title(statURL.pwcsTitle);
-
- PRTime lastVisited = FileTimeToPRTime(&(statURL.ftLastVisited));
-
- mCachedNextEntry = do_CreateInstance("@mozilla.org/hash-property-bag;1");
- MOZ_ASSERT(mCachedNextEntry, "Should have instanced a new property bag");
- if (mCachedNextEntry) {
- mCachedNextEntry->SetPropertyAsInterface(NS_LITERAL_STRING("uri"), uri);
- mCachedNextEntry->SetPropertyAsAString(NS_LITERAL_STRING("title"), title);
- mCachedNextEntry->SetPropertyAsInt64(NS_LITERAL_STRING("time"), lastVisited);
-
- *_retval = true;
- }
-
- if (statURL.pwcsTitle)
- ::CoTaskMemFree(statURL.pwcsTitle);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsIEHistoryEnumerator::GetNext(nsISupports** _retval)
-{
- *_retval = nullptr;
-
- if (!mCachedNextEntry)
- return NS_ERROR_FAILURE;
-
- NS_ADDREF(*_retval = mCachedNextEntry);
- // Release the cached entry, so it can't be returned twice.
- mCachedNextEntry = nullptr;
-
- return NS_OK;
-}
+/* 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/. */ + +#include "nsIEHistoryEnumerator.h" + +#include <urlhist.h> +#include <shlguid.h> + +#include "nsArrayEnumerator.h" +#include "nsCOMArray.h" +#include "nsIVariant.h" +#include "nsNetUtil.h" +#include "nsStringAPI.h" +#include "nsWindowsMigrationUtils.h" +#include "prtime.h" + +//////////////////////////////////////////////////////////////////////////////// +//// nsIEHistoryEnumerator + +NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator) + +nsIEHistoryEnumerator::nsIEHistoryEnumerator() +{ + ::CoInitialize(nullptr); +} + +nsIEHistoryEnumerator::~nsIEHistoryEnumerator() +{ + ::CoUninitialize(); +} + +void +nsIEHistoryEnumerator::EnsureInitialized() +{ + if (mURLEnumerator) + return; + + HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory, + nullptr, + CLSCTX_INPROC_SERVER, + IID_IUrlHistoryStg2, + getter_AddRefs(mIEHistory)); + if (FAILED(hr)) + return; + + hr = mIEHistory->EnumUrls(getter_AddRefs(mURLEnumerator)); + if (FAILED(hr)) + return; +} + +NS_IMETHODIMP +nsIEHistoryEnumerator::HasMoreElements(bool* _retval) +{ + *_retval = false; + + EnsureInitialized(); + MOZ_ASSERT(mURLEnumerator, "Should have instanced an IE History URLEnumerator"); + if (!mURLEnumerator) + return NS_OK; + + STATURL statURL; + ULONG fetched; + + // First argument is not implemented, so doesn't matter what we pass. + HRESULT hr = mURLEnumerator->Next(1, &statURL, &fetched); + if (FAILED(hr) || fetched != 1UL) { + // Reached the last entry. + return NS_OK; + } + + nsCOMPtr<nsIURI> uri; + if (statURL.pwcsUrl) { + nsDependentString url(statURL.pwcsUrl); + nsresult rv = NS_NewURI(getter_AddRefs(uri), url); + ::CoTaskMemFree(statURL.pwcsUrl); + if (NS_FAILED(rv)) { + // Got a corrupt or invalid URI, continue to the next entry. + return HasMoreElements(_retval); + } + } + + nsDependentString title(statURL.pwcsTitle ? statURL.pwcsTitle : L""); + + bool lastVisitTimeIsValid; + PRTime lastVisited = WinMigrationFileTimeToPRTime(&(statURL.ftLastVisited), &lastVisitTimeIsValid); + + mCachedNextEntry = do_CreateInstance("@mozilla.org/hash-property-bag;1"); + MOZ_ASSERT(mCachedNextEntry, "Should have instanced a new property bag"); + if (mCachedNextEntry) { + mCachedNextEntry->SetPropertyAsInterface(NS_LITERAL_STRING("uri"), uri); + mCachedNextEntry->SetPropertyAsAString(NS_LITERAL_STRING("title"), title); + if (lastVisitTimeIsValid) { + mCachedNextEntry->SetPropertyAsInt64(NS_LITERAL_STRING("time"), lastVisited); + } + + *_retval = true; + } + + if (statURL.pwcsTitle) + ::CoTaskMemFree(statURL.pwcsTitle); + + return NS_OK; +} + +NS_IMETHODIMP +nsIEHistoryEnumerator::GetNext(nsISupports** _retval) +{ + *_retval = nullptr; + + if (!mCachedNextEntry) + return NS_ERROR_FAILURE; + + NS_ADDREF(*_retval = mCachedNextEntry); + // Release the cached entry, so it can't be returned twice. + mCachedNextEntry = nullptr; + + return NS_OK; +} diff --git a/application/palemoon/components/migration/nsIEHistoryEnumerator.h b/application/palemoon/components/migration/nsIEHistoryEnumerator.h index fc1419859..1572a8dd5 100644 --- a/application/palemoon/components/migration/nsIEHistoryEnumerator.h +++ b/application/palemoon/components/migration/nsIEHistoryEnumerator.h @@ -1,37 +1,37 @@ -/* 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/. */
-
-#ifndef iehistoryenumerator___h___
-#define iehistoryenumerator___h___
-
-#include <urlhist.h>
-
-#include "mozilla/Attributes.h"
-#include "nsISimpleEnumerator.h"
-#include "nsIWritablePropertyBag2.h"
-#include "nsAutoPtr.h"
-
-class nsIEHistoryEnumerator final : public nsISimpleEnumerator
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSISIMPLEENUMERATOR
-
- nsIEHistoryEnumerator();
-
-private:
- ~nsIEHistoryEnumerator();
-
- /**
- * Initializes the history reader, if needed.
- */
- void EnsureInitialized();
-
- nsRefPtr<IUrlHistoryStg2> mIEHistory;
- nsRefPtr<IEnumSTATURL> mURLEnumerator;
-
- nsCOMPtr<nsIWritablePropertyBag2> mCachedNextEntry;
-};
-
-#endif
+/* 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/. */ + +#ifndef iehistoryenumerator___h___ +#define iehistoryenumerator___h___ + +#include <urlhist.h> + +#include "mozilla/Attributes.h" +#include "nsCOMPtr.h" +#include "nsISimpleEnumerator.h" +#include "nsIWritablePropertyBag2.h" + +class nsIEHistoryEnumerator final : public nsISimpleEnumerator +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSISIMPLEENUMERATOR + + nsIEHistoryEnumerator(); + +private: + ~nsIEHistoryEnumerator(); + + /** + * Initializes the history reader, if needed. + */ + void EnsureInitialized(); + + RefPtr<IUrlHistoryStg2> mIEHistory; + RefPtr<IEnumSTATURL> mURLEnumerator; + + nsCOMPtr<nsIWritablePropertyBag2> mCachedNextEntry; +}; + +#endif diff --git a/application/palemoon/components/migration/nsWindowsMigrationUtils.h b/application/palemoon/components/migration/nsWindowsMigrationUtils.h new file mode 100644 index 000000000..0288d93d3 --- /dev/null +++ b/application/palemoon/components/migration/nsWindowsMigrationUtils.h @@ -0,0 +1,36 @@ +/* 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/. */ + +#ifndef windowsmigrationutils__h__ +#define windowsmigrationutils__h__ + +#include "prtime.h" + +static +PRTime WinMigrationFileTimeToPRTime(FILETIME* filetime, bool* isValid) +{ + SYSTEMTIME st; + *isValid = ::FileTimeToSystemTime(filetime, &st); + if (!*isValid) { + return 0; + } + PRExplodedTime prt; + prt.tm_year = st.wYear; + // SYSTEMTIME's day-of-month parameter is 1-based, + // PRExplodedTime's is 0-based. + prt.tm_month = st.wMonth - 1; + prt.tm_mday = st.wDay; + prt.tm_hour = st.wHour; + prt.tm_min = st.wMinute; + prt.tm_sec = st.wSecond; + prt.tm_usec = st.wMilliseconds * 1000; + prt.tm_wday = 0; + prt.tm_yday = 0; + prt.tm_params.tp_gmt_offset = 0; + prt.tm_params.tp_dst_offset = 0; + return PR_ImplodeTime(&prt); +} + +#endif + diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js index 705593b59..aafdced9f 100644 --- a/application/palemoon/components/nsBrowserGlue.js +++ b/application/palemoon/components/nsBrowserGlue.js @@ -13,59 +13,29 @@ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", - "resource://gre/modules/AddonManager.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", - "resource://gre/modules/NetUtil.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides", - "resource://gre/modules/UserAgentOverrides.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", - "resource://gre/modules/FileUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", - "resource://gre/modules/PlacesUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils", - "resource://gre/modules/BookmarkHTMLUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "BookmarkJSONUtils", - "resource://gre/modules/BookmarkJSONUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs", - "resource://gre/modules/PageThumbs.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils", - "resource://gre/modules/NewTabUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "BrowserNewTabPreloader", - "resource:///modules/BrowserNewTabPreloader.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "webrtcUI", - "resource:///modules/webrtcUI.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", - "resource:///modules/RecentWindow.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "Task", - "resource://gre/modules/Task.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups", - "resource://gre/modules/PlacesBackups.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "OS", - "resource://gre/modules/osfile.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerParent", - "resource://gre/modules/LoginManagerParent.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "FormValidationHandler", - "resource:///modules/FormValidationHandler.jsm"); +// Define Lazy Module Gitters +[ + ["AddonManager", "resource://gre/modules/AddonManager.jsm"], + ["NetUtil", "resource://gre/modules/NetUtil.jsm"], + ["UserAgentOverrides", "resource://gre/modules/UserAgentOverrides.jsm"], + ["FileUtils", "resource://gre/modules/FileUtils.jsm"], + ["PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"], + ["BookmarkHTMLUtils", "resource://gre/modules/BookmarkHTMLUtils.jsm"], + ["BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.jsm"], + ["PageThumbs", "resource://gre/modules/PageThumbs.jsm"], + ["NewTabUtils", "resource://gre/modules/NewTabUtils.jsm"], + ["BrowserNewTabPreloader", "resource:///modules/BrowserNewTabPreloader.jsm"], +#ifdef MOZ_WEBRTC + ["webrtcUI", "resource:///modules/webrtcUI.jsm"], +#endif + ["PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"], + ["RecentWindow", "resource:///modules/RecentWindow.jsm"], + ["Task", "resource://gre/modules/Task.jsm"], + ["PlacesBackups", "resource://gre/modules/PlacesBackups.jsm"], + ["OS", "resource://gre/modules/osfile.jsm"], + ["LoginManagerParent", "resource://gre/modules/LoginManagerParent.jsm"], + ["FormValidationHandler", "resource:///modules/FormValidationHandler.jsm"], +].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource)); const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser"; const PREF_PLUGINS_UPDATEURL = "plugins.update.url"; @@ -427,16 +397,13 @@ BrowserGlue.prototype = { PageThumbs.init(); NewTabUtils.init(); BrowserNewTabPreloader.init(); +#ifdef MOZ_WEBRTC webrtcUI.init(); +#endif FormValidationHandler.init(); LoginManagerParent.init(); - // Make sure conflicting MSE prefs don't coexist - if (Services.prefs.getBoolPref('media.mediasource.format-reader', true)) { - Services.prefs.setBoolPref('media.mediasource.webm.enabled', false); - } - Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); }, @@ -539,7 +506,9 @@ BrowserGlue.prototype = { _onProfileShutdown: function BG__onProfileShutdown() { BrowserNewTabPreloader.uninit(); UserAgentOverrides.uninit(); +#ifdef MOZ_WEBRTC webrtcUI.uninit(); +#endif FormValidationHandler.uninit(); this._dispose(); }, @@ -1213,7 +1182,7 @@ BrowserGlue.prototype = { }, _migrateUI: function BG__migrateUI() { - const UI_VERSION = 14; + const UI_VERSION = 15; const BROWSER_DOCURL = "chrome://browser/content/browser.xul#"; let currentUIVersion = 0; try { @@ -1395,7 +1364,7 @@ BrowserGlue.prototype = { } } - if (currentUIVersion < 14) { + if (currentUIVersion < 16) { // Migrate Sync from pmsync.palemoon.net to pmsync.palemoon.org try { let syncURL = Services.prefs.getCharPref("services.sync.clusterURL"); diff --git a/application/palemoon/components/places/content/treeView.js b/application/palemoon/components/places/content/treeView.js index c1879aacf..aba731470 100644 --- a/application/palemoon/components/places/content/treeView.js +++ b/application/palemoon/components/places/content/treeView.js @@ -144,7 +144,12 @@ PlacesTreeView.prototype = { // A node is removed form the view either if it has no parent or if its // root-ancestor is not the root node (in which case that's the node // for which nodeRemoved was called). - let ancestors = [x for (x of PlacesUtils.nodeAncestors(aNode))]; + // Tycho: let ancestors = [x for (x of PlacesUtils.nodeAncestors(aNode))]; + let ancestors = []; + for (let x of PlacesUtils.nodeAncestors(aNode)) { + ancestors.push(x); + } + if (ancestors.length == 0 || ancestors[ancestors.length - 1] != this._rootNode) { throw new Error("Removed node passed to _getRowForNode"); diff --git a/application/palemoon/components/preferences/aboutPermissions.js b/application/palemoon/components/preferences/aboutPermissions.js index 4d803145d..106d45f89 100644 --- a/application/palemoon/components/preferences/aboutPermissions.js +++ b/application/palemoon/components/preferences/aboutPermissions.js @@ -2,9 +2,9 @@ * 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/. */ -let Ci = Components.interfaces; -let Cc = Components.classes; -let Cu = Components.utils; +var Ci = Components.interfaces; +var Cc = Components.classes; +var Cu = Components.utils; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/PluralForm.jsm"); diff --git a/application/palemoon/components/preferences/security.js b/application/palemoon/components/preferences/security.js index a337f398c..56664bf66 100644 --- a/application/palemoon/components/preferences/security.js +++ b/application/palemoon/components/preferences/security.js @@ -3,6 +3,9 @@ * 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/. */ +XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper", + "resource://gre/modules/LoginHelper.jsm"); + Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); var gSecurityPane = { @@ -141,7 +144,7 @@ var gSecurityPane = { */ _initMasterPasswordUI: function () { - var noMP = !this._masterPasswordSet(); + var noMP = !LoginHelper.isMasterPasswordSet(); var button = document.getElementById("changeMasterPassword"); button.disabled = noMP; @@ -151,26 +154,6 @@ var gSecurityPane = { }, /** - * Returns true if the user has a master password set and false otherwise. - */ - _masterPasswordSet: function () - { - const Cc = Components.classes, Ci = Components.interfaces; - var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"]. - getService(Ci.nsIPKCS11ModuleDB); - var slot = secmodDB.findSlotByName(""); - if (slot) { - var status = slot.status; - var hasMP = status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED && - status != Ci.nsIPKCS11Slot.SLOT_READY; - return hasMP; - } else { - // XXX I have no bloody idea what this means - return false; - } - }, - - /** * Enables/disables the master password button depending on the state of the * "use master password" checkbox, and prompts for master password removal if * one is set. diff --git a/application/palemoon/components/sessionstore/SessionStore.jsm b/application/palemoon/components/sessionstore/SessionStore.jsm index b74e68a2f..136a3d8de 100644 --- a/application/palemoon/components/sessionstore/SessionStore.jsm +++ b/application/palemoon/components/sessionstore/SessionStore.jsm @@ -106,12 +106,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", #ifdef MOZ_DEVTOOLS XPCOMUtils.defineLazyModuleGetter(this, "ScratchpadManager", - "resource://gre/modules/devtools/scratchpad-manager.jsm"); + "resource://devtools/client/scratchpad/scratchpad-manager.jsm"); Object.defineProperty(this, "HUDService", { get: function HUDService_getter() { - let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; - return devtools.require("devtools/webconsole/hudservice").HUDService; + let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools; + return devtools.require("devtools/client/webconsole/hudservice").HUDService; }, configurable: true, enumerable: true diff --git a/application/palemoon/components/sessionstore/_SessionFile.jsm b/application/palemoon/components/sessionstore/_SessionFile.jsm index 7e1b05f74..e949112f2 100644 --- a/application/palemoon/components/sessionstore/_SessionFile.jsm +++ b/application/palemoon/components/sessionstore/_SessionFile.jsm @@ -41,7 +41,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "console", - "resource://gre/modules/devtools/Console.jsm"); + "resource://gre/modules/Console.jsm"); // An encoder to UTF-8. XPCOMUtils.defineLazyGetter(this, "gEncoder", function () { diff --git a/application/palemoon/components/sessionstore/nsSessionStartup.js b/application/palemoon/components/sessionstore/nsSessionStartup.js index 024246619..7f07e9050 100644 --- a/application/palemoon/components/sessionstore/nsSessionStartup.js +++ b/application/palemoon/components/sessionstore/nsSessionStartup.js @@ -77,9 +77,14 @@ SessionStartup.prototype = { return; } - _SessionFile.read().then( - this._onSessionFileRead.bind(this) - ); + if (Services.prefs.getBoolPref("browser.sessionstore.resume_session_once") || + Services.prefs.getIntPref("browser.startup.page") == 3) { + this._ensureInitialized(); + } else { + _SessionFile.read().then( + this._onSessionFileRead.bind(this) + ); + } }, // Wrap a string as a nsISupports diff --git a/application/palemoon/components/shell/ShellService.jsm b/application/palemoon/components/shell/ShellService.jsm new file mode 100644 index 000000000..12e275bdb --- /dev/null +++ b/application/palemoon/components/shell/ShellService.jsm @@ -0,0 +1,114 @@ +/* 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/. */ + +"use strict"; + +this.EXPORTED_SYMBOLS = ["ShellService"]; + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/AppConstants.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry", + "resource://gre/modules/WindowsRegistry.jsm"); + +/** + * Internal functionality to save and restore the docShell.allow* properties. + */ +let ShellServiceInternal = { + /** + * Used to determine whether or not to offer "Set as desktop background" + * functionality. Even if shell service is available it is not + * guaranteed that it is able to set the background for every desktop + * which is especially true for Linux with its many different desktop + * environments. + */ + get canSetDesktopBackground() { + if (AppConstants.platform == "win" || + AppConstants.platform == "macosx") { + return true; + } + + if (AppConstants.platform == "linux") { + if (this.shellService) { + let linuxShellService = this.shellService + .QueryInterface(Ci.nsIGNOMEShellService); + return linuxShellService.canSetDesktopBackground; + } + } + + return false; + }, + + /** + * Used to determine whether or not to show a "Set Default Browser" + * query dialog. This attribute is true if the application is starting + * up and "browser.shell.checkDefaultBrowser" is true, otherwise it + * is false. + */ + _checkedThisSession: false, + get shouldCheckDefaultBrowser() { + // If we've already checked, the browser has been started and this is a + // new window open, and we don't want to check again. + if (this._checkedThisSession) { + return false; + } + + if (!Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser")) { + return false; + } + + if (AppConstants.platform == "win") { + let optOutValue = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, + "Software\\Mozilla\\PaleMoon", + "DefaultBrowserOptOut"); + WindowsRegistry.removeRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, + "Software\\Mozilla\\PaleMoon", + "DefaultBrowserOptOut"); + if (optOutValue == "True") { + Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", false); + return false; + } + } + + return true; + }, + + set shouldCheckDefaultBrowser(shouldCheck) { + Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", !!shouldCheck); + }, + + isDefaultBrowser(startupCheck, forAllTypes) { + // If this is the first browser window, maintain internal state that we've + // checked this session (so that subsequent window opens don't show the + // default browser dialog). + if (startupCheck) { + this._checkedThisSession = true; + } + if (this.shellService) { + return this.shellService.isDefaultBrowser(startupCheck, forAllTypes); + } + return false; + } +}; + +XPCOMUtils.defineLazyServiceGetter(ShellServiceInternal, "shellService", + "@mozilla.org/browser/shell-service;1", Ci.nsIShellService); + +/** + * The external API exported by this module. + */ +this.ShellService = new Proxy(ShellServiceInternal, { + get(target, name) { + if (name in target) { + return target[name]; + } + if (target.shellService) { + return target.shellService[name]; + } + Services.console.logStringMessage(`${name} not found in ShellService: ${target.shellService}`); + return undefined; + } +}); diff --git a/application/palemoon/components/shell/content/setDesktopBackground.js b/application/palemoon/components/shell/content/setDesktopBackground.js index e90a32d03..53cc70db0 100644 --- a/application/palemoon/components/shell/content/setDesktopBackground.js +++ b/application/palemoon/components/shell/content/setDesktopBackground.js @@ -1,16 +1,14 @@ -# 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/. +/* 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/. */ + +Components.utils.import("resource://gre/modules/AppConstants.jsm"); var Ci = Components.interfaces; var gSetBackground = { -#ifndef XP_MACOSX - _position : "", - _backgroundColor : 0, -#else - _position : "STRETCH", -#endif + _position : AppConstants.platform == "macosx" ? "STRETCH" : "", + _backgroundColor : AppConstants.platform != "macosx" ? 0 : undefined, _screenWidth : 0, _screenHeight : 0, _image : null, @@ -27,23 +25,23 @@ var gSetBackground = { this._canvas = document.getElementById("screen"); this._screenWidth = screen.width; this._screenHeight = screen.height; -#ifdef XP_MACOSX - document.documentElement.getButton("accept").hidden = true; -#endif + if (AppConstants.platform == "macosx") { + document.documentElement.getButton("accept").hidden = true; + } if (this._screenWidth / this._screenHeight >= 1.6) document.getElementById("monitor").setAttribute("aspectratio", "16:10"); -#ifdef XP_WIN - // hide fill + fit options if <win7 since don't work - var version = Components.classes["@mozilla.org/system-info;1"] - .getService(Ci.nsIPropertyBag2) - .getProperty("version"); - var isWindows7OrHigher = (parseFloat(version) >= 6.1); - if (!isWindows7OrHigher) { - document.getElementById("fillPosition").hidden = true; - document.getElementById("fitPosition").hidden = true; + if (AppConstants.platform == "win") { + // Hide fill + fit options if < Win7 since they don't work. + var version = Components.classes["@mozilla.org/system-info;1"] + .getService(Ci.nsIPropertyBag2) + .getProperty("version"); + var isWindows7OrHigher = (parseFloat(version) >= 6.1); + if (!isWindows7OrHigher) { + document.getElementById("fillPosition").hidden = true; + document.getElementById("fitPosition").hidden = true; + } } -#endif // make sure that the correct dimensions will be used setTimeout(function(self) { @@ -62,92 +60,37 @@ var gSetBackground = { var ctx = this._canvas.getContext("2d"); ctx.scale(this._canvas.clientWidth / this._screenWidth, this._canvas.clientHeight / this._screenHeight); -#ifndef XP_MACOSX - this._initColor(); -#else - // Make sure to reset the button state in case the user has already - // set an image as their desktop background. - var setDesktopBackground = document.getElementById("setDesktopBackground"); - setDesktopBackground.hidden = false; - var bundle = document.getElementById("backgroundBundle"); - setDesktopBackground.label = bundle.getString("DesktopBackgroundSet"); - setDesktopBackground.disabled = false; - - document.getElementById("showDesktopPreferences").hidden = true; -#endif + if (AppConstants.platform != "macosx") { + this._initColor(); + } else { + // Make sure to reset the button state in case the user has already + // set an image as their desktop background. + var setDesktopBackground = document.getElementById("setDesktopBackground"); + setDesktopBackground.hidden = false; + var bundle = document.getElementById("backgroundBundle"); + setDesktopBackground.label = bundle.getString("DesktopBackgroundSet"); + setDesktopBackground.disabled = false; + + document.getElementById("showDesktopPreferences").hidden = true; + } this.updatePosition(); }, -#ifndef XP_MACOSX - _initColor: function () - { - var color = this._shell.desktopBackgroundColor; - - const rMask = 4294901760; - const gMask = 65280; - const bMask = 255; - var r = (color & rMask) >> 16; - var g = (color & gMask) >> 8; - var b = (color & bMask); - this.updateColor(this._rgbToHex(r, g, b)); - - var colorpicker = document.getElementById("desktopColor"); - colorpicker.color = this._backgroundColor; - }, - - updateColor: function (aColor) - { - this._backgroundColor = aColor; - this._canvas.style.backgroundColor = aColor; - }, - - // Converts a color string in the format "#RRGGBB" to an integer. - _hexStringToLong: function (aString) - { - return parseInt(aString.substring(1,3), 16) << 16 | - parseInt(aString.substring(3,5), 16) << 8 | - parseInt(aString.substring(5,7), 16); - }, - - _rgbToHex: function (aR, aG, aB) - { - return "#" + [aR, aG, aB].map(function(aInt) aInt.toString(16).replace(/^(.)$/, "0$1")) - .join("").toUpperCase(); - }, -#else - observe: function (aSubject, aTopic, aData) + setDesktopBackground: function () { - if (aTopic == "shell:desktop-background-changed") { - document.getElementById("setDesktopBackground").hidden = true; - document.getElementById("showDesktopPreferences").hidden = false; - + if (AppConstants.platform != "macosx") { + document.persist("menuPosition", "value"); + this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor); + } else { Components.classes["@mozilla.org/observer-service;1"] .getService(Ci.nsIObserverService) - .removeObserver(this, "shell:desktop-background-changed"); - } - }, - - showDesktopPrefs: function() - { - this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP); - }, -#endif + .addObserver(this, "shell:desktop-background-changed", false); - setDesktopBackground: function () - { -#ifndef XP_MACOSX - document.persist("menuPosition", "value"); - this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor); -#else - Components.classes["@mozilla.org/observer-service;1"] - .getService(Ci.nsIObserverService) - .addObserver(this, "shell:desktop-background-changed", false); - - var bundle = document.getElementById("backgroundBundle"); - var setDesktopBackground = document.getElementById("setDesktopBackground"); - setDesktopBackground.disabled = true; - setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading"); -#endif + var bundle = document.getElementById("backgroundBundle"); + var setDesktopBackground = document.getElementById("setDesktopBackground"); + setDesktopBackground.disabled = true; + setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading"); + } this._shell.setDesktopBackground(this._image, Ci.nsIShellService["BACKGROUND_" + this._position]); }, @@ -157,9 +100,9 @@ var gSetBackground = { var ctx = this._canvas.getContext("2d"); ctx.clearRect(0, 0, this._screenWidth, this._screenHeight); -#ifndef XP_MACOSX - this._position = document.getElementById("menuPosition").value; -#endif + if (AppConstants.platform != "macosx") { + this._position = document.getElementById("menuPosition").value; + } switch (this._position) { case "TILE": @@ -171,43 +114,101 @@ var gSetBackground = { case "STRETCH": ctx.drawImage(this._image, 0, 0, this._screenWidth, this._screenHeight); break; - case "CENTER": - var x = (this._screenWidth - this._image.naturalWidth) / 2; - var y = (this._screenHeight - this._image.naturalHeight) / 2; + case "CENTER": { + let x = (this._screenWidth - this._image.naturalWidth) / 2; + let y = (this._screenHeight - this._image.naturalHeight) / 2; ctx.drawImage(this._image, x, y); break; - case "FILL": - //Try maxing width first, overflow height - var widthRatio = this._screenWidth / this._image.naturalWidth; - var width = this._image.naturalWidth * widthRatio; - var height = this._image.naturalHeight * widthRatio; + } + case "FILL": { + // Try maxing width first, overflow height. + let widthRatio = this._screenWidth / this._image.naturalWidth; + let width = this._image.naturalWidth * widthRatio; + let height = this._image.naturalHeight * widthRatio; if (height < this._screenHeight) { - //height less than screen, max height and overflow width - var heightRatio = this._screenHeight / this._image.naturalHeight; + // Height less than screen, max height and overflow width. + let heightRatio = this._screenHeight / this._image.naturalHeight; width = this._image.naturalWidth * heightRatio; height = this._image.naturalHeight * heightRatio; } - var x = (this._screenWidth - width) / 2; - var y = (this._screenHeight - height) / 2; + let x = (this._screenWidth - width) / 2; + let y = (this._screenHeight - height) / 2; ctx.drawImage(this._image, x, y, width, height); break; - case "FIT": - //Try maxing width first, top and bottom borders - var widthRatio = this._screenWidth / this._image.naturalWidth; - var width = this._image.naturalWidth * widthRatio; - var height = this._image.naturalHeight * widthRatio; - var x = 0; - var y = (this._screenHeight - height) / 2; + } + case "FIT": { + // Try maxing width first, top and bottom borders. + let widthRatio = this._screenWidth / this._image.naturalWidth; + let width = this._image.naturalWidth * widthRatio; + let height = this._image.naturalHeight * widthRatio; + let x = 0; + let y = (this._screenHeight - height) / 2; if (height > this._screenHeight) { - //height overflow, maximise height, side borders - var heightRatio = this._screenHeight / this._image.naturalHeight; + // Height overflow, maximise height, side borders. + let heightRatio = this._screenHeight / this._image.naturalHeight; width = this._image.naturalWidth * heightRatio; height = this._image.naturalHeight * heightRatio; x = (this._screenWidth - width) / 2; y = 0; } ctx.drawImage(this._image, x, y, width, height); - break; + break; + } } } }; + +if (AppConstants.platform != "macosx") { + gSetBackground["_initColor"] = function () + { + var color = this._shell.desktopBackgroundColor; + + const rMask = 4294901760; + const gMask = 65280; + const bMask = 255; + var r = (color & rMask) >> 16; + var g = (color & gMask) >> 8; + var b = (color & bMask); + this.updateColor(this._rgbToHex(r, g, b)); + + var colorpicker = document.getElementById("desktopColor"); + colorpicker.color = this._backgroundColor; + }; + + gSetBackground["updateColor"] = function (aColor) + { + this._backgroundColor = aColor; + this._canvas.style.backgroundColor = aColor; + }; + + // Converts a color string in the format "#RRGGBB" to an integer. + gSetBackground["_hexStringToLong"] = function (aString) + { + return parseInt(aString.substring(1, 3), 16) << 16 | + parseInt(aString.substring(3, 5), 16) << 8 | + parseInt(aString.substring(5, 7), 16); + }; + + gSetBackground["_rgbToHex"] = function (aR, aG, aB) + { + return "#" + [aR, aG, aB].map(aInt => aInt.toString(16).replace(/^(.)$/, "0$1")) + .join("").toUpperCase(); + }; +} else { + gSetBackground["observe"] = function (aSubject, aTopic, aData) + { + if (aTopic == "shell:desktop-background-changed") { + document.getElementById("setDesktopBackground").hidden = true; + document.getElementById("showDesktopPreferences").hidden = false; + + Components.classes["@mozilla.org/observer-service;1"] + .getService(Ci.nsIObserverService) + .removeObserver(this, "shell:desktop-background-changed"); + } + }; + + gSetBackground["showDesktopPrefs"] = function() + { + this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP); + }; +} diff --git a/application/palemoon/components/shell/jar.mn b/application/palemoon/components/shell/jar.mn index eed15c397..1f33b5d56 100644 --- a/application/palemoon/components/shell/jar.mn +++ b/application/palemoon/components/shell/jar.mn @@ -4,4 +4,4 @@ browser.jar: * content/browser/setDesktopBackground.xul (content/setDesktopBackground.xul) -* content/browser/setDesktopBackground.js (content/setDesktopBackground.js) + content/browser/setDesktopBackground.js (content/setDesktopBackground.js) diff --git a/application/palemoon/components/shell/moz.build b/application/palemoon/components/shell/moz.build index 38965c5d7..94ec88571 100644 --- a/application/palemoon/components/shell/moz.build +++ b/application/palemoon/components/shell/moz.build @@ -1,4 +1,4 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- # vim: set filetype=python: # 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 @@ -18,6 +18,10 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': XPIDL_SOURCES += [ 'nsIMacShellService.idl', ] +elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: + XPIDL_SOURCES += [ + 'nsIGNOMEShellService.idl', + ] XPIDL_MODULE = 'shellservice' @@ -29,7 +33,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': SOURCES += [ 'nsMacShellService.cpp', ] -elif CONFIG['MOZ_WIDGET_GTK']: +elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: SOURCES += [ 'nsGNOMEShellService.cpp', ] @@ -42,6 +46,10 @@ EXTRA_COMPONENTS += [ 'nsSetDefaultBrowser.manifest', ] +EXTRA_JS_MODULES += [ + 'ShellService.jsm', +] + for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'): DEFINES[var] = '"%s"' % CONFIG[var] diff --git a/application/palemoon/components/shell/nsGNOMEShellService.cpp b/application/palemoon/components/shell/nsGNOMEShellService.cpp index 14510d111..9bc5f5913 100644 --- a/application/palemoon/components/shell/nsGNOMEShellService.cpp +++ b/application/palemoon/components/shell/nsGNOMEShellService.cpp @@ -21,12 +21,13 @@ #include "nsIStringBundle.h" #include "nsIOutputStream.h" #include "nsIProcess.h" -#include "nsNetUtil.h" +#include "nsServiceManagerUtils.h" +#include "nsComponentManagerUtils.h" #include "nsIDOMHTMLImageElement.h" #include "nsIImageLoadingContent.h" #include "imgIRequest.h" #include "imgIContainer.h" -#include "prprf.h" +#include "mozilla/Sprintf.h" #if defined(MOZ_WIDGET_GTK) #include "nsIImageToPixbuf.h" #endif @@ -116,7 +117,7 @@ nsGNOMEShellService::Init() return appPath->GetNativePath(mAppPath); } -NS_IMPL_ISUPPORTS(nsGNOMEShellService, nsIShellService) +NS_IMPL_ISUPPORTS(nsGNOMEShellService, nsIGNOMEShellService, nsIShellService) bool nsGNOMEShellService::GetAppPathFromLauncher() @@ -152,7 +153,8 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const gchar *commandPath; if (mUseLocaleFilenames) { - gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, nullptr, nullptr, nullptr); + gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, + nullptr, nullptr, nullptr); if (!nativePath) { NS_ERROR("Error converting path to filesystem encoding"); return false; @@ -199,8 +201,6 @@ nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck, bool* aIsDefaultBrowser) { *aIsDefaultBrowser = false; - if (aStartupCheck) - mCheckedThisSession = true; nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); @@ -284,7 +284,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes, NS_ENSURE_SUCCESS(rv, rv); nsString brandShortName; - brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"), + brandBundle->GetStringFromName(u"brandShortName", getter_Copies(brandShortName)); // use brandShortName as the application id. @@ -312,41 +312,14 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes, } } - return NS_OK; -} - -NS_IMETHODIMP -nsGNOMEShellService::GetShouldCheckDefaultBrowser(bool* aResult) -{ - // If we've already checked, the browser has been started and this is a - // new window open, and we don't want to check again. - if (mCheckedThisSession) { - *aResult = false; - return NS_OK; + nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + (void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true); + // Reset the number of times the dialog should be shown + // before it is silenced. + (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0); } - nsCOMPtr<nsIPrefBranch> prefs; - nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (pserve) - pserve->GetBranch("", getter_AddRefs(prefs)); - - if (prefs) - prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult); - - return NS_OK; -} - -NS_IMETHODIMP -nsGNOMEShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck) -{ - nsCOMPtr<nsIPrefBranch> prefs; - nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (pserve) - pserve->GetBranch("", getter_AddRefs(prefs)); - - if (prefs) - prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck); - return NS_OK; } @@ -386,7 +359,7 @@ WriteImage(const nsCString& aPath, imgIContainer* aImage) return res ? NS_OK : NS_ERROR_FAILURE; #endif } - + NS_IMETHODIMP nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, int32_t aPosition) @@ -407,15 +380,15 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, // Set desktop wallpaper filling style nsAutoCString options; if (aPosition == BACKGROUND_TILE) - options.Assign("wallpaper"); + options.AssignLiteral("wallpaper"); else if (aPosition == BACKGROUND_STRETCH) - options.Assign("stretched"); + options.AssignLiteral("stretched"); else if (aPosition == BACKGROUND_FILL) - options.Assign("zoom"); + options.AssignLiteral("zoom"); else if (aPosition == BACKGROUND_FIT) - options.Assign("scaled"); + options.AssignLiteral("scaled"); else - options.Assign("centered"); + options.AssignLiteral("centered"); // Write the background file to the home directory. nsAutoCString filePath(PR_GetEnv("HOME")); @@ -429,7 +402,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle)); if (NS_SUCCEEDED(rv) && brandBundle) { - rv = brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"), + rv = brandBundle->GetStringFromName(u"brandShortName", getter_Copies(brandName)); NS_ENSURE_SUCCESS(rv, rv); } @@ -438,7 +411,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, // build the file name filePath.Append('/'); filePath.Append(NS_ConvertUTF16toUTF8(brandName)); - filePath.Append("_wallpaper.png"); + filePath.AppendLiteral("_wallpaper.png"); // write the image to a file in the home dir rv = WriteImage(filePath, container); @@ -478,7 +451,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, // Set the image to an empty string first to force a refresh // (since we could be writing a new image on top of an existing - // Firefox_wallpaper.png and nautilus doesn't monitor the file for changes) + // PaleMoon_wallpaper.png and nautilus doesn't monitor the file for changes) gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), EmptyCString()); @@ -543,7 +516,7 @@ ColorToCString(uint32_t aColor, nsCString& aResult) uint16_t green = COLOR_8_TO_16_BIT((aColor >> 8) & 0xff); uint16_t blue = COLOR_8_TO_16_BIT(aColor & 0xff); - PR_snprintf(buf, 14, "#%04x%04x%04x", red, green, blue); + snprintf(buf, 14, "#%04x%04x%04x", red, green, blue); } NS_IMETHODIMP @@ -580,9 +553,9 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication) { nsAutoCString scheme; if (aApplication == APPLICATION_MAIL) - scheme.Assign("mailto"); + scheme.AssignLiteral("mailto"); else if (aApplication == APPLICATION_NEWS) - scheme.Assign("news"); + scheme.AssignLiteral("news"); else return NS_ERROR_NOT_AVAILABLE; diff --git a/application/palemoon/components/shell/nsGNOMEShellService.h b/application/palemoon/components/shell/nsGNOMEShellService.h index 36a4a0c42..a7b003802 100644 --- a/application/palemoon/components/shell/nsGNOMEShellService.h +++ b/application/palemoon/components/shell/nsGNOMEShellService.h @@ -6,28 +6,28 @@ #ifndef nsgnomeshellservice_h____ #define nsgnomeshellservice_h____ -#include "nsIShellService.h" +#include "nsIGNOMEShellService.h" #include "nsStringAPI.h" #include "mozilla/Attributes.h" -class nsGNOMEShellService final : public nsIShellService +class nsGNOMEShellService final : public nsIGNOMEShellService { public: - nsGNOMEShellService() : mCheckedThisSession(false), mAppIsInPath(false) { } + nsGNOMEShellService() : mAppIsInPath(false) { } NS_DECL_ISUPPORTS NS_DECL_NSISHELLSERVICE + NS_DECL_NSIGNOMESHELLSERVICE - nsresult Init() NS_HIDDEN; + nsresult Init(); private: ~nsGNOMEShellService() {} - NS_HIDDEN_(bool) KeyMatchesAppName(const char *aKeyValue) const; - NS_HIDDEN_(bool) CheckHandlerMatchesAppName(const nsACString& handler) const; + bool KeyMatchesAppName(const char *aKeyValue) const; + bool CheckHandlerMatchesAppName(const nsACString& handler) const; - NS_HIDDEN_(bool) GetAppPathFromLauncher(); - bool mCheckedThisSession; + bool GetAppPathFromLauncher(); bool mUseLocaleFilenames; nsCString mAppPath; bool mAppIsInPath; diff --git a/application/palemoon/components/shell/nsIGNOMEShellService.idl b/application/palemoon/components/shell/nsIGNOMEShellService.idl new file mode 100644 index 000000000..842ce5e8a --- /dev/null +++ b/application/palemoon/components/shell/nsIGNOMEShellService.idl @@ -0,0 +1,19 @@ +/* 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/. */ + +#include "nsIShellService.idl" + +[scriptable, uuid(2ce5c803-edcd-443d-98eb-ceba86d02d13)] +interface nsIGNOMEShellService : nsIShellService +{ + /** + * Used to determine whether or not to offer "Set as desktop background" + * functionality. Even if shell service is available it is not + * guaranteed that it is able to set the background for every desktop + * which is especially true for Linux with its many different desktop + * environments. + */ + readonly attribute boolean canSetDesktopBackground; +}; + diff --git a/application/palemoon/components/shell/nsIMacShellService.idl b/application/palemoon/components/shell/nsIMacShellService.idl index 3c2f42315..6a532bbd0 100644 --- a/application/palemoon/components/shell/nsIMacShellService.idl +++ b/application/palemoon/components/shell/nsIMacShellService.idl @@ -5,7 +5,7 @@ #include "nsIShellService.idl" -[scriptable, uuid(7f8ca08e-1df4-4735-86e9-50dedb48e5e8)] +[scriptable, uuid(387fdc80-0077-4b60-a0d9-d9e80a83ba64)] interface nsIMacShellService : nsIShellService { const long APPLICATION_KEYCHAIN_ACCESS = 2; diff --git a/application/palemoon/components/shell/nsIShellService.idl b/application/palemoon/components/shell/nsIShellService.idl index 4825741b3..3e7e94b00 100644 --- a/application/palemoon/components/shell/nsIShellService.idl +++ b/application/palemoon/components/shell/nsIShellService.idl @@ -8,7 +8,7 @@ interface nsIDOMElement; interface nsIFile; -[scriptable, uuid(99d2e9f1-3c86-40f7-81fd-3060c18489f0)] +[scriptable, uuid(2d1a95e4-5bd8-4eeb-b0a8-c1455fd2a357)] interface nsIShellService : nsISupports { /** @@ -39,23 +39,6 @@ interface nsIShellService : nsISupports void setDefaultBrowser(in boolean aClaimAllTypes, in boolean aForAllUsers); /** - * Used to determine whether or not to show a "Set Default Browser" - * query dialog. This attribute is true if the application is starting - * up and "browser.shell.checkDefaultBrowser" is true, otherwise it - * is false. - */ - attribute boolean shouldCheckDefaultBrowser; - - /** - * Used to determine whether or not to offer "Set as desktop background" - * functionality. Even if shell service is available it is not - * guaranteed that it is able to set the background for every desktop - * which is especially true for Linux with its many different desktop - * environments. - */ - readonly attribute boolean canSetDesktopBackground; - - /** * Flags for positioning/sizing of the Desktop Background image. */ const long BACKGROUND_TILE = 1; diff --git a/application/palemoon/components/shell/nsIWindowsShellService.idl b/application/palemoon/components/shell/nsIWindowsShellService.idl index 913eb4292..57ed37055 100644 --- a/application/palemoon/components/shell/nsIWindowsShellService.idl +++ b/application/palemoon/components/shell/nsIWindowsShellService.idl @@ -5,7 +5,7 @@ #include "nsIShellService.idl" -[scriptable, uuid(89b0a761-d9a0-4c39-ab83-d81566459a31)] +[scriptable, uuid(f8a26b94-49e5-4441-8fbc-315e0b4f22ef)] interface nsIWindowsShellService : nsIShellService { /** diff --git a/application/palemoon/components/shell/nsMacShellService.cpp b/application/palemoon/components/shell/nsMacShellService.cpp index 914b9ae65..d8d64039d 100644 --- a/application/palemoon/components/shell/nsMacShellService.cpp +++ b/application/palemoon/components/shell/nsMacShellService.cpp @@ -17,13 +17,13 @@ #include "nsIURL.h" #include "nsIWebBrowserPersist.h" #include "nsMacShellService.h" -#include "nsNetUtil.h" +#include "nsIProperties.h" +#include "nsServiceManagerUtils.h" #include "nsShellService.h" #include "nsStringAPI.h" #include "nsIDocShell.h" #include "nsILoadContext.h" - #include <CoreFoundation/CoreFoundation.h> #include <ApplicationServices/ApplicationServices.h> @@ -49,19 +49,14 @@ nsMacShellService::IsDefaultBrowser(bool aStartupCheck, return NS_ERROR_FAILURE; } - // Get the default http handler's bundle ID (or nullptr 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; ::CFRelease(defaultBrowserID); } - // If this is the first browser window, maintain internal state that we've - // checked this session (so that subsequent window opens don't show the - // default browser dialog). - if (aStartupCheck) - mCheckedThisSession = true; - return NS_OK; } @@ -90,47 +85,15 @@ nsMacShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) return NS_ERROR_FAILURE; } } - - return NS_OK; -} -NS_IMETHODIMP -nsMacShellService::GetShouldCheckDefaultBrowser(bool* aResult) -{ - // If we've already checked, the browser has been started and this is a - // new window open, and we don't want to check again. - if (mCheckedThisSession) { - *aResult = false; - return NS_OK; + nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + (void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true); + // Reset the number of times the dialog should be shown + // before it is silenced. + (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0); } - nsCOMPtr<nsIPrefBranch> prefs; - nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (pserve) - pserve->GetBranch("", getter_AddRefs(prefs)); - - prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult); - - return NS_OK; -} - -NS_IMETHODIMP -nsMacShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck) -{ - nsCOMPtr<nsIPrefBranch> prefs; - nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (pserve) - pserve->GetBranch("", getter_AddRefs(prefs)); - - prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck); - - return NS_OK; -} - -NS_IMETHODIMP -nsMacShellService::GetCanSetDesktopBackground(bool* aResult) -{ - *aResult = true; return NS_OK; } @@ -202,8 +165,10 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement, loadContext = do_QueryInterface(docShell); } - return wbp->SaveURI(imageURI, nullptr, docURI, content->OwnerDoc()->GetReferrerPolicy(), - nullptr, nullptr, mBackgroundFile, loadContext); + return wbp->SaveURI(imageURI, nullptr, + docURI, content->OwnerDoc()->GetReferrerPolicy(), + nullptr, nullptr, + mBackgroundFile, loadContext); } NS_IMETHODIMP @@ -269,7 +234,8 @@ nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress, OSStatus status; // Convert the path into a FSRef - status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, nullptr); + status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, + nullptr); if (status == noErr) { err = ::FSNewAlias(nil, &pictureRef, &aliasHandle); if (err == noErr && aliasHandle == nil) @@ -336,8 +302,8 @@ nsMacShellService::OpenApplication(int32_t aApplication) } break; case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS: - err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll, nullptr, - &appURL); + err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll, + nullptr, &appURL); break; case nsIMacShellService::APPLICATION_NETWORK: { @@ -349,8 +315,7 @@ nsMacShellService::OpenApplication(int32_t aApplication) if (!exists) return NS_ERROR_FILE_NOT_FOUND; return lf->Launch(); - } - break; + } case nsIMacShellService::APPLICATION_DESKTOP: { nsCOMPtr<nsIFile> lf; @@ -361,8 +326,7 @@ nsMacShellService::OpenApplication(int32_t aApplication) if (!exists) return NS_ERROR_FILE_NOT_FOUND; return lf->Launch(); - } - break; + } } if (appURL && err == noErr) { diff --git a/application/palemoon/components/shell/nsMacShellService.h b/application/palemoon/components/shell/nsMacShellService.h index 7ca1c71ac..db9527809 100644 --- a/application/palemoon/components/shell/nsMacShellService.h +++ b/application/palemoon/components/shell/nsMacShellService.h @@ -15,7 +15,7 @@ class nsMacShellService : public nsIMacShellService, public nsIWebProgressListener { public: - nsMacShellService() : mCheckedThisSession(false) {}; + nsMacShellService() {}; NS_DECL_ISUPPORTS NS_DECL_NSISHELLSERVICE @@ -27,8 +27,6 @@ protected: private: nsCOMPtr<nsIFile> mBackgroundFile; - - bool mCheckedThisSession; }; #endif // nsmacshellservice_h____ diff --git a/application/palemoon/components/shell/nsSetDefaultBrowser.js b/application/palemoon/components/shell/nsSetDefaultBrowser.js index d1d1e72cb..c7a78c538 100644 --- a/application/palemoon/components/shell/nsSetDefaultBrowser.js +++ b/application/palemoon/components/shell/nsSetDefaultBrowser.js @@ -2,13 +2,14 @@ * 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/. */ -/* - * -setDefaultBrowser commandline handler +/* + * --setDefaultBrowser commandline handler * Makes the current executable the "default browser". */ const Cc = Components.classes; const Ci = Components.interfaces; +Components.utils.import("resource:///modules/ShellService.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); function nsSetDefaultBrowser() {} @@ -16,13 +17,11 @@ function nsSetDefaultBrowser() {} nsSetDefaultBrowser.prototype = { handle: function nsSetDefault_handle(aCmdline) { if (aCmdline.handleFlag("setDefaultBrowser", false)) { - var shell = Cc["@mozilla.org/browser/shell-service;1"]. - getService(Ci.nsIShellService); - shell.setDefaultBrowser(true, true); + ShellService.setDefaultBrowser(true, true); } }, - helpInfo: " -setDefaultBrowser Set this app as the default browser.\n", + helpInfo: " --setDefaultBrowser Set this app as the default browser.\n", classID: Components.ID("{F57899D0-4E2C-4ac6-9E29-50C736103B0C}"), QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]), diff --git a/application/palemoon/components/shell/nsShellService.h b/application/palemoon/components/shell/nsShellService.h index d5fade37b..516a8423a 100644 --- a/application/palemoon/components/shell/nsShellService.h +++ b/application/palemoon/components/shell/nsShellService.h @@ -4,6 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #define PREF_CHECKDEFAULTBROWSER "browser.shell.checkDefaultBrowser" +#define PREF_SKIPDEFAULTBROWSERCHECK "browser.shell.skipDefaultBrowserCheck" +#define PREF_DEFAULTBROWSERCHECKCOUNT "browser.shell.defaultBrowserCheckCount" #define SHELLSERVICE_PROPERTIES "chrome://browser/locale/shellservice.properties" #define BRAND_PROPERTIES "chrome://branding/locale/brand.properties" diff --git a/application/palemoon/components/shell/nsWindowsShellService.cpp b/application/palemoon/components/shell/nsWindowsShellService.cpp index 813ec4fe1..c4039b95a 100644 --- a/application/palemoon/components/shell/nsWindowsShellService.cpp +++ b/application/palemoon/components/shell/nsWindowsShellService.cpp @@ -3,6 +3,8 @@ * 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 "nsWindowsShellService.h" + #include "imgIContainer.h" #include "imgIRequest.h" #include "mozilla/gfx/2D.h" @@ -15,8 +17,8 @@ #include "nsIServiceManager.h" #include "nsIStringBundle.h" #include "nsNetUtil.h" +#include "nsServiceManagerUtils.h" #include "nsShellService.h" -#include "nsWindowsShellService.h" #include "nsIProcess.h" #include "nsICategoryManager.h" #include "nsBrowserCompsCID.h" @@ -27,6 +29,7 @@ #include "nsUnicharUtils.h" #include "nsIWinTaskbar.h" #include "nsISupportsPrimitives.h" +#include "nsIURLFormatter.h" #include "nsThreadUtils.h" #include "nsXULAppAPI.h" #include "mozilla/WindowsVersion.h" @@ -47,6 +50,9 @@ #include <mbstring.h> #include <shlwapi.h> +#include <lm.h> +#undef ACCESS_READ + #ifndef MAX_BUF #define MAX_BUF 4096 #endif @@ -129,7 +135,7 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey) // The following keys are set to make PaleMoon appear in the Start Menu as the // browser: // -// HKCU\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\ +// HKCU\SOFTWARE\Clients\StartMenuInternet\PaleMoon.EXE\ // (default) REG_SZ <appname> // DefaultIcon (default) REG_SZ <apppath>,0 // InstallInfo HideIconsCommand REG_SZ <uninstpath> /HideShortcuts @@ -278,20 +284,15 @@ nsWindowsShellService::ShortcutMaintenance() return NS_ERROR_UNEXPECTED; NS_NAMED_LITERAL_CSTRING(prefName, "browser.taskbar.lastgroupid"); - nsCOMPtr<nsIPrefService> prefs = + nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); if (!prefs) return NS_ERROR_UNEXPECTED; - nsCOMPtr<nsIPrefBranch> prefBranch; - prefs->GetBranch(nullptr, getter_AddRefs(prefBranch)); - if (!prefBranch) - return NS_ERROR_UNEXPECTED; - nsCOMPtr<nsISupportsString> prefString; - rv = prefBranch->GetComplexValue(prefName.get(), - NS_GET_IID(nsISupportsString), - getter_AddRefs(prefString)); + rv = prefs->GetComplexValue(prefName.get(), + NS_GET_IID(nsISupportsString), + getter_AddRefs(prefString)); if (NS_SUCCEEDED(rv)) { nsAutoString version; prefString->GetData(version); @@ -307,9 +308,9 @@ nsWindowsShellService::ShortcutMaintenance() return rv; prefString->SetData(appId); - rv = prefBranch->SetComplexValue(prefName.get(), - NS_GET_IID(nsISupportsString), - prefString); + rv = prefs->SetComplexValue(prefName.get(), + NS_GET_IID(nsISupportsString), + prefString); if (NS_FAILED(rv)) { NS_WARNING("Couldn't set last user model id!"); return NS_ERROR_UNEXPECTED; @@ -325,38 +326,47 @@ nsWindowsShellService::ShortcutMaintenance() } static bool -IsAARDefaultHTTP(IApplicationAssociationRegistration* pAAR, - bool* aIsDefaultBrowser) +IsAARDefault(const RefPtr<IApplicationAssociationRegistration>& pAAR, + LPCWSTR aClassName) { // Make sure the Prog ID matches what we have LPWSTR registeredApp; - HRESULT hr = pAAR->QueryCurrentDefault(L"http", AT_URLPROTOCOL, AL_EFFECTIVE, + bool isProtocol = *aClassName != L'.'; + ASSOCIATIONTYPE queryType = isProtocol ? AT_URLPROTOCOL : AT_FILEEXTENSION; + HRESULT hr = pAAR->QueryCurrentDefault(aClassName, queryType, AL_EFFECTIVE, ®isteredApp); - if (SUCCEEDED(hr)) { - LPCWSTR firefoxHTTPProgID = L"PaleMoonURL"; - *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTTPProgID); - CoTaskMemFree(registeredApp); - } else { - *aIsDefaultBrowser = false; + if (FAILED(hr)) { + return false; } - return SUCCEEDED(hr); + + LPCWSTR progID = isProtocol ? L"PaleMoonURL" : L"PaleMoonHTML"; + bool isDefault = !wcsicmp(registeredApp, progID); + CoTaskMemFree(registeredApp); + + return isDefault; } -static bool -IsAARDefaultHTML(IApplicationAssociationRegistration* pAAR, - bool* aIsDefaultBrowser) +static void +IsDefaultBrowserWin8(bool aCheckAllTypes, bool* aIsDefaultBrowser) { - LPWSTR registeredApp; - HRESULT hr = pAAR->QueryCurrentDefault(L".html", AT_FILEEXTENSION, AL_EFFECTIVE, - ®isteredApp); - if (SUCCEEDED(hr)) { - LPCWSTR firefoxHTMLProgID = L"PaleMoonHTML"; - *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTMLProgID); - CoTaskMemFree(registeredApp); - } else { - *aIsDefaultBrowser = false; + RefPtr<IApplicationAssociationRegistration> pAAR; + HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, + nullptr, + CLSCTX_INPROC, + IID_IApplicationAssociationRegistration, + getter_AddRefs(pAAR)); + if (FAILED(hr)) { + return; + } + + bool res = IsAARDefault(pAAR, L"http"); + if (*aIsDefaultBrowser) { + *aIsDefaultBrowser = res; + } + res = IsAARDefault(pAAR, L".html"); + if (*aIsDefaultBrowser && aCheckAllTypes) { + *aIsDefaultBrowser = res; } - return SUCCEEDED(hr); } /* @@ -369,37 +379,27 @@ bool nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes, bool* aIsDefaultBrowser) { - IApplicationAssociationRegistration* pAAR; + RefPtr<IApplicationAssociationRegistration> pAAR; HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, nullptr, CLSCTX_INPROC, IID_IApplicationAssociationRegistration, - (void**)&pAAR); - - if (SUCCEEDED(hr)) { - if (aCheckAllTypes) { - BOOL res; - hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE, - APP_REG_NAME, - &res); - *aIsDefaultBrowser = res; - - // If we have all defaults, let's make sure that our ProgID - // is explicitly returned as well. Needed only for Windows 8. - if (*aIsDefaultBrowser && IsWin8OrLater()) { - IsAARDefaultHTTP(pAAR, aIsDefaultBrowser); - if (*aIsDefaultBrowser) { - IsAARDefaultHTML(pAAR, aIsDefaultBrowser); - } - } - } else { - IsAARDefaultHTTP(pAAR, aIsDefaultBrowser); - } + getter_AddRefs(pAAR)); + if (FAILED(hr)) { + return false; + } - pAAR->Release(); - return true; + if (aCheckAllTypes) { + BOOL res; + hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE, + APP_REG_NAME, + &res); + *aIsDefaultBrowser = res; + } else if (!IsWin8OrLater()) { + *aIsDefaultBrowser = IsAARDefault(pAAR, L"http"); } - return false; + + return true; } NS_IMETHODIMP @@ -407,12 +407,6 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes, bool* aIsDefaultBrowser) { - // If this is the first browser window, maintain internal state that we've - // checked this session (so that subsequent window opens don't show the - // default browser dialog). - if (aStartupCheck) - mCheckedThisSession = true; - // Assume we're the default unless one of the several checks below tell us // otherwise. *aIsDefaultBrowser = true; @@ -499,6 +493,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, // previous checks show that PaleMoon is the default browser. if (*aIsDefaultBrowser) { IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser); + if (IsWin8OrLater()) { + IsDefaultBrowserWin8(aForAllTypes, aIsDefaultBrowser); + } } // To handle the case where DDE isn't disabled due for a user because there @@ -603,13 +600,6 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_OK; } -NS_IMETHODIMP -nsWindowsShellService::GetCanSetDesktopBackground(bool* aResult) -{ - *aResult = true; - return NS_OK; -} - static nsresult DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo) { @@ -628,14 +618,34 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo) return NS_ERROR_FAILURE; } - nsresult rv = - SUCCEEDED(SHOpenWithDialogFn(hwndParent, poainfo)) ? NS_OK : - NS_ERROR_FAILURE; + nsresult rv; + HRESULT hr = SHOpenWithDialogFn(hwndParent, poainfo); + if (SUCCEEDED(hr) || (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))) { + rv = NS_OK; + } else { + rv = NS_ERROR_FAILURE; + } FreeLibrary(shellDLL); return rv; } nsresult +nsWindowsShellService::LaunchControlPanelDefaultsSelectionUI() +{ + IApplicationAssociationRegistrationUI* pAARUI; + HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI, + NULL, + CLSCTX_INPROC, + IID_IApplicationAssociationRegistrationUI, + (void**)&pAARUI); + if (SUCCEEDED(hr)) { + hr = pAARUI->LaunchAdvancedAssociationUI(APP_REG_NAME); + pAARUI->Release(); + } + return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE; +} + +nsresult nsWindowsShellService::LaunchControlPanelDefaultPrograms() { // Build the path control.exe path safely @@ -651,7 +661,8 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms() return NS_ERROR_FAILURE; } - WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram"; + WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page " + "pageDefaultProgram\\pageAdvancedSettings?pszAppName=" APP_REG_NAME; STARTUPINFOW si = {sizeof(si), 0}; si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOWDEFAULT; @@ -666,9 +677,62 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms() return NS_OK; } +static bool +IsWindowsLogonConnected() +{ + WCHAR userName[UNLEN + 1]; + DWORD size = ArrayLength(userName); + if (!GetUserNameW(userName, &size)) { + return false; + } + + LPUSER_INFO_24 info; + if (NetUserGetInfo(nullptr, userName, 24, (LPBYTE *)&info) + != NERR_Success) { + return false; + } + bool connected = info->usri24_internet_identity; + NetApiBufferFree(info); + + return connected; +} + +static bool +SettingsAppBelievesConnected() +{ + nsresult rv; + nsCOMPtr<nsIWindowsRegKey> regKey = + do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv); + if (NS_FAILED(rv)) { + return false; + } + + rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, + NS_LITERAL_STRING("SOFTWARE\\Microsoft\\Windows\\Shell\\Associations"), + nsIWindowsRegKey::ACCESS_READ); + if (NS_FAILED(rv)) { + return false; + } + + uint32_t value; + rv = regKey->ReadIntValue(NS_LITERAL_STRING("IsConnectedAtLogon"), &value); + if (NS_FAILED(rv)) { + return false; + } + + return !!value; +} + nsresult nsWindowsShellService::LaunchModernSettingsDialogDefaultApps() { + if (!IsWindowsBuildOrLater(14965) && + !IsWindowsLogonConnected() && SettingsAppBelievesConnected()) { + // Use the classic Control Panel to work around a bug of older + // builds of Windows 10. + return LaunchControlPanelDefaultPrograms(); + } + IApplicationActivationManager* pActivator; HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager, nullptr, @@ -682,6 +746,15 @@ nsWindowsShellService::LaunchModernSettingsDialogDefaultApps() L"windows.immersivecontrolpanel_cw5n1h2txyewy" L"!microsoft.windows.immersivecontrolpanel", L"page=SettingsPageAppsDefaults", AO_NONE, &pid); + if (SUCCEEDED(hr)) { + // Do not check error because we could at least open + // the "Default apps" setting. + pActivator->ActivateApplication( + L"windows.immersivecontrolpanel_cw5n1h2txyewy" + L"!microsoft.windows.immersivecontrolpanel", + L"page=SettingsPageAppsDefaults" + L"&target=SystemSettings_DefaultApps_Browser", AO_NONE, &pid); + } pActivator->Release(); return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE; } @@ -689,6 +762,36 @@ nsWindowsShellService::LaunchModernSettingsDialogDefaultApps() } nsresult +nsWindowsShellService::InvokeHTTPOpenAsVerb() +{ + nsCOMPtr<nsIURLFormatter> formatter( + do_GetService("@mozilla.org/toolkit/URLFormatterService;1")); + if (!formatter) { + return NS_ERROR_UNEXPECTED; + } + + nsString urlStr; + nsresult rv = formatter->FormatURLPref( + NS_LITERAL_STRING("app.support.baseURL"), urlStr); + if (NS_FAILED(rv)) { + return rv; + } + if (!StringBeginsWith(urlStr, NS_LITERAL_STRING("https://"))) { + return NS_ERROR_FAILURE; + } + urlStr.AppendLiteral("win10-default-browser"); + + SHELLEXECUTEINFOW seinfo = { sizeof(SHELLEXECUTEINFOW) }; + seinfo.lpVerb = L"openas"; + seinfo.lpFile = urlStr.get(); + seinfo.nShow = SW_SHOWNORMAL; + if (!ShellExecuteExW(&seinfo)) { + return NS_ERROR_FAILURE; + } + return NS_OK; +} + +nsresult nsWindowsShellService::LaunchHTTPHandlerPane() { OPENASINFO info; @@ -716,16 +819,23 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) nsresult rv = LaunchHelper(appHelperPath); if (NS_SUCCEEDED(rv) && IsWin8OrLater()) { if (aClaimAllTypes) { - rv = LaunchControlPanelDefaultPrograms(); + if (IsWin10OrLater()) { + rv = LaunchModernSettingsDialogDefaultApps(); + } else { + rv = LaunchControlPanelDefaultsSelectionUI(); + } // The above call should never really fail, but just in case // fall back to showing the HTTP association screen only. if (NS_FAILED(rv)) { - rv = LaunchHTTPHandlerPane(); + if (IsWin10OrLater()) { + rv = InvokeHTTPOpenAsVerb(); + } else { + rv = LaunchHTTPHandlerPane(); + } } } else { - // Windows 10 blocks attempts to load the HTTP Handler - // association dialog, so the modern Settings dialog - // is opened with the Default Apps view loaded. + // Windows 10 blocks attempts to load the + // HTTP Handler association dialog. if (IsWin10OrLater()) { rv = LaunchModernSettingsDialogDefaultApps(); } else { @@ -735,50 +845,20 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) // The above call should never really fail, but just in case // fall back to showing control panel for all defaults if (NS_FAILED(rv)) { - rv = LaunchControlPanelDefaultPrograms(); + rv = LaunchControlPanelDefaultsSelectionUI(); } } } - return rv; -} - -NS_IMETHODIMP -nsWindowsShellService::GetShouldCheckDefaultBrowser(bool* aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - // If we've already checked, the browser has been started and this is a - // new window open, and we don't want to check again. - if (mCheckedThisSession) { - *aResult = false; - return NS_OK; + nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + (void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true); + // Reset the number of times the dialog should be shown + // before it is silenced. + (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0); } - nsCOMPtr<nsIPrefBranch> prefs; - nsresult rv; - nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = pserve->GetBranch("", getter_AddRefs(prefs)); - NS_ENSURE_SUCCESS(rv, rv); - - return prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult); -} - -NS_IMETHODIMP -nsWindowsShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck) -{ - nsCOMPtr<nsIPrefBranch> prefs; - nsresult rv; - - nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = pserve->GetBranch("", getter_AddRefs(prefs)); - NS_ENSURE_SUCCESS(rv, rv); - - return prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck); + return rv; } static nsresult @@ -912,7 +992,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement, // e.g. "Desktop Background.bmp" nsString fileLeafName; rv = shellBundle->GetStringFromName - (MOZ_UTF16("desktopBackgroundLeafNameWin"), + (u"desktopBackgroundLeafNameWin", getter_Copies(fileLeafName)); NS_ENSURE_SUCCESS(rv, rv); @@ -948,24 +1028,24 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement, nsAutoString style; switch (aPosition) { case BACKGROUND_TILE: - style.AssignLiteral("0"); - tile.AssignLiteral("1"); + style.Assign('0'); + tile.Assign('1'); break; case BACKGROUND_CENTER: - style.AssignLiteral("0"); - tile.AssignLiteral("0"); + style.Assign('0'); + tile.Assign('0'); break; case BACKGROUND_STRETCH: - style.AssignLiteral("2"); - tile.AssignLiteral("0"); + style.Assign('2'); + tile.Assign('0'); break; case BACKGROUND_FILL: style.AssignLiteral("10"); - tile.AssignLiteral("0"); + tile.Assign('0'); break; case BACKGROUND_FIT: - style.AssignLiteral("6"); - tile.AssignLiteral("0"); + style.Assign('6'); + tile.Assign('0'); break; } @@ -1023,7 +1103,7 @@ nsWindowsShellService::OpenApplication(int32_t aApplication) ::RegCloseKey(theKey); // Find the "open" command - application.AppendLiteral("\\"); + application.Append('\\'); application.Append(buf); application.AppendLiteral("\\shell\\open\\command"); @@ -1122,8 +1202,7 @@ nsWindowsShellService::SetDesktopBackgroundColor(uint32_t aColor) return regKey->Close(); } -nsWindowsShellService::nsWindowsShellService() : - mCheckedThisSession(false) +nsWindowsShellService::nsWindowsShellService() { } diff --git a/application/palemoon/components/shell/nsWindowsShellService.h b/application/palemoon/components/shell/nsWindowsShellService.h index f856ffd35..06c6c3c9b 100644 --- a/application/palemoon/components/shell/nsWindowsShellService.h +++ b/application/palemoon/components/shell/nsWindowsShellService.h @@ -16,9 +16,10 @@ class nsWindowsShellService : public nsIWindowsShellService { + virtual ~nsWindowsShellService(); + public: nsWindowsShellService(); - virtual ~nsWindowsShellService(); NS_DECL_ISUPPORTS NS_DECL_NSISHELLSERVICE @@ -26,12 +27,11 @@ public: protected: bool IsDefaultBrowserVista(bool aCheckAllTypes, bool* aIsDefaultBrowser); + nsresult LaunchControlPanelDefaultsSelectionUI(); nsresult LaunchControlPanelDefaultPrograms(); nsresult LaunchModernSettingsDialogDefaultApps(); + nsresult InvokeHTTPOpenAsVerb(); nsresult LaunchHTTPHandlerPane(); - -private: - bool mCheckedThisSession; }; #endif // nswindowsshellservice_h____ diff --git a/application/palemoon/config/version.txt b/application/palemoon/config/version.txt index 1d43844fa..b117d70fa 100644 --- a/application/palemoon/config/version.txt +++ b/application/palemoon/config/version.txt @@ -1 +1 @@ -27.9.0a1
\ No newline at end of file +28.0.0a1
\ No newline at end of file diff --git a/application/palemoon/configure.in b/application/palemoon/configure.in index 379c4e515..df5fb98a1 100644 --- a/application/palemoon/configure.in +++ b/application/palemoon/configure.in @@ -5,6 +5,11 @@ dnl License, v. 2.0. If a copy of the MPL was not distributed with this dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. dnl Things we need to carry from confvars.sh +AC_DEFINE(MOZ_PHOENIX) +AC_SUBST(MOZ_PHOENIX) + +AC_DEFINE(MC_PALEMOON) +AC_SUBST(MC_PALEMOON) dnl Optional parts of the build. diff --git a/application/palemoon/confvars.sh b/application/palemoon/confvars.sh index 7466d0c3c..8a1d00c68 100644 --- a/application/palemoon/confvars.sh +++ b/application/palemoon/confvars.sh @@ -3,58 +3,103 @@ # 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/. -MOZ_APP_BASENAME=Palemoon +# Application Basename and Vendor +# MOZ_APP_BASENAME and MOZ_APP_VENDOR must not have spaces. +# These values where appropriate are hardcoded in application.ini +# to "Pale Moon" and "Moonchild Productions" respectively for +# Pale Moon +MOZ_APP_BASENAME=Palemoon MOZ_APP_VENDOR=Moonchild -MOZ_UPDATER=1 + +# Application Version +# MOZ_APP_VERSION is read from ./config/version.txt +# MOZ_APP_VERSION_DISPLAY is not used in Pale Moon so set it +# to MOZ_APP_VERSION +MOZ_APP_VERSION=`cat ${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt` +MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION + +# Application ID +# This is a unique identifier used for the application +# Most frequently the AppID is used for targetApplication +# in extensions and for chrome manifests +MOZ_APP_ID={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} + +# Use static Application INI File +MOZ_APP_STATIC_INI=1 + +# Application Branding +# The default is MOZ_BRANDING_DIRECTORY and should never point to +# official branding by default. +# Changing MOZ_*BRANDING_DIRECTORY requires a clobber because branding +# dependencies are broken. +# MOZ_APP_DISPLAYNAME will be set by [branding]/configure.sh +MOZ_BRANDING_DIRECTORY=$MOZ_BUILD_APP/branding/unofficial +MOZ_OFFICIAL_BRANDING_DIRECTORY=$MOZ_BUILD_APP/branding/official + +# Enables conditional code in the platform for Pale Moon only +MC_PALEMOON=1 + +# Enables conditional code in the platform for historically +# Firefox-like browsers MOZ_PHOENIX=1 -if test "$OS_TARGET" = "WINNT"; then - MOZ_BUNDLED_FONTS=1 -fi +# Browser Feature: Status bar Component +MOZ_BROWSER_STATUSBAR=1 -MOZ_CHROME_FILE_FORMAT=omni +# Browser Feature: Profile Migration Component +MOZ_PROFILE_MIGRATOR=1 + +# Platform Feature: Application Update Service +# MAR_CHANNEL_ID must not contained the follow 3 characters: ",\t" +# ACCEPTED_MAR_CHANNEL_IDS should usually be the same as MAR_CHANNEL_ID +# If more than one ID is needed, then you should use a comma seperated list. +MOZ_UPDATER=1 +MAR_CHANNEL_ID=palemoon-release +ACCEPTED_MAR_CHANNEL_IDS=palemoon-release + +# Platform Feature: Developer Tools +# XXX: Devtools are disabled until they can be made to work with Pale Moon +MOZ_DEVTOOLS=1 + +# Platform Feature: "Phoenix" Extensions Support aka Dual-guid system. +# Allows installation of Firefox GUID targeted extensions despite having +# a different Application ID +# On UXP this is a possible feature only for the Tycho Add-ons Manager +MOZ_PHOENIX_EXTENSIONS=1 + +# Platform Feature: Sync Service MOZ_SERVICES_COMMON=1 -MOZ_MEDIA_NAVIGATOR=1 -MOZ_SERVICES_CRYPTO=1 MOZ_SERVICES_SYNC=1 -MOZ_APP_VERSION=`cat ${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt` -MOZ_EXTENSIONS_DEFAULT=" gio" -MOZ_SERVICES_FXACCOUNTS=1 -MOZ_DISABLE_EXPORT_JS=1 -MOZ_WEBGL_CONFORMANT=1 -MOZ_ACTIVITIES=1 +# Platform Feature: JS based Downloads Manager MOZ_JSDOWNLOADS=1 -MOZ_WEBM_ENCODER=1 -MOZ_PHOENIX_EXTENSIONS=1 -MOZ_BROWSER_STATUSBAR=1 +# Platform Feature: Conformant WebGL +# Exposes the "webgl" context name, which is reserved for +# conformant implementations. +MOZ_WEBGL_CONFORMANT=1 -#disabled by default on desktop. -MOZ_DEVTOOLS= - -# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh -# Changing MOZ_*BRANDING_DIRECTORY requires a clobber to ensure correct results, -# because branding dependencies are broken. -# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is -# specified. It should never point to the "official" branding directory. -# For mozilla-beta, mozilla-release, or mozilla-central repositories, use -# "nightly" branding (until bug 659568 is fixed). -# For the mozilla-aurora repository, use "aurora". -MOZ_BRANDING_DIRECTORY=browser/branding/unofficial -MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official -# New Pale Moon App GUID -# Firefox MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384} -MOZ_APP_ID={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} -# This should usually be the same as the value MAR_CHANNEL_ID. -# If more than one ID is needed, then you should use a comma separated list -# of values. -ACCEPTED_MAR_CHANNEL_IDS=palemoon-release -# The MAR_CHANNEL_ID must not contain the following 3 characters: ",\t " -MAR_CHANNEL_ID=palemoon-release -MOZ_PROFILE_MIGRATOR=1 -MOZ_EXTENSION_MANAGER=1 -MOZ_APP_STATIC_INI=1 +# Platform Feature: Windows Maintaince Service +# XXX: This is never used +if test "$OS_ARCH" = "WINNT"; then + MOZ_MAINTENANCE_SERVICE= +fi + +# Set the chrome packing format +# Possible values are omni, jar, and flat +# Currently, only omni and flat are supported +MOZ_CHROME_FILE_FORMAT=omni + +# Set the default top-level extensions +MOZ_EXTENSIONS_DEFAULT=" gio" + +# Fold Libs if test "$OS_TARGET" = "WINNT" -o "$OS_TARGET" = "Darwin"; then MOZ_FOLD_LIBS=1 fi + +# Include bundled fonts +if test "$OS_ARCH" = "WINNT" -o \ + "$OS_ARCH" = "Linux"; then + MOZ_BUNDLED_FONTS=1 +fi diff --git a/application/palemoon/fonts/EmojiOneMozilla.ttf b/application/palemoon/fonts/EmojiOneMozilla.ttf Binary files differdeleted file mode 100644 index 50356509d..000000000 --- a/application/palemoon/fonts/EmojiOneMozilla.ttf +++ /dev/null diff --git a/application/palemoon/fonts/README.txt b/application/palemoon/fonts/README.txt index 188ea3fff..bf5cb7e6e 100644 --- a/application/palemoon/fonts/README.txt +++ b/application/palemoon/fonts/README.txt @@ -1,9 +1,9 @@ -EmojiOne Mozilla +Twemoji Mozilla ================ -The upstream repository of EmojiOne Mozilla can be found at +The upstream repository of Twemoji Mozilla can be found at - https://github.com/mozilla/emojione-colr + https://github.com/mozilla/twemoji-colr Please refer commit history for the current version of the font. -This file purposely omit the version, so there is no need to update it here. +This file purposely omits the version, so there is no need to update it here. diff --git a/application/palemoon/fonts/TwemojiMozilla.ttf b/application/palemoon/fonts/TwemojiMozilla.ttf Binary files differnew file mode 100644 index 000000000..8139089f1 --- /dev/null +++ b/application/palemoon/fonts/TwemojiMozilla.ttf diff --git a/application/palemoon/fonts/moz.build b/application/palemoon/fonts/moz.build index 93d07120b..314d41bd0 100644 --- a/application/palemoon/fonts/moz.build +++ b/application/palemoon/fonts/moz.build @@ -7,5 +7,5 @@ if CONFIG['OS_ARCH'] in ('WINNT'): DIST_SUBDIR = '' FINAL_TARGET_FILES.fonts += [ - 'EmojiOneMozilla.ttf' + 'TwemojiMozilla.ttf' ] diff --git a/application/palemoon/installer/package-manifest.in b/application/palemoon/installer/package-manifest.in index a581ff469..ffe033596 100644 --- a/application/palemoon/installer/package-manifest.in +++ b/application/palemoon/installer/package-manifest.in @@ -282,7 +282,7 @@ @RESPATH@/components/jar.xpt @RESPATH@/components/jsdebugger.xpt @RESPATH@/components/jsdownloads.xpt -@RESPATH@/components/jsinspector.xpt +@RESPATH@/browser/components/jsinspector.xpt @RESPATH@/components/layout_base.xpt #ifdef NS_PRINTING @@ -322,7 +322,7 @@ @RESPATH@/components/plugin.xpt @RESPATH@/components/pref.xpt @RESPATH@/components/prefetch.xpt -@RESPATH@/components/profile.xpt +@RESPATH@/components/profiler.xpt @RESPATH@/components/rdf.xpt @RESPATH@/components/satchel.xpt @RESPATH@/components/saxparser.xpt @@ -421,8 +421,8 @@ @RESPATH@/components/jsconsole-clhandler.manifest @RESPATH@/components/jsconsole-clhandler.js #ifdef MOZ_DEVTOOLS -@RESPATH@/components/devtools-clhandler.manifest -@RESPATH@/components/devtools-clhandler.js +@RESPATH@/browser/components/devtools-startup.manifest +@RESPATH@/browser/components/devtools-startup.js #endif @RESPATH@/components/webvtt.xpt @RESPATH@/components/WebVTT.manifest @@ -677,6 +677,16 @@ @RESPATH@/browser/chrome/icons/default/default48.png #endif +; [Webide Files] +@RESPATH@/browser/chrome/webide@JAREXT@ +@RESPATH@/browser/chrome/webide.manifest +@RESPATH@/browser/@PREF_DIR@/webide-prefs.js + +; DevTools +@RESPATH@/browser/chrome/devtools@JAREXT@ +@RESPATH@/browser/chrome/devtools.manifest +@RESPATH@/browser/@PREF_DIR@/devtools.js + ; shell icons #ifdef XP_UNIX #ifndef XP_MACOSX diff --git a/application/palemoon/installer/windows/Makefile.in b/application/palemoon/installer/windows/Makefile.in index 127456765..600bdfeb6 100644 --- a/application/palemoon/installer/windows/Makefile.in +++ b/application/palemoon/installer/windows/Makefile.in @@ -5,9 +5,7 @@ include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk CONFIG_DIR = instgen -SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/firefox/7zSD.sfx -APP_VERSION := $(shell cat $(srcdir)/../../config/version.txt) -DEFINES += -DAPP_VERSION=$(APP_VERSION) +SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/uxp/7zSD.sfx INSTALLER_FILES = \ app.tag \ @@ -16,6 +14,12 @@ INSTALLER_FILES = \ nsis/shared.nsh \ $(NULL) +ifdef MOZ_MAINTENANCE_SERVICE +INSTALLER_FILES += \ + nsis/maintenanceservice_installer.nsi \ + $(NULL) +endif + BRANDING_FILES = \ branding.nsi \ appname.bmp \ @@ -24,13 +28,6 @@ BRANDING_FILES = \ wizWatermark.bmp \ $(NULL) -DEFINES += \ - -DAB_CD=$(AB_CD) \ - -DMOZ_APP_NAME=$(MOZ_APP_NAME) \ - -DMOZ_APP_DISPLAYNAME="${MOZ_APP_DISPLAYNAME}" \ - -DMOZILLA_VERSION=${MOZILLA_VERSION} \ - $(NULL) - include $(topsrcdir)/config/config.mk ifdef LOCALE_MERGEDIR @@ -61,6 +58,17 @@ uninstaller:: --preprocess-locale $(topsrcdir) \ $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR) +# For building the maintenanceservice installer +ifdef MOZ_MAINTENANCE_SERVICE +maintenanceservice_installer:: + $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR) + $(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ + $(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi) + $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \ + --preprocess-locale $(topsrcdir) \ + $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR) +endif + $(CONFIG_DIR)/setup.exe:: $(RM) -r $(CONFIG_DIR) $(MKDIR) $(CONFIG_DIR) diff --git a/application/palemoon/installer/windows/moz.build b/application/palemoon/installer/windows/moz.build index 895d11993..12e7831ed 100644 --- a/application/palemoon/installer/windows/moz.build +++ b/application/palemoon/installer/windows/moz.build @@ -1,6 +1,11 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- # vim: set filetype=python: # 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/. +DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] + +DEFINES['MOZ_APP_NAME'] = CONFIG['MOZ_APP_NAME'] +DEFINES['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME'] +DEFINES['MOZILLA_VERSION'] = CONFIG['MOZILLA_VERSION'] diff --git a/application/palemoon/installer/windows/nsis/defines.nsi.in b/application/palemoon/installer/windows/nsis/defines.nsi.in index ad171a5d6..97422c4f6 100644 --- a/application/palemoon/installer/windows/nsis/defines.nsi.in +++ b/application/palemoon/installer/windows/nsis/defines.nsi.in @@ -3,6 +3,23 @@ # 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/. +# Defining FunnelcakeVersion will append the value of StubURLVersionAppend to +# StubURLVersion, append the value of URLManualDownloadAppend to +# URLManualDownload, and append the value of URLStubDownloadAppend to +# URLStubDownload. The value of FunnelcakeVersion should not be defined when it +# is not used and when it is defined its value should never be empty. +# !define FunnelcakeVersion "999" + +!ifdef FunnelcakeVersion +!define URLManualDownloadAppend "&f=${FunnelcakeVersion}" +!define URLStubDownloadAppend "-f${FunnelcakeVersion}" +!define StubURLVersionAppend "-${FunnelcakeVersion}" +!else +!define URLManualDownloadAppend "" +!define URLStubDownloadAppend "" +!define StubURLVersionAppend "" +!endif + # These defines should match application.ini settings !define AppName "Pale Moon" !define AppVersion "@APP_VERSION@" @@ -14,13 +31,17 @@ !define DDEApplication "Pale Moon" !define AppRegName "Pale Moon" +!ifndef DEV_EDITION !define BrandShortName "@MOZ_APP_DISPLAYNAME@" +!endif !define BrandFullName "${BrandFullNameInternal}" -!define NO_UNINSTALL_SURVEY - -# !define CERTIFICATE_NAME "Mozilla Corporation" -# !define CERTIFICATE_ISSUER "Thawte Code Signing CA - G2" +!define CERTIFICATE_NAME "Mozilla Corporation" +!define CERTIFICATE_ISSUER "DigiCert SHA2 Assured ID Code Signing CA" +; Changing the name or issuer requires us to have both the old and the new +; in the registry at the same time, temporarily. +!define CERTIFICATE_NAME_PREVIOUS "Mozilla Corporation" +!define CERTIFICATE_ISSUER_PREVIOUS "DigiCert Assured ID Code Signing CA-1" # LSP_CATEGORIES is the permitted LSP categories for the application. Each LSP # category value is ANDed together to set multiple permitted categories. @@ -39,20 +60,26 @@ #ifdef HAVE_64BIT_BUILD !define HAVE_64BIT_BUILD !define ARCH "x64" -!define MinSupportedVer "Microsoft Windows Vista x64" +!define MinSupportedVer "Microsoft Windows 7 x64" #else !define ARCH "x86" -!define MinSupportedVer "Microsoft Windows Vista" +!define MinSupportedVer "Microsoft Windows 7" +#endif + +!define MinSupportedCPU "SSE2" + +#ifdef MOZ_MAINTENANCE_SERVICE +!define MOZ_MAINTENANCE_SERVICE #endif # File details shared by both the installer and uninstaller VIProductVersion "1.0.0.0" -VIAddVersionKey "ProductName" "Pale Moon" -VIAddVersionKey "CompanyName" "Moonchild Productions" +VIAddVersionKey "ProductName" "${BrandShortName}" +VIAddVersionKey "CompanyName" "${CompanyName}" #ifdef MOZ_OFFICIAL_BRANDING -VIAddVersionKey "LegalTrademarks" "Pale Moon is the intellectual property of Moonchild Productions." +VIAddVersionKey "LegalTrademarks" "${BrandShortName} is a Trademark of Moonchild Productions." #endif -VIAddVersionKey "LegalCopyright" "Moonchild Productions" +VIAddVersionKey "LegalCopyright" "${CompanyName}" VIAddVersionKey "FileVersion" "${AppVersion}" VIAddVersionKey "ProductVersion" "${AppVersion}" # Comments is not used but left below commented out for future reference diff --git a/application/palemoon/installer/windows/nsis/installer.nsi b/application/palemoon/installer/windows/nsis/installer.nsi index 147a56c9b..276b94f74 100644 --- a/application/palemoon/installer/windows/nsis/installer.nsi +++ b/application/palemoon/installer/windows/nsis/installer.nsi @@ -5,7 +5,7 @@ # Required Plugins: # AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in # ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in -# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash +# CityHash http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in # UAC http://nsis.sourceforge.net/UAC_plug-in # ServicesHelper Mozilla specific plugin that is located in /other-licenses/nsis @@ -21,15 +21,25 @@ CRCCheck on RequestExecutionLevel user +; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can +; be removed after we require NSIS 3.0a2 or greater. +!ifdef NSIS_PACKEDVERSION + Unicode true + ManifestSupportedOS all + ManifestDPIAware true +!endif + !addplugindir ./ Var TmpVal Var InstallType Var AddStartMenuSC +Var AddTaskbarSC Var AddQuickLaunchSC Var AddDesktopSC Var InstallMaintenanceService Var PageName +Var PreventRebootRequired ; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for ; an application's Start Menu PROGRAMS directory and doesn't define the @@ -82,6 +92,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe" !insertmacro InitHashAppModelId !insertmacro IsHandlerForInstallDir !insertmacro IsPinnedToTaskBar +!insertmacro IsUserAdmin !insertmacro LogDesktopShortcut !insertmacro LogQuickLaunchShortcut !insertmacro LogStartMenuShortcut @@ -90,6 +101,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe" !insertmacro RegCleanAppHandler !insertmacro RegCleanMain !insertmacro RegCleanUninstall +!insertmacro RemovePrecompleteEntries !insertmacro SetAppLSPCategories !insertmacro SetBrandNameVars !insertmacro UpdateShortcutAppModelIDs @@ -153,6 +165,11 @@ Page custom preOptions leaveOptions !define MUI_DIRECTORYPAGE_VERIFYONLEAVE !insertmacro MUI_PAGE_DIRECTORY +; Custom Components Page +!ifdef MOZ_MAINTENANCE_SERVICE +Page custom preComponents leaveComponents +!endif + ; Custom Shortcuts Page Page custom preShortcuts leaveShortcuts @@ -185,7 +202,42 @@ Section "-InstallStartCleanup" SetOutPath "$INSTDIR" ${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}" - ; Delete the app exe to prevent launching the app while we are installing. + StrCpy $R9 "true" + StrCpy $PreventRebootRequired "false" + ${GetParameters} $R8 + ${GetOptions} "$R8" "/INI=" $R7 + ${Unless} ${Errors} + ; The configuration file must also exist + ${If} ${FileExists} "$R7" + ReadINIStr $R9 $R7 "Install" "RemoveDistributionDir" + ReadINIStr $R8 $R7 "Install" "PreventRebootRequired" + ${If} $R8 == "true" + StrCpy $PreventRebootRequired "true" + ${EndIf} + ${EndIf} + ${EndUnless} + + ; Remove directories and files we always control before parsing the uninstall + ; log so empty directories can be removed. + ${If} ${FileExists} "$INSTDIR\updates" + RmDir /r "$INSTDIR\updates" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\updated" + RmDir /r "$INSTDIR\updated" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults\shortcuts" + RmDir /r "$INSTDIR\defaults\shortcuts" + ${EndIf} + ; Only remove the distribution directory if it exists and if the installer + ; isn't launched with an ini file that has RemoveDistributionDir=false in the + ; install section. + ${If} ${FileExists} "$INSTDIR\distribution" + ${AndIf} $R9 != "false" + RmDir /r "$INSTDIR\distribution" + ${EndIf} + + ; Delete the app exe if present to prevent launching the app while we are + ; installing. ClearErrors ${DeleteFile} "$INSTDIR\${FileMainEXE}" ${If} ${Errors} @@ -201,9 +253,31 @@ Section "-InstallStartCleanup" ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" ; Remove the updates directory for Vista and above - ${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates" + ${CleanUpdateDirectories} "Mozilla\Pale Moon" "Mozilla\updates" ${RemoveDeprecatedFiles} + ${RemovePrecompleteEntries} "false" + + ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js" + Delete "$INSTDIR\defaults\pref\channel-prefs.js" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults\pref" + RmDir "$INSTDIR\defaults\pref" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults" + RmDir "$INSTDIR\defaults" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\uninstall" + ; Remove the uninstall directory that we control + RmDir /r "$INSTDIR\uninstall" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\update-settings.ini" + Delete "$INSTDIR\update-settings.ini" + ${EndIf} + + ; Explictly remove empty webapprt dir in case it exists (bug 757978). + RmDir "$INSTDIR\webapprt\components" + RmDir "$INSTDIR\webapprt" ${InstallStartCleanupCommon} SectionEnd @@ -215,8 +289,6 @@ Section "-Application" APP_IDX DetailPrint $(STATUS_INSTALL_APP) SetDetailsPrint none - RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" - ${LogHeader} "Installing Main Files" ${CopyFilesFromDir} "$EXEDIR\core" "$INSTDIR" \ "$(ERROR_CREATE_DIRECTORY_PREFIX)" \ @@ -237,18 +309,6 @@ Section "-Application" APP_IDX ${LogMsg} "Registered: $INSTDIR\AccessibleMarshal.dll" ${EndIf} - ; Write extra files created by the application to the uninstall log so they - ; will be removed when the application is uninstalled. To remove an empty - ; directory write a bogus filename to the deepest directory and all empty - ; parent directories will be removed. - ${LogUninstall} "File: \components\compreg.dat" - ${LogUninstall} "File: \components\xpti.dat" - ${LogUninstall} "File: \active-update.xml" - ${LogUninstall} "File: \install.log" - ${LogUninstall} "File: \install_status.log" - ${LogUninstall} "File: \install_wizard.log" - ${LogUninstall} "File: \updates.xml" - ClearErrors ; Default for creating Start Menu shortcut @@ -336,10 +396,12 @@ Section "-Application" APP_IDX ; If we are writing to HKLM and create either the desktop or start menu ; shortcuts set IconsVisible to 1 otherwise to 0. + ; Taskbar shortcuts imply having a start menu shortcut. ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" ${If} $AddDesktopSC == 1 ${OrIf} $AddStartMenuSC == 1 + ${OrIf} $AddTaskbarSC == 1 WriteRegDWORD HKLM "$0" "IconsVisible" 1 ${Else} WriteRegDWORD HKLM "$0" "IconsVisible" 0 @@ -353,16 +415,53 @@ Section "-Application" APP_IDX ; If we create either the desktop or start menu shortcuts, then ; set IconsVisible to 1 otherwise to 0. + ; Taskbar shortcuts imply having a start menu shortcut. ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" ${If} $AddDesktopSC == 1 ${OrIf} $AddStartMenuSC == 1 + ${OrIf} $AddTaskbarSC == 1 WriteRegDWORD HKCU "$0" "IconsVisible" 1 ${Else} WriteRegDWORD HKCU "$0" "IconsVisible" 0 ${EndIf} ${EndIf} +!ifdef MOZ_MAINTENANCE_SERVICE + ; If the maintenance service page was displayed then a value was already + ; explicitly selected for installing the maintenance service and + ; and so InstallMaintenanceService will already be 0 or 1. + ; If the maintenance service page was not displayed then + ; InstallMaintenanceService will be equal to "". + ${If} $InstallMaintenanceService == "" + Call IsUserAdmin + Pop $R0 + ${If} $R0 == "true" + ; Only proceed if we have HKLM write access + ${AndIf} $TmpVal == "HKLM" + ; On Windows < XP SP3 we do not install the maintenance service. + ${If} ${IsWinXP} + ${AndIf} ${AtMostServicePack} 2 + StrCpy $InstallMaintenanceService "0" + ${Else} + ; The user is an admin, so we should default to installing the service. + StrCpy $InstallMaintenanceService "1" + ${EndIf} + ${Else} + ; The user is not admin, so we can't install the service. + StrCpy $InstallMaintenanceService "0" + ${EndIf} + ${EndIf} + + ${If} $InstallMaintenanceService == "1" + ; The user wants to install the maintenance service, so execute + ; the pre-packaged maintenance service installer. + ; This option can only be turned on if the user is an admin so there + ; is no need to use ExecShell w/ verb runas to enforce elevated. + nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" + ${EndIf} +!endif + ; These need special handling on uninstall since they may be overwritten by ; an install into a different location. StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" @@ -437,6 +536,13 @@ Section "-Application" APP_IDX ${EndIf} ${EndIf} + ; Update lastwritetime of the Start Menu shortcut to clear the tile cache. + ${If} ${AtLeastWin8} + ${AndIf} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" + FileOpen $0 "$SMPROGRAMS\${BrandFullName}.lnk" a + FileClose $0 + ${EndIf} + ${If} $AddDesktopSC == 1 CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" @@ -472,6 +578,13 @@ Section "-Application" APP_IDX ${EndIf} ${EndUnless} ${EndIf} + +!ifdef MOZ_MAINTENANCE_SERVICE + ${If} $TmpVal == "HKLM" + ; Add the registry keys for allowed certificates. + ${AddMaintCertKeys} + ${EndIf} +!endif SectionEnd ; Cleanup operations to perform at the end of the installation. @@ -481,8 +594,35 @@ Section "-InstallEndCleanup" SetDetailsPrint none ${Unless} ${Silent} + ClearErrors ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State" ${If} "$0" == "1" + ; NB: this code is duplicated in stub.nsi. Please keep in sync. + ; For data migration in the app, we want to know what the default browser + ; value was before we changed it. To do so, we read it here and store it + ; in our own registry key. + StrCpy $0 "" + ${If} ${AtLeastWinVista} + AppAssocReg::QueryCurrentDefault "http" "protocol" "effective" + Pop $1 + ; If the method hasn't failed, $1 will contain the progid. Check: + ${If} "$1" != "method failed" + ${AndIf} "$1" != "method not available" + ; Read the actual command from the progid + ReadRegStr $0 HKCR "$1\shell\open\command" "" + ${EndIf} + ${EndIf} + ; If using the App Association Registry didn't happen or failed, fall back + ; to the effective http default: + ${If} "$0" == "" + ReadRegStr $0 HKCR "http\shell\open\command" "" + ${EndIf} + ; If we have something other than empty string now, write the value. + ${If} "$0" != "" + ClearErrors + WriteRegStr HKCU "Software\Mozilla\Pale Moon" "OldDefaultBrowserCommand" "$0" + ${EndIf} + ${LogHeader} "Setting as the default browser" ClearErrors ${GetParameters} $0 @@ -493,46 +633,64 @@ Section "-InstallEndCleanup" GetFunctionAddress $0 SetAsDefaultAppUserHKCU UAC::ExecCodeSegment $0 ${EndIf} + ${ElseIfNot} ${Errors} + ${LogHeader} "Writing default-browser opt-out" + ClearErrors + WriteRegStr HKCU "Software\Mozilla\Pale Moon" "DefaultBrowserOptOut" "True" + ${If} ${Errors} + ${LogMsg} "Error writing default-browser opt-out" + ${EndIf} ${EndIf} - ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). - ${MigrateTaskBarShortcut} ${EndUnless} - ${GetShortcutsLogPath} $0 - WriteIniStr "$0" "TASKBAR" "Migrated" "true" + ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). + ${MigrateTaskBarShortcut} + + ; Add the Firewall entries during install + Call AddFirewallEntries ; Refresh desktop icons System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_DWORDFLUSH}, i 0, i 0)" ${InstallEndCleanupCommon} + ${If} $PreventRebootRequired == "true" + SetRebootFlag false + ${EndIf} + ${If} ${RebootFlag} - ; When a reboot is required give SHChangeNotify time to finish the - ; refreshing the icons so the OS doesn't display the icons from helper.exe - Sleep 10000 - ${LogHeader} "Reboot Required To Finish Installation" - ; ${FileMainEXE}.moz-upgrade should never exist but just in case... - ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade" - Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade" - ${EndUnless} + ; Admin is required to delete files on reboot so only add the moz-delete if + ; the user is an admin. After calling UAC::IsAdmin $0 will equal 1 if the + ; user is an admin. + UAC::IsAdmin + ${If} "$0" == "1" + ; When a reboot is required give SHChangeNotify time to finish the + ; refreshing the icons so the OS doesn't display the icons from helper.exe + Sleep 10000 + ${LogHeader} "Reboot Required To Finish Installation" + ; ${FileMainEXE}.moz-upgrade should never exist but just in case... + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade" + Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade" + ${EndUnless} - ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" - ClearErrors - Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete" - ${Unless} ${Errors} - Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" + ClearErrors + Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete" + ${Unless} ${Errors} + Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" + ${EndUnless} + ${EndIf} + + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" + CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR" + FileOpen $0 "$INSTDIR\${FileMainEXE}" w + FileWrite $0 "Will be deleted on restart" + Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}" + FileClose $0 + Delete "$INSTDIR\${FileMainEXE}" + Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}" ${EndUnless} ${EndIf} - - ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" - CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR" - FileOpen $0 "$INSTDIR\${FileMainEXE}" w - FileWrite $0 "Will be deleted on restart" - Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}" - FileClose $0 - Delete "$INSTDIR\${FileMainEXE}" - Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}" - ${EndUnless} ${EndIf} SectionEnd @@ -669,7 +827,9 @@ Function CheckExistingInstall FunctionEnd Function LaunchApp +!ifndef DEV_EDITION ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)" +!endif ClearErrors ${GetParameters} $0 @@ -776,9 +936,7 @@ Function leaveShortcuts Abort ${EndIf} ${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State" - - ; If we have a Metro browser and are Win8, then we don't have a Field 3 - ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State" + ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State" ; Don't install the quick launch shortcut on Windows 7 ${Unless} ${AtLeastWin7} @@ -790,6 +948,59 @@ Function leaveShortcuts ${EndIf} FunctionEnd +!ifdef MOZ_MAINTENANCE_SERVICE +Function preComponents + ; If the service already exists, don't show this page + ServicesHelper::IsInstalled "MozillaMaintenance" + Pop $R9 + ${If} $R9 == 1 + ; The service already exists so don't show this page. + Abort + ${EndIf} + + ; On Windows < XP SP3 we do not install the maintenance service. + ${If} ${IsWinXP} + ${AndIf} ${AtMostServicePack} 2 + Abort + ${EndIf} + + ; Don't show the custom components page if the + ; user is not an admin + Call IsUserAdmin + Pop $R9 + ${If} $R9 != "true" + Abort + ${EndIf} + + ; Only show the maintenance service page if we have write access to HKLM + ClearErrors + WriteRegStr HKLM "Software\Mozilla" \ + "${BrandShortName}InstallerTest" "Write Test" + ${If} ${Errors} + ClearErrors + Abort + ${Else} + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" + ${EndIf} + + StrCpy $PageName "Components" + ${CheckCustomCommon} + !insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini" +FunctionEnd + +Function leaveComponents + ${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State" + ${If} $0 != 0 + Abort + ${EndIf} + ${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State" + ${If} $InstallType == ${INSTALLTYPE_CUSTOM} + Call CheckExistingInstall + ${EndIf} +FunctionEnd +!endif + Function preSummary StrCpy $PageName "Summary" ; Setup the summary.ini file for the Custom Summary Page @@ -838,14 +1049,14 @@ Function preSummary WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" ${Unless} ${Errors} DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" - ; Check if Firefox is the http handler for this user. + ; Check if Pale Moon is the http handler for this user. SetShellVarContext current ; Set SHCTX to the current user ${IsHandlerForInstallDir} "http" $R9 ${If} $TmpVal == "HKLM" SetShellVarContext all ; Set SHCTX to all users ${EndIf} - ; If Firefox isn't the http handler for this user show the option to set - ; Firefox as the default browser. + ; If Pale Moon isn't the http handler for this user show the option to set + ; Pale Moon as the default browser. ${If} "$R9" != "true" ${AndIf} ${AtMostWin2008R2} WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4" @@ -926,7 +1137,46 @@ Function .onInit StrCpy $LANGUAGE 0 ${SetBrandNameVars} "$EXEDIR\core\distribution\setup.ini" - ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OS_MSG)" + ; Don't install on systems that don't support SSE2. The parameter value of + ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the + ; SSE2 instruction set is available. Result returned in $R7. + System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7" + + ; Windows NT 6.0 and lower are not supported on any architecture. + ${Unless} ${AtLeastWin7} + ${If} "$R7" == "0" + strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" + ${Else} + strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_MSG)" + ${EndIf} + MessageBox MB_OKCANCEL|MB_ICONSTOP "$R7" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndUnless} + + ; SSE2 support + ${If} "$R7" == "0" + MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_CPU_MSG)" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndIf} + +!ifdef HAVE_64BIT_BUILD + ${Unless} ${RunningX64} + MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndUnless} + SetRegView 64 +!endif + + ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" + +; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be +; removed after we require NSIS 3.0a2 or greater. +!ifndef NSIS_PACKEDVERSION + System::Call 'user32::SetProcessDPIAware()' +!endif !insertmacro InitInstallOptionsFile "options.ini" !insertmacro InitInstallOptionsFile "shortcuts.ini" @@ -1016,6 +1266,25 @@ Function .onInit WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1" ${EndUnless} + ; Setup the components.ini file for the Components Page + WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2" + + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25" + + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP" + ; There must always be a core directory. ${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8 SectionSetSize ${APP_IDX} $R5 diff --git a/application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi b/application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi new file mode 100644 index 000000000..1f73bac6a --- /dev/null +++ b/application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi @@ -0,0 +1,332 @@ +# 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/. + +; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs +!verbose 3 + +; 7-Zip provides better compression than the lzma from NSIS so we add the files +; uncompressed and use 7-Zip to create a SFX archive of it +SetDatablockOptimize on +SetCompress off +CRCCheck on + +RequestExecutionLevel admin + +; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can +; be removed after we require NSIS 3.0a2 or greater. +!ifdef NSIS_PACKEDVERSION + Unicode true + ManifestSupportedOS all + ManifestDPIAware true +!endif + +!addplugindir ./ + +; Variables +Var TempMaintServiceName +Var BrandFullNameDA +Var BrandFullName + +; Other included files may depend upon these includes! +; The following includes are provided by NSIS. +!include FileFunc.nsh +!include LogicLib.nsh +!include MUI.nsh +!include WinMessages.nsh +!include WinVer.nsh +!include WordFunc.nsh + +!insertmacro GetOptions +!insertmacro GetParameters +!insertmacro GetSize + +; The test slaves use this fallback key to run tests. +; And anyone that wants to run tests themselves should already have +; this installed. +!define FallbackKey \ + "SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4" + +!define CompanyName "Mozilla Corporation" +!define BrandFullNameInternal "" + +; The following includes are custom. +!include defines.nsi +; We keep defines.nsi defined so that we get other things like +; the version number, but we redefine BrandFullName +!define MaintFullName "Mozilla Maintenance Service" +!undef BrandFullName +!define BrandFullName "${MaintFullName}" + +!include common.nsh +!include locales.nsi + +VIAddVersionKey "FileDescription" "${MaintFullName} Installer" +VIAddVersionKey "OriginalFilename" "maintenanceservice_installer.exe" + +Name "${MaintFullName}" +OutFile "maintenanceservice_installer.exe" + +; Get installation folder from registry if available +InstallDirRegKey HKLM "Software\Mozilla\MaintenanceService" "" + +SetOverwrite on + +; serviceinstall.cpp also uses this key, in case the path is changed, update +; there too. +!define MaintUninstallKey \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" + +; Always install into the 32-bit location even if we have a 64-bit build. +; This is because we use only 1 service for all Basilisk channels. +; Allow either x86 and x64 builds to exist at this location, depending on +; what is the latest build. +InstallDir "$PROGRAMFILES32\${MaintFullName}\" +ShowUnInstDetails nevershow + +################################################################################ +# Modern User Interface - MUI + +!define MUI_ICON setup.ico +!define MUI_UNICON setup.ico +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp + +;Interface Settings +!define MUI_ABORTWARNING + +; Uninstaller Pages +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +################################################################################ +# Language + +!insertmacro MOZ_MUI_LANGUAGE 'baseLocale' +!verbose push +!verbose 3 +!include "overrideLocale.nsh" +!include "customLocale.nsh" +!verbose pop + +; Set this after the locale files to override it if it is in the locale +; using " " for BrandingText will hide the "Nullsoft Install System..." branding +BrandingText " " + +Function .onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + + SetSilent silent + + ${Unless} ${AtLeastWin7} + Abort + ${EndUnless} +FunctionEnd + +Function un.onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + +; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be +; removed after we require NSIS 3.0a2 or greater. +!ifndef NSIS_PACKEDVERSION + ${If} ${AtLeastWinVista} + System::Call 'user32::SetProcessDPIAware()' + ${EndIf} +!endif + + StrCpy $BrandFullNameDA "${MaintFullName}" + StrCpy $BrandFullName "${MaintFullName}" +FunctionEnd + +Section "MaintenanceService" + AllowSkipFiles off + + CreateDirectory $INSTDIR + SetOutPath $INSTDIR + + ; If the service already exists, then it will be stopped when upgrading it + ; via the maintenanceservice_tmp.exe command executed below. + ; The maintenanceservice_tmp.exe command will rename the file to + ; maintenanceservice.exe if maintenanceservice_tmp.exe is newer. + ; If the service does not exist yet, we install it and drop the file on + ; disk as maintenanceservice.exe directly. + StrCpy $TempMaintServiceName "maintenanceservice.exe" + IfFileExists "$INSTDIR\maintenanceservice.exe" 0 skipAlreadyExists + StrCpy $TempMaintServiceName "maintenanceservice_tmp.exe" + skipAlreadyExists: + + ; We always write out a copy and then decide whether to install it or + ; not via calling its 'install' cmdline which works by version comparison. + CopyFiles "$EXEDIR\maintenanceservice.exe" "$INSTDIR\$TempMaintServiceName" + + ; The updater.ini file is only used when performing an install or upgrade, + ; and only if that install or upgrade is successful. If an old updater.ini + ; happened to be copied into the maintenance service installation directory + ; but the service was not newer, the updater.ini file would be unused. + ; It is used to fill the description of the service on success. + CopyFiles "$EXEDIR\updater.ini" "$INSTDIR\updater.ini" + + ; Install the application maintenance service. + ; If a service already exists, the command line parameter will stop the + ; service and only install itself if it is newer than the already installed + ; service. If successful it will remove the old maintenanceservice.exe + ; and replace it with maintenanceservice_tmp.exe. + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/Upgrade" $0 + ${If} ${Errors} + ExecWait '"$INSTDIR\$TempMaintServiceName" install' + ${Else} + ; The upgrade cmdline is the same as install except + ; It will fail if the service isn't already installed. + ExecWait '"$INSTDIR\$TempMaintServiceName" upgrade' + ${EndIf} + + WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteRegStr HKLM "${MaintUninstallKey}" "DisplayName" "${MaintFullName}" + WriteRegStr HKLM "${MaintUninstallKey}" "UninstallString" \ + '"$INSTDIR\uninstall.exe"' + WriteRegStr HKLM "${MaintUninstallKey}" "DisplayIcon" \ + "$INSTDIR\Uninstall.exe,0" + WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}" + WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla" + WriteRegStr HKLM "${MaintUninstallKey}" "Comments" "${BrandFullName}" + WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1 + ${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4 + WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2 + + ; Write out that a maintenance service was attempted. + ; We do this because on upgrades we will check this value and we only + ; want to install once on the first upgrade to maintenance service. + ; Also write out that we are currently installed, preferences will check + ; this value to determine if we should show the service update pref. + ; Since the Maintenance service can be installed either x86 or x64, + ; always use the 64-bit registry for checking if an attempt was made. + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1 + WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Installed" 1 + DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled" + + ; Included here for debug purposes only. + ; These keys are used to bypass the installation dir is a valid installation + ; check from the service so that tests can be run. + ; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation" + ; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA" + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} +SectionEnd + +; By renaming before deleting we improve things slightly in case +; there is a file in use error. In this case a new install can happen. +Function un.RenameDelete + Pop $9 + ; If the .moz-delete file already exists previously, delete it + ; If it doesn't exist, the call is ignored. + ; We don't need to pass /REBOOTOK here since it was already marked that way + ; if it exists. + Delete "$9.moz-delete" + Rename "$9" "$9.moz-delete" + ${If} ${Errors} + Delete /REBOOTOK "$9" + ${Else} + Delete /REBOOTOK "$9.moz-delete" + ${EndIf} + ClearErrors +FunctionEnd + +Section "Uninstall" + ; Delete the service so that no updates will be attempted + ExecWait '"$INSTDIR\maintenanceservice.exe" uninstall' + + Push "$INSTDIR\updater.ini" + Call un.RenameDelete + Push "$INSTDIR\maintenanceservice.exe" + Call un.RenameDelete + Push "$INSTDIR\maintenanceservice_tmp.exe" + Call un.RenameDelete + Push "$INSTDIR\maintenanceservice.old" + Call un.RenameDelete + Push "$INSTDIR\Uninstall.exe" + Call un.RenameDelete + Push "$INSTDIR\update\updater.ini" + Call un.RenameDelete + Push "$INSTDIR\update\updater.exe" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-1.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-2.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-3.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-4.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-5.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-6.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-7.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-8.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-9.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-10.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-install.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-uninstall.log" + Call un.RenameDelete + SetShellVarContext all + Push "$APPDATA\Mozilla\logs\maintenanceservice.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-1.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-2.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-3.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-4.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-5.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-6.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-7.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-8.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-9.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-10.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-install.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-uninstall.log" + Call un.RenameDelete + RMDir /REBOOTOK "$APPDATA\Mozilla\logs" + RMDir /REBOOTOK "$APPDATA\Mozilla" + RMDir /REBOOTOK "$INSTDIR\logs" + RMDir /REBOOTOK "$INSTDIR\update" + RMDir /REBOOTOK "$INSTDIR" + + DeleteRegKey HKLM "${MaintUninstallKey}" + + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed" + DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled" + DeleteRegKey HKLM "${FallbackKey}\" + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} +SectionEnd diff --git a/application/palemoon/installer/windows/nsis/shared.nsh b/application/palemoon/installer/windows/nsis/shared.nsh index 9770d4733..29136f47a 100644 --- a/application/palemoon/installer/windows/nsis/shared.nsh +++ b/application/palemoon/installer/windows/nsis/shared.nsh @@ -2,12 +2,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/. -; The registration ID of the COM server which is used for choosing wether -; to launch the Win8 metro browser or desktop browser. -!define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3} - !macro PostUpdate - ; PostUpdate is called from both session 0 and from the user session ; for service updates, make sure that we only register with the user session ; Otherwise ApplicationID::Set can fail intermittently with a file in use error. @@ -15,7 +10,7 @@ System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)" ; Determine if we're the protected UserChoice default or not. If so fix the - ; start menu tile. In case there are 2 Pale Moon installations, we only do + ; start menu tile. In case there are 2 PaleMoon installations, we only do ; this if the application being updated is the default. ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" ${If} $0 == "PaleMoonURL" @@ -61,6 +56,9 @@ ; Win7 taskbar and start menu link maintenance Call FixShortcutAppModelIDs + ; Add the Firewall entries after an update + Call AddFirewallEntries + ; Only update the Clients\StartMenuInternet registry key values in HKLM if ; they don't exist or this installation is the same as the one set in those ; keys. @@ -100,6 +98,13 @@ ; root of the Start Menu Programs directory. ${MigrateStartMenuShortcut} + ; Update lastwritetime of the Start Menu shortcut to clear the tile cache. + ${If} ${AtLeastWin8} + ${AndIf} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" + FileOpen $0 "$SMPROGRAMS\${BrandFullName}.lnk" a + FileClose $0 + ${EndIf} + ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). ${MigrateTaskBarShortcut} @@ -120,6 +125,50 @@ RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" +!ifdef MOZ_MAINTENANCE_SERVICE + Call IsUserAdmin + Pop $R0 + ${If} $R0 == "true" + ; Only proceed if we have HKLM write access + ${AndIf} $TmpVal == "HKLM" + ; On Windows 2000 we do not install the maintenance service. + ${AndIf} ${AtLeastWinXP} + ; We check to see if the maintenance service install was already attempted. + ; Since the Maintenance service can be installed either x86 or x64, + ; always use the 64-bit registry for checking if an attempt was made. + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted" + ClearErrors + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + + ; Add the registry keys for allowed certificates. + ${AddMaintCertKeys} + + ; If the maintenance service is already installed, do nothing. + ; The maintenance service will launch: + ; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance + ; service if necessary. If the update was done from updater.exe without + ; the service (i.e. service is failing), updater.exe will do the update of + ; the service. The reasons we do not do it here is because we don't want + ; to have to prompt for limited user accounts when the service isn't used + ; and we currently call the PostUpdate twice, once for the user and once + ; for the SYSTEM account. Also, this would stop the maintenance service + ; and we need a return result back to the service when run that way. + ${If} $5 == "" + ; An install of maintenance service was never attempted. + ; We know we are an Admin and that we have write access into HKLM + ; based on the above checks, so attempt to just run the EXE. + ; In the worst case, in case there is some edge case with the + ; IsAdmin check and the permissions check, the maintenance service + ; will just fail to be attempted to be installed. + nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" + ${EndIf} + ${EndIf} +!endif !macroend !define PostUpdate "!insertmacro PostUpdate" @@ -280,11 +329,11 @@ ${If} ${Errors} WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "PaleMoonHTML" ${EndIf} + WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}\OpenWithProgids" "PaleMoonHTML" "" !macroend !define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist" - -; Adds the protocol and file handler registry entries for making Pale Moon the +; Adds the protocol and file handler registry entries for making PaleMoon the ; default handler (uses SHCTX). !macro SetHandlers ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 @@ -318,10 +367,11 @@ WriteRegStr SHCTX "$0\.xhtml" "" "PaleMoonHTML" ${EndIf} - ;Register file associations, but only if they don't exist yet. + ${AddAssociationIfNoneExist} ".pdf" ${AddAssociationIfNoneExist} ".oga" ${AddAssociationIfNoneExist} ".ogg" ${AddAssociationIfNoneExist} ".ogv" + ${AddAssociationIfNoneExist} ".pdf" ${AddAssociationIfNoneExist} ".webm" ; An empty string is used for the 5th param because PaleMoonHTML is not a @@ -331,7 +381,6 @@ ${AddDisabledDDEHandlerValues} "PaleMoonURL" "$2" "$8,1" "${AppRegName} URL" \ "true" - ; An empty string is used for the 4th & 5th params because the following ; protocol handlers already have a display name and the additional keys ; required for a protocol handler. @@ -341,7 +390,7 @@ !macroend !define SetHandlers "!insertmacro SetHandlers" -; Adds the HKLM\Software\Clients\StartMenuInternet\{EXE} registry +; Adds the HKLM\Software\Clients\StartMenuInternet\FIREFOX.EXE registry ; entries (does not use SHCTX). ; ; The values for StartMenuInternet are only valid under HKLM and there can only @@ -420,7 +469,7 @@ ; The IconHandler reference for PaleMoonHTML can end up in an inconsistent state ; due to changes not being detected by the IconHandler for side by side ; installs (see bug 268512). The symptoms can be either an incorrect icon or no -; icon being displayed for files associated with Pale Moon (does not use SHCTX). +; icon being displayed for files associated with PaleMoon (does not use SHCTX). !macro FixShellIconHandler RegKey ClearErrors ReadRegStr $1 ${RegKey} "Software\Classes\PaleMoonHTML\ShellEx\IconHandler" "" @@ -436,37 +485,67 @@ ; Add Software\Mozilla\ registry entries (uses SHCTX). !macro SetAppKeys + ; Check if this is an ESR release and if so add registry values so it is + ; possible to determine that this is an ESR install (bug 726781). + ClearErrors + ${WordFind} "${UpdateChannel}" "esr" "E#" $3 + ${If} ${Errors} + StrCpy $3 "" + ${Else} + StrCpy $3 " ESR" + ${EndIf} + ${GetLongPath} "$INSTDIR" $8 - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main" + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" ${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0 ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Uninstall" - ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Uninstall" + ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})" - ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion} (${AB_CD})" 0 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})" + ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 + ${If} "$3" == "" + DeleteRegValue SHCTX "$0" "ESR" + ${Else} + ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 + ${EndIf} - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\bin" + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\bin" ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\extensions" + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\extensions" ${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0 ${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0 - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}" - ${WriteRegStr2} $TmpVal "$0" "GoannaVer" "${GREVersion}" 0 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3" + ${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0 + ${If} "$3" == "" + DeleteRegValue SHCTX "$0" "ESR" + ${Else} + ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 + ${EndIf} - StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}" + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}$3" ${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0 - ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion} (${AB_CD})" 0 + ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 !macroend !define SetAppKeys "!insertmacro SetAppKeys" ; Add uninstall registry entries. This macro tests for write access to determine ; if the uninstall keys should be added to HKLM or HKCU. !macro SetUninstallKeys - StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${ARCH} ${AB_CD})" + ; Check if this is an ESR release and if so add registry values so it is + ; possible to determine that this is an ESR install (bug 726781). + ClearErrors + ${WordFind} "${UpdateChannel}" "esr" "E#" $3 + ${If} ${Errors} + StrCpy $3 "" + ${Else} + StrCpy $3 " ESR" + ${EndIf} + + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" StrCpy $2 "" ClearErrors @@ -493,15 +572,24 @@ ${GetLongPath} "$INSTDIR" $8 ; Write the uninstall registry keys - ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0 + ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 ${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0 - ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0 + ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 + ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0 ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 ${WriteRegStr2} $1 "$0" "Publisher" "Moonchild Productions" 0 ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 - ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0 + DeleteRegValue SHCTX "$0" "URLInfoAbout" +; Don't add URLUpdateInfo which is the release notes url except for the release +; and esr channels since nightly, aurora, and beta do not have release notes. +; Note: URLUpdateInfo is only defined in the official branding.nsi. +!ifdef URLUpdateInfo +!ifndef BETA_UPDATE_CHANNEL ${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0 +!endif +!endif + ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0 ${WriteRegDWORD2} $1 "$0" "NoModify" 1 0 ${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0 @@ -518,7 +606,7 @@ !define SetUninstallKeys "!insertmacro SetUninstallKeys" ; Due to a bug when associating some file handlers, only SHCTX was checked for -; some file types such as ".webm". SHCTX is set to HKCU or HKLM depending on +; some file types such as ".pdf". SHCTX is set to HKCU or HKLM depending on ; whether the installer has write access to HKLM. The bug would happen when ; HCKU was checked and didn't exist since programs aren't required to set the ; HKCU Software\Classes keys when associating handlers. The fix uses the merged @@ -534,7 +622,7 @@ ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" "" ${If} "$2" != "" ; Since there is a persistent handler remove PaleMoonHTML as the default - ; value from both HKCU and HKLM if it is set to PaleMoonHTML. + ; value from both HKCU and HKLM if it set to PaleMoonHTML. ${If} "$0" == "PaleMoonHTML" DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" ${EndIf} @@ -542,7 +630,7 @@ DeleteRegValue HKLM "Software\Classes\${FILE_TYPE}" "" ${EndIf} ${ElseIf} "$0" == "PaleMoonHTML" - ; Since KHCU is set to PaleMoonHTML, remove it as the default value + ; Since KHCU is set to PaleMoonHTML remove PaleMoonHTML as the default value ; from HKCU if HKLM is set to a value other than an empty string. ${If} "$1" != "" DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" @@ -630,21 +718,68 @@ !macroend !define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers" +!ifdef MOZ_MAINTENANCE_SERVICE +; Adds maintenance service certificate keys for the install dir. +; For the cert to work, it must also be signed by a trusted cert for the user. +!macro AddMaintCertKeys + Push $R0 + ; Allow main Mozilla cert information for updates + ; This call will push the needed key on the stack + ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" + Pop $R0 + ${If} $R0 != "" + ; More than one certificate can be specified in a different subfolder + ; for example: $R0\1, but each individual binary can be signed + ; with at most one certificate. A fallback certificate can only be used + ; if the binary is replaced with a different certificate. + ; We always use the 64bit registry for certs. + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + + ; PrefetchProcessName was originally used to experiment with deleting + ; Windows prefetch as a speed optimization. It is no longer used though. + DeleteRegValue HKLM "$R0" "prefetchProcessName" + + ; Setting the Attempted value will ensure that a new Maintenance Service + ; install will never be attempted again after this from updates. The value + ; is used only to see if updates should attempt new service installs. + WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1 + + ; These values associate the allowed certificates for the current + ; installation. + WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}" + WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}" + ; These values associate the allowed certificates for the previous + ; installation, so that we can update from it cleanly using the + ; old updater.exe (which will still have this signature). + WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}" + WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}" + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + ClearErrors + ${EndIf} + ; Restore the previously used value back + Pop $R0 +!macroend +!define AddMaintCertKeys "!insertmacro AddMaintCertKeys" +!endif + ; Removes various registry entries for reasons noted below (does not use SHCTX). !macro RemoveDeprecatedKeys StrCpy $0 "SOFTWARE\Classes" ; Remove support for launching gopher urls from the shell during install or - ; update if the DefaultIcon is from palemoon.exe. + ; update if the DefaultIcon is from firefox.exe. ${RegCleanAppHandler} "gopher" ; Remove support for launching chrome urls from the shell during install or - ; update if the DefaultIcon is from palemoon.exe (Bug 301073). + ; update if the DefaultIcon is from firefox.exe (Bug 301073). ${RegCleanAppHandler} "chrome" - ; Remove the app compatibility registry key - StrCpy $0 "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" - DeleteRegValue HKLM "$0" "$INSTDIR\${FileMainEXE}" - DeleteRegValue HKCU "$0" "$INSTDIR\${FileMainEXE}" + ; Remove protocol handler registry keys added by the MS shim + DeleteRegKey HKLM "Software\Classes\PaleMoon.URL" + DeleteRegKey HKCU "Software\Classes\PaleMoon.URL" ; Delete gopher from Capabilities\URLAssociations if it is present. ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 @@ -671,147 +806,21 @@ RmDir /r /REBOOTOK "$INSTDIR\extensions\talkback@mozilla.org" ${EndIf} - ; Remove the Java Console extension (bug 597235) - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" - ${EndIf} + ; Remove the Java Console extension (bug 1165156) ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0034-ABCDEFFEDCBA}" + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0034-ABCDEFFEDCBA}" ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" - ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0039-ABCDEFFEDCBA}" + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0039-ABCDEFFEDCBA}" ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0045-ABCDEFFEDCBA}" + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0045-ABCDEFFEDCBA}" ${EndIf} - ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" - RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" ${EndIf} !macroend !define RemoveDeprecatedFiles "!insertmacro RemoveDeprecatedFiles" @@ -876,15 +885,15 @@ ${If} $5 == "" ${Break} ${EndIf} - ${If} $5 == 233 ; ansi ?? + ${If} $5 == 233 ; ansi é StrCpy $0 "1" FileWriteByte $4 195 FileWriteByte $4 169 - ${ElseIf} $5 == 241 ; ansi ?? + ${ElseIf} $5 == 241 ; ansi ñ StrCpy $0 "1" FileWriteByte $4 195 FileWriteByte $4 177 - ${ElseIf} $5 == 252 ; ansi ?? + ${ElseIf} $5 == 252 ; ansi ü StrCpy $0 "1" FileWriteByte $4 195 FileWriteByte $4 188 @@ -926,17 +935,24 @@ ClearErrors WriteIniStr "$0" "TASKBAR" "Migrated" "true" ${If} ${AtLeastWin7} - ; No need to check the default on Win8 and later - ${If} ${AtMostWin2008R2} - ; Check if Pale Moon is the http handler for this user - SetShellVarContext current ; Set SHCTX to the current user - ${IsHandlerForInstallDir} "http" $R9 - ${If} $TmpVal == "HKLM" - SetShellVarContext all ; Set SHCTX to all users + ; If we didn't run the stub installer, AddTaskbarSC will be empty. + ; We determine whether to pin based on whether we're the default + ; browser, or if we're on win8 or later, we always pin. + ${If} $AddTaskbarSC == "" + ; No need to check the default on Win8 and later + ${If} ${AtMostWin2008R2} + ; Check if the PaleMoon is the http handler for this user + SetShellVarContext current ; Set SHCTX to the current user + ${IsHandlerForInstallDir} "http" $R9 + ${If} $TmpVal == "HKLM" + SetShellVarContext all ; Set SHCTX to all users + ${EndIf} ${EndIf} - ${EndIf} - ${If} "$R9" == "true" - ${OrIf} ${AtLeastWin8} + ${If} "$R9" == "true" + ${OrIf} ${AtLeastWin8} + ${PinToTaskBar} + ${EndIf} + ${ElseIf} $AddTaskbarSC == "1" ${PinToTaskBar} ${EndIf} ${EndIf} @@ -1152,17 +1168,86 @@ ; returns after the first check. Push "end" Push "AccessibleMarshal.dll" + Push "IA2Marshal.dll" Push "freebl3.dll" Push "nssckbi.dll" Push "nspr4.dll" Push "nssdbm3.dll" Push "mozsqlite3.dll" Push "xpcom.dll" + Push "crashreporter.exe" + Push "minidump-analyzer.exe" Push "updater.exe" Push "${FileMainEXE}" !macroend !define PushFilesToCheck "!insertmacro PushFilesToCheck" + +; Pushes the string "true" to the top of the stack if the Firewall service is +; running and pushes the string "false" to the top of the stack if it isn't. +!define SC_MANAGER_ALL_ACCESS 0x3F +!define SERVICE_QUERY_CONFIG 0x0001 +!define SERVICE_QUERY_STATUS 0x0004 +!define SERVICE_RUNNING 0x4 + +!macro IsFirewallSvcRunning + Push $R9 + Push $R8 + Push $R7 + Push $R6 + Push "false" + + System::Call 'advapi32::OpenSCManagerW(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.R6' + ${If} $R6 != 0 + ; MpsSvc is the Firewall service on Windows Vista and above. + ; When opening the service with SERVICE_QUERY_CONFIG the return value will + ; be 0 if the service is not installed. + System::Call 'advapi32::OpenServiceW(i R6, t "MpsSvc", i ${SERVICE_QUERY_CONFIG}) i.R7' + ${If} $R7 != 0 + System::Call 'advapi32::CloseServiceHandle(i R7) n' + ; Open the service with SERVICE_QUERY_CONFIG so its status can be queried. + System::Call 'advapi32::OpenServiceW(i R6, t "MpsSvc", i ${SERVICE_QUERY_STATUS}) i.R7' + ${Else} + ; SharedAccess is the Firewall service on Windows XP. + ; When opening the service with SERVICE_QUERY_CONFIG the return value will + ; be 0 if the service is not installed. + System::Call 'advapi32::OpenServiceW(i R6, t "SharedAccess", i ${SERVICE_QUERY_CONFIG}) i.R7' + ${If} $R7 != 0 + System::Call 'advapi32::CloseServiceHandle(i R7) n' + ; Open the service with SERVICE_QUERY_CONFIG so its status can be + ; queried. + System::Call 'advapi32::OpenServiceW(i R6, t "SharedAccess", i ${SERVICE_QUERY_STATUS}) i.R7' + ${EndIf} + ${EndIf} + ; Did the calls to OpenServiceW succeed? + ${If} $R7 != 0 + System::Call '*(i,i,i,i,i,i,i) i.R9' + ; Query the current status of the service. + System::Call 'advapi32::QueryServiceStatus(i R7, i $R9) i' + System::Call '*$R9(i, i.R8)' + System::Free $R9 + System::Call 'advapi32::CloseServiceHandle(i R7) n' + IntFmt $R8 "0x%X" $R8 + ${If} $R8 == ${SERVICE_RUNNING} + Pop $R9 + Push "true" + ${EndIf} + ${EndIf} + System::Call 'advapi32::CloseServiceHandle(i R6) n' + ${EndIf} + + Exch 1 + Pop $R6 + Exch 1 + Pop $R7 + Exch 1 + Pop $R8 + Exch 1 + Pop $R9 +!macroend +!define IsFirewallSvcRunning "!insertmacro IsFirewallSvcRunning" +!define un.IsFirewallSvcRunning "!insertmacro IsFirewallSvcRunning" + ; Sets this installation as the default browser by setting the registry keys ; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS ; plugin for Vista and above. This is a function instead of a macro so it is @@ -1214,7 +1299,7 @@ Function SetAsDefaultAppUserHKCU ${EndUnless} ${EndIf} ${RemoveDeprecatedKeys} - ${PinToTaskBar} + ${MigrateTaskBarShortcut} FunctionEnd ; Helper for updating the shortcut application model IDs. @@ -1225,6 +1310,15 @@ Function FixShortcutAppModelIDs ${EndIf} FunctionEnd +; Helper for adding Firewall exceptions during install and after app update. +Function AddFirewallEntries + ${IsFirewallSvcRunning} + Pop $0 + ${If} "$0" == "true" + liteFirewallW::AddRule "$INSTDIR\${FileMainEXE}" "${BrandShortName} ($INSTDIR)" + ${EndIf} +FunctionEnd + ; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to ; this function only being used by the uninstaller.nsi. !ifdef NO_LOG @@ -1311,4 +1405,4 @@ Function SetAsDefaultAppUser FunctionEnd !define SetAsDefaultAppUser "Call SetAsDefaultAppUser" -!endif +!endif ; NO_LOG diff --git a/application/palemoon/installer/windows/nsis/uninstaller.nsi b/application/palemoon/installer/windows/nsis/uninstaller.nsi index 2ed5d9dfc..333fd33d6 100644 --- a/application/palemoon/installer/windows/nsis/uninstaller.nsi +++ b/application/palemoon/installer/windows/nsis/uninstaller.nsi @@ -4,7 +4,7 @@ # Required Plugins: # AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in -# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash +# CityHash http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in # UAC http://nsis.sourceforge.net/UAC_plug-in @@ -19,6 +19,14 @@ CRCCheck on RequestExecutionLevel user +; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can +; be removed after we require NSIS 3.0a2 or greater. +!ifdef NSIS_PACKEDVERSION + Unicode true + ManifestSupportedOS all + ManifestDPIAware true +!endif + !addplugindir ./ ; On Vista and above attempt to elevate Standard Users in addition to users that @@ -32,6 +40,7 @@ RequestExecutionLevel user "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" Var TmpVal +Var MaintCertKey ; Other included files may depend upon these includes! ; The following includes are provided by NSIS. @@ -67,6 +76,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe" !insertmacro InitHashAppModelId !insertmacro IsHandlerForInstallDir !insertmacro IsPinnedToTaskBar +!insertmacro IsUserAdmin !insertmacro LogDesktopShortcut !insertmacro LogQuickLaunchShortcut !insertmacro LogStartMenuShortcut @@ -85,19 +95,18 @@ VIAddVersionKey "OriginalFilename" "helper.exe" !insertmacro un.CheckForFilesInUse !insertmacro un.CleanUpdateDirectories !insertmacro un.CleanVirtualStore -!insertmacro un.DeleteRelativeProfiles !insertmacro un.DeleteShortcuts !insertmacro un.GetLongPath !insertmacro un.GetSecondInstallPath !insertmacro un.InitHashAppModelId !insertmacro un.ManualCloseAppPrompt -!insertmacro un.ParseUninstallLog !insertmacro un.RegCleanAppHandler !insertmacro un.RegCleanFileHandler !insertmacro un.RegCleanMain !insertmacro un.RegCleanUninstall !insertmacro un.RegCleanProtocolHandler !insertmacro un.RemoveQuotesFromPath +!insertmacro un.RemovePrecompleteEntries !insertmacro un.SetAppLSPCategories !insertmacro un.SetBrandNameVars @@ -146,29 +155,69 @@ ShowUnInstDetails nevershow !insertmacro MUI_UNPAGE_WELCOME ; Custom Uninstall Confirm Page -UninstPage custom un.preConfirm un.leaveConfirm +UninstPage custom un.preConfirm ; Remove Files Page !insertmacro MUI_UNPAGE_INSTFILES ; Finish Page -; Don't setup the survey controls, functions, etc. when the application has -; defined NO_UNINSTALL_SURVEY -!ifndef NO_UNINSTALL_SURVEY -!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish -!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED -!define MUI_FINISHPAGE_SHOWREADME "" -!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT) -!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey -!endif - !insertmacro MUI_UNPAGE_FINISH ; Use the default dialog for IDD_VERIFY for a simple Banner ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" ################################################################################ +# Helper Functions + +; This function is used to uninstall the maintenance service if the +; application currently being uninstalled is the last application to use the +; maintenance service. +Function un.UninstallServiceIfNotUsed + ; $0 will store if a subkey exists + ; $1 will store the first subkey if it exists or an empty string if it doesn't + ; Backup the old values + Push $0 + Push $1 + + ; The maintenance service always uses the 64-bit registry on x64 systems + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + + ; Figure out the number of subkeys + StrCpy $0 0 + ${Do} + EnumRegKey $1 HKLM "Software\Mozilla\MaintenanceService" $0 + ${If} "$1" == "" + ${ExitDo} + ${EndIf} + IntOp $0 $0 + 1 + ${Loop} + + ; Restore back the registry view + ${If} ${RunningX64} + SetRegView lastUsed + ${EndIf} + ${If} $0 == 0 + ; Get the path of the maintenance service uninstaller + ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString" + + ; If the uninstall string does not exist, skip executing it + StrCmp $1 "" doneUninstall + + ; $1 is already a quoted string pointing to the install path + ; so we're already protected against paths with spaces + nsExec::Exec "$1 /S" +doneUninstall: + ${EndIf} + + ; Restore the old value of $1 and $0 + Pop $1 + Pop $0 +FunctionEnd + +################################################################################ # Install Sections ; Empty section required for the installer to compile as an uninstaller Section "" @@ -194,15 +243,6 @@ Section "Uninstall" ClearErrors ${EndIf} - ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State" - ${If} "$0" == "1" - ${un.DeleteRelativeProfiles} "Moonchild Productions\Pale Moon" - ${un.DeleteRelativeProfiles} "Moonchild Productions\MetroPM" - RmDir "$APPDATA\Mozilla\Extensions\{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}" - RmDir "$APPDATA\Mozilla\Extensions" - RmDir "$APPDATA\Mozilla" - ${EndIf} - ; setup the application model id registration value ${un.InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" @@ -218,7 +258,7 @@ Section "Uninstall" ${EndIf} ; Remove the updates directory for Vista and above - ${un.CleanUpdateDirectories} "Moonchild Productions\Pale Moon" "Moonchild Productions\updates" + ${un.CleanUpdateDirectories} "Mozilla\PaleMoon" "Mozilla\updates" ; Remove any app model id's stored in the registry for this install path DeleteRegValue HKCU "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR" @@ -254,6 +294,10 @@ Section "Uninstall" ${un.RegCleanFileHandler} ".shtml" "PaleMoonHTML" ${un.RegCleanFileHandler} ".xht" "PaleMoonHTML" ${un.RegCleanFileHandler} ".xhtml" "PaleMoonHTML" + ${un.RegCleanFileHandler} ".oga" "PaleMoonHTML" + ${un.RegCleanFileHandler} ".ogg" "PaleMoonHTML" + ${un.RegCleanFileHandler} ".ogv" "PaleMoonHTML" + ${un.RegCleanFileHandler} ".pdf" "PaleMoonHTML" ${un.RegCleanFileHandler} ".webm" "PaleMoonHTML" ${EndIf} @@ -273,7 +317,7 @@ Section "Uninstall" ; The StartMenuInternet registry key is independent of the default browser ; settings. The XPInstall base un-installer always removes this key if it is ; uninstalling the default browser and it will always replace the keys when - ; installing even if there is another install of Firefox that is set as the + ; installing even if there is another install of PaleMoon that is set as the ; default browser. Now the key is always updated on install but it is only ; removed if it refers to this install location. ${If} "$INSTDIR" == "$R1" @@ -289,7 +333,7 @@ Section "Uninstall" ; The StartMenuInternet registry key is independent of the default browser ; settings. The XPInstall base un-installer always removes this key if it is ; uninstalling the default browser and it will always replace the keys when - ; installing even if there is another install of Firefox that is set as the + ; installing even if there is another install of PaleMoon that is set as the ; default browser. Now the key is always updated on install but it is only ; removed if it refers to this install location. ${If} "$INSTDIR" == "$R1" @@ -307,7 +351,7 @@ Section "Uninstall" StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe" DeleteRegKey HKLM "$0" DeleteRegKey HKCU "$0" - StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=firefox" + StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=PaleMoon" DeleteRegKey HKLM "$0" DeleteRegKey HKCU "$0" ${Else} @@ -335,42 +379,63 @@ Section "Uninstall" ${If} ${FileExists} "$INSTDIR\distribution" RmDir /r /REBOOTOK "$INSTDIR\distribution" ${EndIf} - ${If} ${FileExists} "$INSTDIR\removed-files" - Delete /REBOOTOK "$INSTDIR\removed-files" - ${EndIf} ; Remove files that may be left behind by the application in the ; VirtualStore directory. ${un.CleanVirtualStore} - ; Parse the uninstall log to unregister dll's and remove all installed - ; files / directories this install is responsible for. - ${un.ParseUninstallLog} + ; Only unregister the dll if the registration points to this installation + ReadRegStr $R1 HKCR "CLSID\{0D68D6D0-D93D-4D08-A30D-F00DD1F45B24}\InProcServer32" "" + ${If} "$INSTDIR\AccessibleMarshal.dll" == "$R1" + ${UnregisterDLL} "$INSTDIR\AccessibleMarshal.dll" + ${EndIf} + + ${un.RemovePrecompleteEntries} "false" - ; Remove the uninstall directory that we control - RmDir /r /REBOOTOK "$INSTDIR\uninstall" + ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js" + Delete /REBOOTOK "$INSTDIR\defaults\pref\channel-prefs.js" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults\pref" + RmDir /REBOOTOK "$INSTDIR\defaults\pref" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults" + RmDir /REBOOTOK "$INSTDIR\defaults" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\uninstall" + ; Remove the uninstall directory that we control + RmDir /r /REBOOTOK "$INSTDIR\uninstall" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\install.log" + Delete /REBOOTOK "$INSTDIR\install.log" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\update-settings.ini" + Delete /REBOOTOK "$INSTDIR\update-settings.ini" + ${EndIf} - ; Explictly remove empty webapprt dir in case it exists - ; See bug 757978 + ; Explicitly remove empty webapprt dir in case it exists (bug 757978). RmDir "$INSTDIR\webapprt\components" RmDir "$INSTDIR\webapprt" - RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" - ; Remove the installation directory if it is empty - ${RemoveDir} "$INSTDIR" + RmDir "$INSTDIR" - ; If firefox.exe was successfully deleted yet we still need to restart to - ; remove other files create a dummy firefox.exe.moz-delete to prevent the + ; If PaleMoon.exe was successfully deleted yet we still need to restart to + ; remove other files create a dummy PaleMoon.exe.moz-delete to prevent the ; installer from allowing an install without restart when it is required ; to complete an uninstall. ${If} ${RebootFlag} - ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete" - FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w - FileWrite $0 "Will be deleted on restart" - Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" - FileClose $0 - ${EndUnless} + ; Admin is required to delete files on reboot so only add the moz-delete if + ; the user is an admin. After calling UAC::IsAdmin $0 will equal 1 if the + ; user is an admin. + UAC::IsAdmin + ${If} "$0" == "1" + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete" + FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w + FileWrite $0 "Will be deleted on restart" + Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" + FileClose $0 + ${EndUnless} + ${EndIf} ${EndIf} ; Refresh desktop icons otherwise the start menu internet item won't be @@ -378,19 +443,38 @@ Section "Uninstall" ; clients registry key by the OS under some conditions. System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i 0, i 0, i 0)" -SectionEnd - -################################################################################ -# Helper Functions - -; Don't setup the survey controls, functions, etc. when the application has -; defined NO_UNINSTALL_SURVEY -!ifndef NO_UNINSTALL_SURVEY -Function un.Survey - Exec "$\"$TmpVal$\" $\"${SurveyURL}$\"" -FunctionEnd + ; Users who uninstall then reinstall expecting PaleMoon to use a clean profile + ; may be surprised during first-run. This key is checked during startup of PaleMoon and + ; subsequently deleted after checking. If the value is found during startup + ; the browser will offer to Reset PaleMoon. We use the UpdateChannel to match + ; uninstalls of PaleMoon-release with reinstalls of PaleMoon-release, for example. + WriteRegStr HKCU "Software\Mozilla\PaleMoon" "Uninstalled-${UpdateChannel}" "True" + +!ifdef MOZ_MAINTENANCE_SERVICE + ; Get the path the allowed cert is at and remove it + ; Keep this block of code last since it modfies the reg view + ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" + Pop $MaintCertKey + ${If} $MaintCertKey != "" + ; Always use the 64bit registry for certs on 64bit systems. + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + DeleteRegKey HKLM "$MaintCertKey" + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + ${EndIf} + Call un.UninstallServiceIfNotUsed !endif + ${un.IsFirewallSvcRunning} + Pop $0 + ${If} "$0" == "true" + liteFirewallW::RemoveRule "$INSTDIR\${FileMainEXE}" "${BrandShortName} ($INSTDIR)" + ${EndIf} +SectionEnd + ################################################################################ # Language @@ -453,7 +537,7 @@ Function un.preConfirm ${EndIf} ; Setup the unconfirm.ini file for the Custom Uninstall Confirm Page - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "5" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "3" WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Type "label" WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Text "$(UN_CONFIRM_UNINSTALLED_FROM)" @@ -473,44 +557,22 @@ Function un.preConfirm WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Bottom "30" WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" flags "READONLY" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "checkbox" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_REMOVE_PROFILES)" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "label" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_CONFIRM_CLICK)" WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Left "0" WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Right "-1" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "40" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "50" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" State "0" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" flags "NOTIFY" - - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "text" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" State "$(UN_REMOVE_PROFILES_DESC)" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "52" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "120" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" flags "MULTILINE|READONLY" - - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Type "label" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Text "$(UN_CONFIRM_CLICK)" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Left "0" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Right "-1" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Top "130" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Bottom "150" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "130" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "150" ${If} "$TmpVal" == "true" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Type "label" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Left "0" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Right "-1" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Top "35" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Bottom "45" - - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "6" - - ; To insert this control reset Top / Bottom for controls below this one - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "55" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "65" - WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "67" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "label" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "35" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "45" + + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "4" ${EndIf} !insertmacro MUI_HEADER_TEXT "$(UN_CONFIRM_PAGE_TITLE)" "$(UN_CONFIRM_PAGE_SUBTITLE)" @@ -518,72 +580,12 @@ Function un.preConfirm ; focus. This sets the focus to the Install button instead. !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "unconfirm.ini" GetDlgItem $0 $HWNDPARENT 1 - ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 4" "HWND" - SetCtlColors $1 0x000000 0xFFFFEE - ShowWindow $1 ${SW_HIDE} System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND" SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" !insertmacro MUI_INSTALLOPTIONS_SHOW FunctionEnd -Function un.leaveConfirm - ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Settings" "State" - StrCmp $0 "3" +1 continue - ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State" - ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 4" "HWND" - StrCmp $0 1 +1 +3 - ShowWindow $1 ${SW_SHOW} - Abort - - ShowWindow $1 ${SW_HIDE} - Abort - - continue: - - ; Try to delete the app executable and if we can't delete it try to find the - ; app's message window and prompt the user to close the app. This allows - ; running an instance that is located in another directory. If for whatever - ; reason there is no message window we will just rename the app's files and - ; then remove them on restart if they are in use. - ClearErrors - ${DeleteFile} "$INSTDIR\${FileMainEXE}" - ${If} ${Errors} - ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)" - ${EndIf} -FunctionEnd - -!ifndef NO_UNINSTALL_SURVEY -Function un.preFinish - ; Do not modify the finish page if there is a reboot pending - ${Unless} ${RebootFlag} - ; Setup the survey controls, functions, etc. - StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup" - ClearErrors - ReadRegStr $0 HKLM $TmpVal "Path" - ${If} ${Errors} - !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3" - ${Else} - ExpandEnvStrings $0 "$0" ; this value will usually contain %programfiles% - ${If} $0 != "\" - StrCpy $0 "$0\" - ${EndIf} - StrCpy $0 "$0\iexplore.exe" - ClearErrors - GetFullPathName $TmpVal $0 - ${If} ${Errors} - !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3" - ${Else} - ; When we add an optional action to the finish page the cancel button - ; is enabled. This disables it and leaves the finish button as the - ; only choice. - !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" - ${EndIf} - ${EndIf} - ${EndUnless} -FunctionEnd -!endif - ################################################################################ # Initialization Functions @@ -605,6 +607,14 @@ Function un.onInit ${un.UninstallUnOnInitCommon} +; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be +; removed after we require NSIS 3.0a2 or greater. +!ifndef NSIS_PACKEDVERSION + ${If} ${AtLeastWinVista} + System::Call 'user32::SetProcessDPIAware()' + ${EndIf} +!endif + !insertmacro InitInstallOptionsFile "unconfirm.ini" FunctionEnd diff --git a/application/palemoon/installer/windows/stub.tag b/application/palemoon/installer/windows/stub.tag deleted file mode 100644 index 4eae031d6..000000000 --- a/application/palemoon/installer/windows/stub.tag +++ /dev/null @@ -1,4 +0,0 @@ -;!@Install@!UTF-8! -Title="Pale Moon" -RunProgram="setup-stub.exe" -;!@InstallEnd@!
\ No newline at end of file diff --git a/application/palemoon/locales/Makefile.in b/application/palemoon/locales/Makefile.in index f00d7a040..5720a76df 100644 --- a/application/palemoon/locales/Makefile.in +++ b/application/palemoon/locales/Makefile.in @@ -96,11 +96,7 @@ NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD)) %/defaults/profile/bookmarks.html: bookmarks.inc generic/profile/bookmarks.html.in $(SYSINSTALL) -D $(dir $@) - $(call py_action,preprocessor, \ - -I $< \ - -DAB_CD=$(NO_JA_JP_MAC_AB_CD) \ - $(srcdir)/generic/profile/bookmarks.html.in \ - -o $@) + $(call py_action,preprocessor,$< -DAB_CD=$(NO_JA_JP_MAC_AB_CD) $(srcdir)/generic/profile/bookmarks.html.in -o $@) libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ; @@ -124,10 +120,10 @@ searchplugins: $(addprefix $(FINAL_TARGET)/searchplugins/,$(SEARCHPLUGINS)) libs-%: $(NSINSTALL) -D $(DIST)/install - @$(MAKE) -C ../../toolkit/locales libs-$* - @$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* - @$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* - @$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$* + @$(MAKE) -C ../../../toolkit/locales libs-$* + @$(MAKE) -C ../../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* + @$(MAKE) -C ../../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* + @$(MAKE) -C ../../../intl/locales AB_CD=$* XPI_NAME=locale-$* @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR) @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.dtd b/application/palemoon/locales/en-US/chrome/browser/browser.dtd index fe5f64854..65cc34fa0 100644 --- a/application/palemoon/locales/en-US/chrome/browser/browser.dtd +++ b/application/palemoon/locales/en-US/chrome/browser/browser.dtd @@ -337,7 +337,6 @@ These should match what Safari and other Apple applications use on OS X Lion. -- <!ENTITY appMenuSafeMode.label "Restart in Safe Mode…"> <!ENTITY openCmd.commandkey "l"> -<!ENTITY urlbar.placeholder2 "Search or enter address"> <!ENTITY urlbar.accesskey "d"> <!ENTITY urlbar.switchToTab.label "Switch to tab:"> @@ -643,8 +642,10 @@ just addresses the organization to follow, e.g. "This site is run by " --> <!ENTITY getUserMedia.selectMicrophone.label "Microphone to share:"> <!ENTITY getUserMedia.selectMicrophone.accesskey "M"> +#ifdef MOZ_WEBRTC <!ENTITY webrtcIndicatorButton.label "Camera / Microphone Access"> <!ENTITY webrtcIndicatorButton.tooltip "Display sites you are currently sharing your camera or microphone with"> +#endif <!ENTITY mixedContentBlocked.moreinfo "Most websites will still work properly even when this content is blocked."> diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.properties b/application/palemoon/locales/en-US/chrome/browser/browser.properties index 5f75502ed..8b3fea4d5 100644 --- a/application/palemoon/locales/en-US/chrome/browser/browser.properties +++ b/application/palemoon/locales/en-US/chrome/browser/browser.properties @@ -220,6 +220,8 @@ tabHistory.goBack=Go back to this page tabHistory.goForward=Go forward to this page # URL Bar +urlbar.placeholder=Search or enter address +urlbar.placeholderURLOnly=Enter address pasteAndGo.label=Paste & Go # Block autorefresh diff --git a/application/palemoon/locales/en-US/chrome/overrides/netError.dtd b/application/palemoon/locales/en-US/chrome/overrides/netError.dtd index 3ed288d90..51aedb275 100644 --- a/application/palemoon/locales/en-US/chrome/overrides/netError.dtd +++ b/application/palemoon/locales/en-US/chrome/overrides/netError.dtd @@ -7,6 +7,8 @@ <!ENTITY loadError.label "Problem loading page"> <!ENTITY retry.label "Try Again"> +<!ENTITY returnToPreviousPage.label "Go Back"> +<!ENTITY advanced.label "Advanced"> <!-- Specific error messages --> @@ -14,7 +16,7 @@ <!ENTITY connectionFailure.longDesc "&sharedLongDesc;"> <!ENTITY deniedPortAccess.title "This address is restricted"> -<!ENTITY deniedPortAccess.longDesc "<p>The requested address specified a port (e.g. <q>palemoon.org:25</q> for port 25 on palemoon.org) normally used for purposes <em>other</em> than Web browsing. The browser has canceled the request for your protection and security.</p>"> +<!ENTITY deniedPortAccess.longDesc ""> <!ENTITY dnsNotFound.title "Server not found"> <!ENTITY dnsNotFound.longDesc " @@ -22,7 +24,7 @@ <li>Check the address for typing errors such as <strong>ww</strong>.example.com instead of <strong>www</strong>.example.com</li> - <li>If you are unable to load any pages, check your computer's network + <li>If you are unable to load any pages, check your computer’s network connection.</li> <li>If your computer or network is protected by a firewall or proxy, make sure that &brandShortName; is permitted to access the Web.</li> @@ -37,18 +39,32 @@ </ul> "> +<!ENTITY fileAccessDenied.title "Access to the file was denied"> +<!ENTITY fileAccessDenied.longDesc " +<ul> + <li>It may have been removed, moved, or file permissions may be preventing access.</li> +</ul> +"> <!ENTITY generic.title "Oops."> <!ENTITY generic.longDesc " -<p>&brandShortName; can't load this page for some reason.</p> +<p>&brandShortName; can’t load this page for some reason.</p> "> <!ENTITY malformedURI.title "The address isn't valid"> +<!ENTITY captivePortal.title "Login to network"> +<!ENTITY captivePortal.longDesc " +<p>This network may require you to login to access the internet.</p> +"> + +<!ENTITY openPortalLoginPage.label "Open Login Page"> + +<!ENTITY malformedURI.title "The address isn’t valid"> <!ENTITY malformedURI.longDesc " <ul> <li>Web addresses are usually written like <strong>http://www.example.com/</strong></li> - <li>Make sure that you're using forward slashes (i.e. + <li>Make sure that you’re using forward slashes (i.e. <strong>/</strong>).</li> </ul> "> @@ -57,7 +73,7 @@ <!ENTITY netInterrupt.longDesc "&sharedLongDesc;"> <!ENTITY notCached.title "Document Expired"> -<!ENTITY notCached.longDesc "<p>The requested document is not available in &brandShortName;'s cache.</p><ul><li>As a security precaution, &brandShortName; does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>"> +<!ENTITY notCached.longDesc "<p>The requested document is not available in &brandShortName;’s cache.</p><ul><li>As a security precaution, &brandShortName; does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>"> <!ENTITY netOffline.title "Offline mode"> <!ENTITY netOffline.longDesc2 " @@ -86,7 +102,7 @@ <!ENTITY netTimeout.title "The connection has timed out"> <!ENTITY netTimeout.longDesc "&sharedLongDesc;"> -<!ENTITY unknownProtocolFound.title "The address wasn't understood"> +<!ENTITY unknownProtocolFound.title "The address wasn’t understood"> <!ENTITY unknownProtocolFound.longDesc " <ul> <li>You might need to install other software to open this address.</li> @@ -112,7 +128,7 @@ </ul> "> -<!ENTITY redirectLoop.title "The page isn't redirecting properly"> +<!ENTITY redirectLoop.title "The page isn’t redirecting properly"> <!ENTITY redirectLoop.longDesc " <ul> <li>This problem can sometimes be caused by disabling or refusing to accept @@ -146,12 +162,17 @@ someone trying to impersonate the server.</li> be temporary, and you can try again later.</li> </ul> "> +<!ENTITY certerror.longpagetitle1 "Your connection is not secure"> +<!-- Localization note (certerror.introPara) - The text content of the span tag +will be replaced at runtime with the name of the server to which the user +was trying to connect. --> +<!ENTITY certerror.introPara "The owner of <span class='hostname'/> has configured their website improperly. To protect your information from being stolen, &brandShortName; has not connected to this website."> <!ENTITY sharedLongDesc " <ul> <li>The site could be temporarily unavailable or too busy. Try again in a few moments.</li> - <li>If you are unable to load any pages, check your computer's network + <li>If you are unable to load any pages, check your computer’s network connection.</li> <li>If your computer or network is protected by a firewall or proxy, make sure that &brandShortName; is permitted to access the Web.</li> @@ -186,6 +207,8 @@ be temporary, and you can try again later.</li> <!ENTITY corruptedContentError.title "Corrupted Content Error"> <!ENTITY corruptedContentError.longDesc "<p>The page you are trying to view cannot be shown because an error in the data transmission was detected.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>"> +<!ENTITY corruptedContentErrorv2.title "Corrupted Content Error"> +<!ENTITY corruptedContentErrorv2.longDesc "<p>The page you are trying to view cannot be shown because an error in the data transmission was detected.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>"> <!ENTITY securityOverride.linkText "Or you can add an exception…"> @@ -207,6 +230,7 @@ functionality specific to firefox. --> <!ENTITY errorReporting.title "Report this error"> <!ENTITY errorReporting.longDesc "Reporting the address and certificate information for <span id='hostname'></span> will help us identify and block malicious sites. Thanks for helping create a safer web!"> <!ENTITY errorReporting.automatic "Automatically report errors in the future"> +<!ENTITY errorReporting.automatic2 "Report errors like this to help Mozilla identify and block malicious sites"> <!ENTITY errorReporting.learnMore "Learn more…"> <!ENTITY errorReporting.sending "Sending report"> <!ENTITY errorReporting.sent "Report sent"> @@ -221,3 +245,33 @@ functionality specific to firefox. --> "ssl_error_unsupported_version". --> <!ENTITY sslv3Used.longDesc "Advanced info: ssl_error_unsupported_version"> <!ENTITY sslv3Used.learnMore "Learn More…"> +<!-- LOCALIZATION NOTE (sslv3Used.longDesc2) - Do not translate + "SSL_ERROR_UNSUPPORTED_VERSION". --> +<!ENTITY sslv3Used.longDesc2 "Advanced info: SSL_ERROR_UNSUPPORTED_VERSION"> + +<!ENTITY weakCryptoUsed.title "Your connection is not secure"> +<!-- LOCALIZATION NOTE (weakCryptoUsed.longDesc2) - Do not translate + "SSL_ERROR_NO_CYPHER_OVERLAP". --> +<!ENTITY weakCryptoUsed.longDesc2 "Advanced info: SSL_ERROR_NO_CYPHER_OVERLAP"> +<!ENTITY weakCryptoAdvanced.title "Advanced"> +<!ENTITY weakCryptoAdvanced.longDesc "<span class='hostname'></span> uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe."> +<!ENTITY weakCryptoAdvanced.override "(Not secure) Try loading <span class='hostname'></span> using outdated security"> + +<!-- LOCALIZATION NOTE (certerror.wrongSystemTime) - The <span id='..' /> tags will be injected with actual values, + please leave them unchanged. --> +<!ENTITY certerror.wrongSystemTime "<p>A secure connection to <span id='wrongSystemTime_URL'/> isn’t possible because your clock appears to show the wrong time.</p> <p>Your computer thinks it is <span id='wrongSystemTime_systemDate'/>. To fix this problem, change your date and time settings to match the correct time.</p>"> + +<!ENTITY certerror.pagetitle1 "Insecure Connection"> +<!ENTITY certerror.whatShouldIDo.badStsCertExplanation "This site uses HTTP +Strict Transport Security (HSTS) to specify that &brandShortName; may only connect +to it securely. As a result, it is not possible to add an exception for this +certificate."> +<!ENTITY certerror.copyToClipboard.label "Copy text to clipboard"> + +<!ENTITY inadequateSecurityError.title "Your connection is not secure"> +<!-- LOCALIZATION NOTE (inadequateSecurityError.longDesc) - Do not translate + "NS_ERROR_NET_INADEQUATE_SECURITY". --> +<!ENTITY inadequateSecurityError.longDesc "<p><span class='hostname'></span> uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe. The website administrator will need to fix the server first before you can visit the site.</p><p>Error code: NS_ERROR_NET_INADEQUATE_SECURITY</p>"> + +<!ENTITY prefReset.longDesc "It looks like your network security settings might be causing this. Do you want the default settings to be restored?"> +<!ENTITY prefReset.label "Restore default settings"> diff --git a/application/palemoon/locales/jar.mn b/application/palemoon/locales/jar.mn index 451a86ab7..6512c683e 100644 --- a/application/palemoon/locales/jar.mn +++ b/application/palemoon/locales/jar.mn @@ -16,7 +16,7 @@ locale/browser/syncProgress.dtd (%chrome/browser/syncProgress.dtd) locale/browser/aboutSyncTabs.dtd (%chrome/browser/aboutSyncTabs.dtd) #endif - locale/browser/browser.dtd (%chrome/browser/browser.dtd) +* locale/browser/browser.dtd (%chrome/browser/browser.dtd) locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd) locale/browser/charsetOverlay.dtd (%chrome/browser/charsetOverlay.dtd) locale/browser/browser.properties (%chrome/browser/browser.properties) diff --git a/application/palemoon/modules/QuotaManager.jsm b/application/palemoon/modules/QuotaManager.jsm index e03161a69..48cfe88b3 100644 --- a/application/palemoon/modules/QuotaManager.jsm +++ b/application/palemoon/modules/QuotaManager.jsm @@ -6,8 +6,9 @@ this.EXPORTED_SYMBOLS = ["QuotaManagerHelper"]; Components.utils.import('resource://gre/modules/Services.jsm'); -const Cc = Components.classes; const Ci = Components.interfaces; +const Cc = Components.classes; +const Cu = Components.utils; this.QuotaManagerHelper = { clear: function(isShutDown) { @@ -34,12 +35,17 @@ this.QuotaManagerHelper = { } } } - var qm = Cc["@mozilla.org/dom/quota/manager;1"].getService(Ci.nsIQuotaManager); + var qm = Cc["@mozilla.org/dom/quota-manager-service;1"] + .getService(Ci.nsIQuotaManagerService); for (var dom in doms) { var uri = Services.io.newURI(dom, null, null); - qm.clearStoragesForURI(uri); + let principal = Services.scriptSecurityManager + .createCodebasePrincipal(uri, {}); + qm.clearStoragesForPrincipal(principal); } } - } catch(er) {} + } catch(er) { + Cu.reportError(er); + } } }; diff --git a/application/palemoon/modules/WindowsPreviewPerTab.jsm b/application/palemoon/modules/WindowsPreviewPerTab.jsm index 41b38f0cf..e186bcad2 100644 --- a/application/palemoon/modules/WindowsPreviewPerTab.jsm +++ b/application/palemoon/modules/WindowsPreviewPerTab.jsm @@ -510,7 +510,14 @@ TabWindow.prototype = { // Previews are internally stored using a map, so we need to iterate over // the tabbrowser's array of tabs to retrieve previews in the same order. - let inorder = [previews.get(t) for (t of tabs) if (previews.has(t))]; + // Tycho: let inorder = [previews.get(t) for (t of tabs) if (previews.has(t))]; + let inorder = []; + + for (let t of tabs) { + if (previews.has(t)) { + inorder.push(previews.get(t)); + } + } // Since the internal taskbar array has not yet been updated, we must force // the sorting order of our local array on it. To do so, we must walk diff --git a/application/palemoon/modules/moz.build b/application/palemoon/modules/moz.build index b3459bcd5..7620b9862 100644 --- a/application/palemoon/modules/moz.build +++ b/application/palemoon/modules/moz.build @@ -19,10 +19,12 @@ EXTRA_JS_MODULES += [ 'PageMenu.jsm', 'PopupNotifications.jsm', 'QuotaManager.jsm', - 'SharedFrame.jsm', - 'webrtcUI.jsm' + 'SharedFrame.jsm' ] +if CONFIG['MOZ_WEBRTC']: + EXTRA_JS_MODULES += ['webrtcUI.jsm'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': EXTRA_JS_MODULES += [ 'Windows8WindowFrameColor.jsm', diff --git a/application/palemoon/components/shell/Makefile.in b/application/palemoon/moz.configure index df084b709..72236254f 100644 --- a/application/palemoon/components/shell/Makefile.in +++ b/application/palemoon/moz.configure @@ -1,11 +1,7 @@ -# +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: # 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/. -include $(topsrcdir)/config/rules.mk - -CXXFLAGS += $(TK_CFLAGS) - -clobber:: - rm -f $(DIST)/lib/$(LIBRARY_NAME).lib +include('../../toolkit/moz.configure') diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index 07e9dae9c..a396ea5fd 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -728,9 +728,11 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button { opacity: .4; } +%ifdef MOZ_WEBRTC #webrtc-status-button { -moz-image-region: rect(0px 192px 24px 168px); } +%endif /* 16px primary toolbar buttons */ toolbar[iconsize="small"] .toolbarbutton-1:not([type="menu-button"]) { @@ -812,7 +814,9 @@ toolbar[iconsize="small"] #downloads-button { -moz-image-region: rect(0px 16px 16px 0px); } +%ifdef MOZ_WEBRTC toolbar[iconsize="small"] #webrtc-status-button /* temporary placeholder (bug 824825) */, +%endif toolbar[iconsize="small"] #history-button, toolbar[iconsize="small"] #history-menu-button { -moz-image-region: rect(0px 32px 16px 16px); @@ -884,9 +888,11 @@ toolbar[iconsize="small"] #feed-button { -moz-image-region: rect(0px 112px 16px 96px); } +%ifdef MOZ_WEBRTC toolbar[iconsize="small"] #webrtc-status-button { -moz-image-region: rect(0px 128px 16px 112px); } +%endif /* Fullscreen window controls */ #window-controls { @@ -1226,10 +1232,12 @@ toolbar[iconsize="small"] #webrtc-status-button { list-style-image: url(chrome://browser/skin/mixed-content-blocked-64.png); } +%ifdef MOZ_WEBRTC .popup-notification-icon[popupid="webRTC-sharingDevices"], .popup-notification-icon[popupid="webRTC-shareDevices"] { list-style-image: url(chrome://browser/skin/webRTC-shareDevice-64.png); } +%endif .popup-notification-icon[popupid="pointerLock"] { list-style-image: url(chrome://browser/skin/pointerLock-64.png); @@ -1352,6 +1360,7 @@ toolbar[iconsize="small"] #webrtc-status-button { list-style-image: url(chrome://browser/skin/mixed-content-blocked-16.png); } +%ifdef MOZ_WEBRTC .webRTC-shareDevices-notification-icon, #webRTC-shareDevices-notification-icon { list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png); @@ -1361,6 +1370,7 @@ toolbar[iconsize="small"] #webrtc-status-button { #webRTC-sharingDevices-notification-icon { list-style-image: url(chrome://browser/skin/webRTC-sharingDevice-16.png); } +%endif .web-notifications-notification-icon, #web-notifications-notification-icon { @@ -2083,8 +2093,8 @@ toolbar[mode="text"] toolbarbutton.chevron > .toolbarbutton-icon { } %ifdef MOZ_DEVTOOLS -%include ../../../toolkit/themes/shared/devtools/responsivedesign.inc.css -%include ../../../toolkit/themes/shared/devtools/commandline.inc.css +%include ../../../../devtools/client/themes/responsivedesign.inc.css +%include ../../../../devtools/client/themes/commandline.inc.css %endif %include ../shared/plugin-doorhanger.inc.css diff --git a/application/palemoon/themes/linux/jar.mn b/application/palemoon/themes/linux/jar.mn index a756edbc3..44d837778 100644 --- a/application/palemoon/themes/linux/jar.mn +++ b/application/palemoon/themes/linux/jar.mn @@ -53,9 +53,11 @@ browser.jar: skin/classic/browser/Toolbar.png skin/classic/browser/Toolbar-small.png skin/classic/browser/urlbar-arrow.png +#ifdef MOZ_WEBRTC skin/classic/browser/webRTC-shareDevice-16.png skin/classic/browser/webRTC-shareDevice-64.png skin/classic/browser/webRTC-sharingDevice-16.png +#endif skin/classic/browser/downloads/buttons.png (downloads/buttons.png) skin/classic/browser/downloads/download-glow.png (downloads/download-glow.png) skin/classic/browser/downloads/download-glow-small.png (downloads/download-glow-small.png) diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index 58348a408..aa5918bab 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -801,10 +801,11 @@ toolbar[brighttext] #bookmarks-menu-button.bookmark-item { -moz-image-region: rect(0, 342px, 18px, 324px); } +%ifdef MOZ_WEBRTC #webrtc-status-button { -moz-image-region: rect(0, 360px, 18px, 342px); } - +%endif /* ::::: fullscreen window controls ::::: */ @@ -1955,11 +1956,13 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/mixed-content-blocked-64.png); } +%ifdef MOZ_WEBRTC .popup-notification-icon[popupid="webRTC-sharingDevices"], .popup-notification-icon[popupid="webRTC-shareDevices"] { list-style-image: url(chrome://browser/skin/webRTC-shareDevice-64.png); } +%endif .popup-notification-icon[popupid="pointerLock"] { list-style-image: url(chrome://browser/skin/pointerLock-64.png); } @@ -2079,6 +2082,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/mixed-content-blocked-16.png); } +%ifdef MOZ_WEBRTC .webRTC-shareDevices-notification-icon, #webRTC-shareDevices-notification-icon { list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png); @@ -2088,6 +2092,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { #webRTC-sharingDevices-notification-icon { list-style-image: url(chrome://browser/skin/webRTC-sharingDevice-16.png); } +%endif .web-notifications-notification-icon, #web-notifications-notification-icon { @@ -2383,8 +2388,8 @@ toolbar[brighttext] #addonbar-closebutton { } %ifdef MOZ_DEVTOOLS -%include ../../../toolkit/themes/shared/devtools/responsivedesign.inc.css -%include ../../../toolkit/themes/shared/devtools/commandline.inc.css +%include ../../../../devtools/client/themes/responsivedesign.inc.css +%include ../../../../devtools/client/themes/commandline.inc.css %endif %include ../shared/plugin-doorhanger.inc.css diff --git a/application/palemoon/themes/osx/jar.mn b/application/palemoon/themes/osx/jar.mn index 00575bac8..8742f1b87 100644 --- a/application/palemoon/themes/osx/jar.mn +++ b/application/palemoon/themes/osx/jar.mn @@ -72,9 +72,11 @@ browser.jar: skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png) skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png) skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png) +#ifdef MOZ_WEBRTC skin/classic/browser/webRTC-shareDevice-16.png skin/classic/browser/webRTC-shareDevice-64.png skin/classic/browser/webRTC-sharingDevice-16.png +#endif skin/classic/browser/downloads/buttons.png (downloads/buttons.png) skin/classic/browser/downloads/download-glow.png (downloads/download-glow.png) skin/classic/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png) diff --git a/application/palemoon/themes/osx/shared.inc b/application/palemoon/themes/osx/shared.inc index 2e8a8f269..ef27746a3 100644 --- a/application/palemoon/themes/osx/shared.inc +++ b/application/palemoon/themes/osx/shared.inc @@ -1,4 +1,4 @@ -%include ../../../toolkit/themes/osx/global/shared.inc
+%include ../../../../toolkit/themes/osx/global/shared.inc
%include ../shared/browser.inc
%define hudButton -moz-appearance: none; color: #434343; border-radius: 4px; border: 1px solid #b5b5b5; background: linear-gradient(#fff, #f2f2f2); box-shadow: inset 0 1px rgba(255,255,255,.8), inset 0 0 1px rgba(255,255, 255,.25), 0 1px rgba(255,255,255,.3); background-clip: padding-box; background-origin: padding-box; padding: 2px 6px;
diff --git a/application/palemoon/themes/shared/browser.inc b/application/palemoon/themes/shared/browser.inc index cd17903ce..18e69ad43 100644 --- a/application/palemoon/themes/shared/browser.inc +++ b/application/palemoon/themes/shared/browser.inc @@ -1,3 +1,8 @@ %filter substitution +%ifndef MOZ_WEBRTC +%define primaryToolbarButtons #back-button, #forward-button, #reload-button, #stop-button, #home-button, #print-button, #downloads-button, #downloads-indicator, #history-button, #history-menu-button, #bookmarks-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-in-button, #sync-button, #feed-button, #alltabs-button +%else %define primaryToolbarButtons #back-button, #forward-button, #reload-button, #stop-button, #home-button, #print-button, #downloads-button, #downloads-indicator, #history-button, #history-menu-button, #bookmarks-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-in-button, #sync-button, #feed-button, #alltabs-button, #webrtc-status-button +%endif + diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 7c837764d..3e8c63af4 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -1192,10 +1192,11 @@ toolbar[brighttext] #bookmarks-menu-button.bookmark-item { -moz-image-region: rect(0, 342px, 18px, 324px); } +%ifdef MOZ_WEBRTC #webrtc-status-button { -moz-image-region: rect(0, 360px, 18px, 342px); } - +%endif /* ::::: fullscreen window controls ::::: */ @@ -2443,10 +2444,12 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/mixed-content-blocked-64.png); } +%ifdef MOZ_WEBRTC .popup-notification-icon[popupid="webRTC-sharingDevices"], .popup-notification-icon[popupid="webRTC-shareDevices"] { list-style-image: url(chrome://browser/skin/webRTC-shareDevice-64.png); } +%endif .popup-notification-icon[popupid="pointerLock"] { list-style-image: url(chrome://browser/skin/pointerLock-64.png); @@ -2567,6 +2570,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/mixed-content-blocked-16.png); } +%ifdef MOZ_WEBRTC .webRTC-shareDevices-notification-icon, #webRTC-shareDevices-notification-icon { list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png); @@ -2576,6 +2580,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { #webRTC-sharingDevices-notification-icon { list-style-image: url(chrome://browser/skin/webRTC-sharingDevice-16.png); } +%endif .web-notifications-notification-icon, #web-notifications-notification-icon { @@ -2858,8 +2863,8 @@ toolbar[brighttext] #addonbar-closebutton { } %ifdef MOZ_DEVTOOLS -%include ../../../toolkit/themes/shared/devtools/responsivedesign.inc.css -%include ../../../toolkit/themes/shared/devtools/commandline.inc.css +%include ../../../../devtools/client/themes/responsivedesign.inc.css +%include ../../../../devtools/client/themes/commandline.inc.css %endif %include ../shared/plugin-doorhanger.inc.css diff --git a/application/palemoon/themes/windows/jar.mn b/application/palemoon/themes/windows/jar.mn index 1c1f139de..994e87be3 100644 --- a/application/palemoon/themes/windows/jar.mn +++ b/application/palemoon/themes/windows/jar.mn @@ -74,9 +74,11 @@ browser.jar: skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png) skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png) skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png) +#ifdef MOZ_WEBRTC skin/classic/browser/webRTC-shareDevice-16.png skin/classic/browser/webRTC-shareDevice-64.png skin/classic/browser/webRTC-sharingDevice-16.png +#endif skin/classic/browser/downloads/buttons.png (downloads/buttons.png) skin/classic/browser/downloads/download-glow.png (downloads/download-glow.png) skin/classic/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png) @@ -98,7 +100,7 @@ browser.jar: skin/classic/browser/newtab/controls.png (newtab/controls.png) skin/classic/browser/newtab/noise.png (newtab/noise.png) skin/classic/browser/places/places.css (places/places.css) - skin/classic/browser/places/organizer.css (places/organizer.css) +* skin/classic/browser/places/organizer.css (places/organizer.css) skin/classic/browser/places/editBookmark.png (places/editBookmark.png) skin/classic/browser/places/bookmark.png (places/bookmark.png) skin/classic/browser/places/query.png (places/query.png) |