Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 449b275

Browse files
committed
Bug 513742: Remove support for DDE from toolkit. r=jimm
Differential Revision: https://phabricator.services.mozilla.com/D19075 --HG-- extra : source : 4ef3cc37f719d02443a2058192fdb4c61d3e3dca
1 parent 3a2c94b commit 449b275

File tree

6 files changed

+37
-987
lines changed

6 files changed

+37
-987
lines changed

toolkit/xre/nsAppRunner.cpp

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -425,70 +425,6 @@ static ArgResult CheckArgExists(const char* aArg) {
425425
return CheckArg(aArg, nullptr, CheckArgFlag::None);
426426
}
427427

428-
#if defined(XP_WIN)
429-
/**
430-
* Check for a commandline flag from the windows shell and remove it from the
431-
* argv used when restarting. Flags MUST be in the form -arg.
432-
*
433-
* @param aArg the parameter to check. Must be lowercase.
434-
*/
435-
static ArgResult CheckArgShell(const char* aArg) {
436-
char** curarg = gRestartArgv + 1; // skip argv[0]
437-
438-
while (*curarg) {
439-
char* arg = curarg[0];
440-
441-
if (arg[0] == '-') {
442-
++arg;
443-
444-
if (strimatch(aArg, arg)) {
445-
do {
446-
*curarg = *(curarg + 1);
447-
++curarg;
448-
} while (*curarg);
449-
450-
--gRestartArgc;
451-
452-
return ARG_FOUND;
453-
}
454-
}
455-
456-
++curarg;
457-
}
458-
459-
return ARG_NONE;
460-
}
461-
462-
/**
463-
* Enabled Native App Support to process DDE messages when the app needs to
464-
* restart and the app has been launched by the Windows shell to open an url.
465-
* When aWait is false this will process the DDE events manually. This prevents
466-
* Windows from displaying an error message due to the DDE message not being
467-
* acknowledged.
468-
*/
469-
static void ProcessDDE(nsINativeAppSupport* aNative, bool aWait) {
470-
// When the app is launched by the windows shell the windows shell
471-
// expects the app to be available for DDE messages and if it isn't
472-
// windows displays an error dialog. To prevent the error the DDE server
473-
// is enabled and pending events are processed when the app needs to
474-
// restart after it was launched by the shell with the requestpending
475-
// argument. The requestpending pending argument is removed to
476-
// differentiate it from being launched when an app restart is not
477-
// required.
478-
ArgResult ar;
479-
ar = CheckArgShell("requestpending");
480-
if (ar == ARG_FOUND) {
481-
aNative->Enable(); // enable win32 DDE responses
482-
if (aWait) {
483-
// This is just a guesstimate based on testing different values.
484-
// If count is 8 or less windows will display an error dialog.
485-
int32_t count = 20;
486-
SpinEventLoopUntil([&]() { return --count < 0; });
487-
}
488-
}
489-
}
490-
#endif
491-
492428
bool gSafeMode = false;
493429

494430
/**
@@ -1644,7 +1580,7 @@ static void SetupLauncherProcessPref() {
16441580
// it was initially started with.
16451581
static nsresult LaunchChild(nsINativeAppSupport* aNative,
16461582
bool aBlankCommandLine = false) {
1647-
aNative->Quit(); // release DDE mutex, if we're holding it
1583+
aNative->Quit(); // destroy message window
16481584

16491585
// Restart this process by exec'ing it into the current process
16501586
// if supported by the platform. Otherwise, use NSPR.
@@ -1913,12 +1849,6 @@ static ReturnAbortOnError ShowProfileManager(
19131849
true);
19141850
#endif
19151851

1916-
#ifdef XP_WIN
1917-
// we don't have to wait here because profile manager window will pump
1918-
// and DDE message will be handled
1919-
ProcessDDE(aNative, false);
1920-
#endif
1921-
19221852
{ // extra scoping is needed so we release these components before xpcom
19231853
// shutdown
19241854
nsCOMPtr<nsIWindowWatcher> windowWatcher(

toolkit/xre/nsINativeAppSupport.idl

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
/* nsINativeAppSupport
99
*
1010
* This "pseudo" (in the XPCOM sense) interface provides for
11-
* platform-specific general application support:
12-
* o It manages the details of the simple DDE communication
13-
* supported on the Win32 platform (it is the addition of this
14-
* item that prompted the creation of this interface.
11+
* platform-specific general application support
1512
*
1613
* Due to the nature of the beast, this interface is not a full-blown
1714
* XPCOM component. The primary reason is that objects that implement
@@ -39,50 +36,9 @@
3936
* PR_FALSE and nsresult==NS_OK. This means that
4037
* the command line arguments have been
4138
* successfully passed to the instance of the
42-
* application acting as a DDE server.
43-
*
44-
* stop - You call this to inform the native app support that the
45-
* application *wishes* to terminate. If the returned boolean
46-
* value is PR_FALSE, then the application should continue
47-
* (as if there were still additional top-level windows open).
48-
*
49-
* Win32 Note: If this is the instance of the application
50-
* acting as the DDE server, and there are current
51-
* DDE conversations active with other instances
52-
* acting as DDE clients, then this function will
53-
* return PR_FALSE.
54-
*
55-
* quit - Like Stop, but this method *forces* termination (or more
56-
* precisely, indicates that the application is about to be
57-
* terminated regardless of what a call to Stop might have
58-
* returned.
59-
*
60-
* This method is intended to be called when the user selects
61-
* the "Quit" option (close all windows and exit).
62-
*
63-
* Win32 Note: Stop is problematic in the case of "Quit" (close
64-
* all windows and exit the application) because
65-
* either we don't Quit or (potentially) we lose
66-
* requests coming from other instances of the
67-
* application. The strategy is to give preference
68-
* to the user's explicit Quit request. In the
69-
* unlikely event that a request is pending from
70-
* another instance of the application, then such
71-
* requests are essentially ignored. This is
72-
* roughly equivalent to handling that request by
73-
* opening a new window, followed by immediately
74-
* closing it. Since this is the same as if the
75-
* request came in immediately before the Quit
76-
* call (versus immediately after it), no harm.
77-
*
78-
* There is an exposure here: Upon return from this
79-
* function, any DDE connect request (for Mozilla)
80-
* will fail and other instances of the application
81-
* will start up as a DDE server. In that case,
82-
* those instances may do things that conflict with
83-
* the subsequent shutting down of the instance that
84-
* is quitting. For this reason, the call to Quit
85-
* should be deferred as long as possible.
39+
* application acting as a remote server.
40+
* quit - Informs the native app support that the application is stopping. The
41+
* app support should disable any functionality enabled by start.
8642
*
8743
* onLastWindowClosing - Called when the last window is closed. Used as a
8844
* "soft" shutdown, passwords are flushed.
@@ -95,7 +51,6 @@ interface nsINativeAppSupport : nsISupports {
9551
// Startup/shutdown.
9652
boolean start();
9753
void enable();
98-
boolean stop();
9954
void quit();
10055

10156
void onLastWindowClosing();

toolkit/xre/nsNativeAppSupportBase.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ nsNativeAppSupportBase::Start(bool *result) {
2121
NS_IMETHODIMP
2222
nsNativeAppSupportBase::Enable() { return NS_OK; }
2323

24-
// Stop answer defaults to OK.
25-
NS_IMETHODIMP
26-
nsNativeAppSupportBase::Stop(bool *result) {
27-
*result = true;
28-
return NS_OK;
29-
}
30-
3124
NS_IMETHODIMP
3225
nsNativeAppSupportBase::Quit() { return NS_OK; }
3326

toolkit/xre/nsNativeAppSupportUnix.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ class nsNativeAppSupportUnix : public nsNativeAppSupportBase {
135135
void DisconnectFromSM();
136136
#endif
137137
NS_IMETHOD Start(bool *aRetVal) override;
138-
NS_IMETHOD Stop(bool *aResult) override;
139138
NS_IMETHOD Enable() override;
140139

141140
private:
@@ -651,13 +650,6 @@ nsNativeAppSupportUnix::Start(bool *aRetVal) {
651650
return NS_OK;
652651
}
653652

654-
NS_IMETHODIMP
655-
nsNativeAppSupportUnix::Stop(bool *aResult) {
656-
NS_ENSURE_ARG(aResult);
657-
*aResult = true;
658-
return NS_OK;
659-
}
660-
661653
NS_IMETHODIMP
662654
nsNativeAppSupportUnix::Enable() { return NS_OK; }
663655

0 commit comments

Comments
 (0)