mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 933099: Banish <windows.h> from nsGlobalWindow.cpp. r=bz
This commit is contained in:
parent
14e2871a63
commit
50ee3b3331
@ -56,6 +56,7 @@
|
||||
#include "mozilla/dom/workers/Workers.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Debug.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
|
||||
// Interfaces Needed
|
||||
@ -64,19 +65,7 @@
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIWidgetListener.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsDeviceSensors.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Thanks so much, Microsoft and the people who pull in windows.h via
|
||||
// random silly headers! :(
|
||||
#ifdef GetClassName
|
||||
#undef GetClassName
|
||||
#endif // GetClassName
|
||||
#ifdef CreateEvent
|
||||
#undef CreateEvent
|
||||
#endif
|
||||
#endif // XP_WIN
|
||||
|
||||
#include "nsIDeviceSensors.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocCharset.h"
|
||||
@ -219,7 +208,7 @@
|
||||
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "nsITabChild.h"
|
||||
#include "nsIDOMMediaQueryList.h"
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
@ -5679,9 +5668,7 @@ nsGlobalWindow::Dump(const nsAString& aStr)
|
||||
|
||||
if (cstr) {
|
||||
#ifdef XP_WIN
|
||||
if (IsDebuggerPresent()) {
|
||||
OutputDebugStringA(cstr);
|
||||
}
|
||||
PrintToDebugger(cstr);
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
__android_log_write(ANDROID_LOG_INFO, "GeckoDump", cstr);
|
||||
@ -6228,7 +6215,7 @@ nsGlobalWindow::Focus(ErrorResult& aError)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (TabChild *child = TabChild::GetFrom(this)) {
|
||||
if (nsCOMPtr<nsITabChild> child = do_GetInterface(mDocShell)) {
|
||||
child->SendRequestFocus(canFocus);
|
||||
return;
|
||||
}
|
||||
@ -12564,13 +12551,13 @@ nsGlobalWindow::SetHasGamepadEventListener(bool aHasGamepad/* = true*/)
|
||||
void
|
||||
nsGlobalWindow::EnableTimeChangeNotifications()
|
||||
{
|
||||
nsSystemTimeChangeObserver::AddWindowListener(this);
|
||||
mozilla::time::AddWindowListener(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::DisableTimeChangeNotifications()
|
||||
{
|
||||
nsSystemTimeChangeObserver::RemoveWindowListener(this);
|
||||
mozilla::time::RemoveWindowListener(this);
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
@ -13212,3 +13199,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
||||
#undef BEFOREUNLOAD_EVENT
|
||||
#undef ERROR_EVENT
|
||||
#undef EVENT
|
||||
|
||||
#ifdef _WINDOWS_
|
||||
#error "Never include windows.h in this file!"
|
||||
#endif
|
||||
|
@ -6,10 +6,11 @@
|
||||
#include "domstubs.idl"
|
||||
interface nsIContentFrameMessageManager;
|
||||
|
||||
// Sole purpose is to be able to identify the concrete class nsTabChild
|
||||
[uuid(bf1eddf9-731b-4a4b-bd65-9a712a892832)]
|
||||
[uuid( 60146bc6-31d8-450b-a9eb-4000b6403d5c)]
|
||||
interface nsITabChild : nsISupports
|
||||
{
|
||||
readonly attribute nsIContentFrameMessageManager messageManager;
|
||||
|
||||
[notxpcom] void sendRequestFocus(in boolean canFocus);
|
||||
};
|
||||
|
||||
|
@ -71,6 +71,10 @@
|
||||
#include "nsILoadContext.h"
|
||||
#include "ipc/nsGUIEventIPC.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
#endif /* DEBUG */
|
||||
|
||||
#define BROWSER_ELEMENT_CHILD_SCRIPT \
|
||||
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
|
||||
|
||||
@ -1141,6 +1145,20 @@ TabChild::ArraysToParams(const InfallibleTArray<int>& aIntParams,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PContentPermissionRequestChild*
|
||||
TabChild:: SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
||||
const nsCString& aType,
|
||||
const nsCString& aAccess,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
||||
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
|
||||
child->mIPCOpen = true;
|
||||
return request;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
void
|
||||
TabChild::DestroyWindow()
|
||||
{
|
||||
@ -2359,6 +2377,12 @@ TabChild::GetMessageManager(nsIContentFrameMessageManager** aResult)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
TabChild::SendRequestFocus(bool aCanFocus)
|
||||
{
|
||||
PBrowserChild::SendRequestFocus(aCanFocus);
|
||||
}
|
||||
|
||||
PIndexedDBChild*
|
||||
TabChild::AllocPIndexedDBChild(
|
||||
const nsCString& aGroup,
|
||||
|
@ -8,9 +8,6 @@
|
||||
#define mozilla_dom_TabChild_h
|
||||
|
||||
#include "mozilla/dom/PBrowserChild.h"
|
||||
#ifdef DEBUG
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
#endif /* DEBUG */
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -270,16 +267,11 @@ public:
|
||||
nsIDialogParamBlock* aParams);
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual PContentPermissionRequestChild* SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
||||
const nsCString& aType,
|
||||
const nsCString& aAccess,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
||||
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
|
||||
child->mIPCOpen = true;
|
||||
return request;
|
||||
}
|
||||
virtual PContentPermissionRequestChild*
|
||||
SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
||||
const nsCString& aType,
|
||||
const nsCString& aAccess,
|
||||
const IPC::Principal& aPrincipal);
|
||||
#endif /* DEBUG */
|
||||
|
||||
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const nsCString& aType,
|
||||
|
@ -18,12 +18,6 @@
|
||||
#include "mozilla/HalSensor.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#define NS_DEVICE_SENSORS_CID \
|
||||
{ 0xecba5203, 0x77da, 0x465a, \
|
||||
{ 0x86, 0x5e, 0x78, 0xb7, 0xaf, 0x10, 0xd8, 0xf7 } }
|
||||
|
||||
#define NS_DEVICE_SENSORS_CONTRACTID "@mozilla.org/devicesensors;1"
|
||||
|
||||
class nsIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -4,6 +4,11 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "TimeChangeObserver.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "mozilla/HalTypes.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
@ -17,6 +22,30 @@ using namespace mozilla;
|
||||
using namespace mozilla::hal;
|
||||
using namespace mozilla::services;
|
||||
|
||||
class nsSystemTimeChangeObserver : public SystemClockChangeObserver,
|
||||
public SystemTimezoneChangeObserver
|
||||
{
|
||||
typedef nsTObserverArray<nsWeakPtr> ListenerArray;
|
||||
public:
|
||||
static nsSystemTimeChangeObserver* GetInstance();
|
||||
virtual ~nsSystemTimeChangeObserver();
|
||||
|
||||
// Implementing hal::SystemClockChangeObserver::Notify()
|
||||
void Notify(const int64_t& aClockDeltaMS);
|
||||
|
||||
// Implementing hal::SystemTimezoneChangeObserver::Notify()
|
||||
void Notify(
|
||||
const mozilla::hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
|
||||
|
||||
nsresult AddWindowListenerImpl(nsPIDOMWindow* aWindow);
|
||||
nsresult RemoveWindowListenerImpl(nsPIDOMWindow* aWindow);
|
||||
|
||||
private:
|
||||
nsSystemTimeChangeObserver() { };
|
||||
ListenerArray mWindowListeners;
|
||||
void FireMozTimeChangeEvent();
|
||||
};
|
||||
|
||||
StaticAutoPtr<nsSystemTimeChangeObserver> sObserver;
|
||||
|
||||
nsSystemTimeChangeObserver* nsSystemTimeChangeObserver::GetInstance()
|
||||
@ -79,9 +108,9 @@ nsSystemTimeChangeObserver::Notify(
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemTimeChangeObserver::AddWindowListener(nsPIDOMWindow* aWindow)
|
||||
mozilla::time::AddWindowListener(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
return GetInstance()->AddWindowListenerImpl(aWindow);
|
||||
return nsSystemTimeChangeObserver::GetInstance()->AddWindowListenerImpl(aWindow);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -116,13 +145,13 @@ nsSystemTimeChangeObserver::AddWindowListenerImpl(nsPIDOMWindow* aWindow)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemTimeChangeObserver::RemoveWindowListener(nsPIDOMWindow* aWindow)
|
||||
mozilla::time::RemoveWindowListener(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
if (!sObserver) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetInstance()->RemoveWindowListenerImpl(aWindow);
|
||||
return nsSystemTimeChangeObserver::GetInstance()->RemoveWindowListenerImpl(aWindow);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -6,39 +6,17 @@
|
||||
#ifndef _mozilla_time_change_observer_h_
|
||||
#define _mozilla_time_change_observer_h_
|
||||
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "mozilla/HalTypes.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nscore.h"
|
||||
|
||||
typedef mozilla::Observer<int64_t> SystemClockChangeObserver;
|
||||
typedef mozilla::Observer<mozilla::hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
|
||||
class nsPIDOMWindow;
|
||||
|
||||
class nsSystemTimeChangeObserver : public SystemClockChangeObserver,
|
||||
public SystemTimezoneChangeObserver
|
||||
{
|
||||
typedef nsTObserverArray<nsWeakPtr> ListenerArray;
|
||||
public:
|
||||
static nsSystemTimeChangeObserver* GetInstance();
|
||||
virtual ~nsSystemTimeChangeObserver();
|
||||
namespace mozilla {
|
||||
namespace time {
|
||||
|
||||
// Implementing hal::SystemClockChangeObserver::Notify()
|
||||
void Notify(const int64_t& aClockDeltaMS);
|
||||
nsresult AddWindowListener(nsPIDOMWindow* aWindow);
|
||||
nsresult RemoveWindowListener(nsPIDOMWindow* aWindow);
|
||||
|
||||
// Implementing hal::SystemTimezoneChangeObserver::Notify()
|
||||
void Notify(
|
||||
const mozilla::hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
|
||||
|
||||
static nsresult AddWindowListener(nsPIDOMWindow* aWindow);
|
||||
static nsresult RemoveWindowListener(nsPIDOMWindow* aWindow);
|
||||
private:
|
||||
nsresult AddWindowListenerImpl(nsPIDOMWindow* aWindow);
|
||||
nsresult RemoveWindowListenerImpl(nsPIDOMWindow* aWindow);
|
||||
nsSystemTimeChangeObserver() { };
|
||||
ListenerArray mWindowListeners;
|
||||
void FireMozTimeChangeEvent();
|
||||
};
|
||||
} // namespace time
|
||||
} // namespace mozilla
|
||||
|
||||
#endif //_mozilla_time_change_observer_h_
|
||||
|
21
xpcom/base/Debug.cpp
Normal file
21
xpcom/base/Debug.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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 "mozilla/Debug.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
||||
void mozilla::PrintToDebugger(const char* aStr)
|
||||
{
|
||||
if (::IsDebuggerPresent()) {
|
||||
::OutputDebugStringA(aStr);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
20
xpcom/base/Debug.h
Normal file
20
xpcom/base/Debug.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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 mozilla_Debug_h__
|
||||
#define mozilla_Debug_h__
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
||||
// Print aStr to a debugger if the debugger is attached.
|
||||
void PrintToDebugger(const char* aStr);
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_Debug_h__
|
@ -75,6 +75,7 @@ EXPORTS.mozilla += [
|
||||
'AvailableMemoryTracker.h',
|
||||
'ClearOnShutdown.h',
|
||||
'CycleCollectedJSRuntime.h',
|
||||
'Debug.h',
|
||||
'nsMemoryInfoDumper.h',
|
||||
'StackWalk.h',
|
||||
'StaticMutex.h',
|
||||
@ -91,6 +92,7 @@ SOURCES += [
|
||||
'AvailableMemoryTracker.cpp',
|
||||
'ClearOnShutdown.cpp',
|
||||
'CycleCollectedJSRuntime.cpp',
|
||||
'Debug.cpp',
|
||||
'nsConsoleMessage.cpp',
|
||||
'nsConsoleService.cpp',
|
||||
'nsCycleCollector.cpp',
|
||||
|
@ -39,3 +39,13 @@ interface nsIDeviceSensors : nsISupports
|
||||
[noscript] void removeWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
|
||||
[noscript] void removeWindowAsListener(in nsIDOMWindow aWindow);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_DEVICE_SENSORS_CID \
|
||||
{ 0xecba5203, 0x77da, 0x465a, \
|
||||
{ 0x86, 0x5e, 0x78, 0xb7, 0xaf, 0x10, 0xd8, 0xf7 } }
|
||||
|
||||
#define NS_DEVICE_SENSORS_CONTRACTID "@mozilla.org/devicesensors;1"
|
||||
|
||||
%}
|
||||
|
Loading…
Reference in New Issue
Block a user