gecko-dev/browser/components/shell/nsWindowsShellService.h
Nicholas Rishel c66a319ced Bug 1917674 - Part 2: Ensure shell service native interface members are present on ShellService. r=nalexander
A quirk of the JavaScript implementation of XPCOM's QueryInterface is that it loads the interface's functions onto the queried object. For Services like `ShellService` this creates situations where the interface can be initialized at a distance, causing races depending on how Firefox is run - e.g. Desktop vs Background Task. To ensure consistent behavior this patch forces `ShellService` initialization of the native interface so that the native functions are always present.

To accomplish this, `nsIWindowsShellService` has been modified to inherit from `nsIShellService` to match other platforms and ensure that querying it also loads the `nsIShellService` members into `shellService`.

Differential Revision: https://phabricator.services.mozilla.com/D222154
2024-09-13 17:38:50 +00:00

34 lines
977 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 nswindowsshellservice_h____
#define nswindowsshellservice_h____
#include "nscore.h"
#include "nsString.h"
#include "nsToolkitShellService.h"
#include "nsIShellService.h"
#include "nsIWindowsShellService.h"
#include <windows.h>
#include <ole2.h>
class nsWindowsShellService : public nsToolkitShellService,
public nsIWindowsShellService {
virtual ~nsWindowsShellService();
public:
nsWindowsShellService();
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
NS_DECL_NSIWINDOWSSHELLSERVICE
protected:
nsresult LaunchControlPanelDefaultsSelectionUI();
nsresult LaunchModernSettingsDialogDefaultApps();
};
#endif // nswindowsshellservice_h____