From f3657739555609b568fa5b16ffe19c73c9c9c32a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 31 Oct 2013 22:07:10 -0400 Subject: [PATCH] Bug 932421. Stop including windows.h (via Hal.h) in Screen.h, so we don't screw up our bindings code. r=smaug Also stops Hal.h bootlegging Observer.h. --- dom/base/nsGlobalWindow.cpp | 22 +++++++++++---------- dom/base/nsScreen.h | 2 +- dom/ipc/PCOMContentPermissionRequestChild.h | 2 ++ hal/Hal.h | 6 ++---- hal/HalScreenConfiguration.h | 20 +++++++++++++++++++ hal/moz.build | 1 + 6 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 hal/HalScreenConfiguration.h diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 1c8e829a48a5..79e3c69f010a 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -36,16 +36,6 @@ #include "nsIScriptTimeoutHandler.h" #include "nsIController.h" -#ifdef XP_WIN -// Thanks so much, Microsoft! :( -#ifdef GetClassName -#undef GetClassName -#endif // GetClassName -#ifdef CreateEvent -#undef CreateEvent -#endif -#endif // XP_WIN - // Helper Classes #include "nsJSUtils.h" #include "jsapi.h" // for JSAutoRequest @@ -75,6 +65,18 @@ #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 "nsIContent.h" #include "nsIDocShell.h" #include "nsIDocCharset.h" diff --git a/dom/base/nsScreen.h b/dom/base/nsScreen.h index 1837e44d12c4..47f19c913e66 100644 --- a/dom/base/nsScreen.h +++ b/dom/base/nsScreen.h @@ -8,7 +8,7 @@ #include "mozilla/Attributes.h" #include "mozilla/dom/ScreenOrientation.h" #include "mozilla/ErrorResult.h" -#include "mozilla/Hal.h" +#include "mozilla/HalScreenConfiguration.h" #include "nsIDOMScreen.h" #include "nsCOMPtr.h" #include "nsDOMEventTargetHelper.h" diff --git a/dom/ipc/PCOMContentPermissionRequestChild.h b/dom/ipc/PCOMContentPermissionRequestChild.h index de797364470b..9b8f87a63fd2 100644 --- a/dom/ipc/PCOMContentPermissionRequestChild.h +++ b/dom/ipc/PCOMContentPermissionRequestChild.h @@ -7,6 +7,8 @@ #include "mozilla/dom/PContentPermissionRequestChild.h" // Microsoft's API Name hackery sucks +// XXXbz Doing this in a header is a gigantic footgun. See +// https://bugzilla.mozilla.org/show_bug.cgi?id=932421#c3 for why. #undef CreateEvent /* diff --git a/hal/Hal.h b/hal/Hal.h index 640cc98e71c1..50932bdcaf30 100644 --- a/hal/Hal.h +++ b/hal/Hal.h @@ -10,6 +10,7 @@ #include "mozilla/hal_sandbox/PHal.h" #include "mozilla/HalTypes.h" #include "base/basictypes.h" +#include "mozilla/Observer.h" #include "mozilla/Types.h" #include "nsTArray.h" #include "prlog.h" @@ -18,6 +19,7 @@ #include "mozilla/dom/power/Types.h" #include "mozilla/hal_sandbox/PHal.h" #include "mozilla/dom/ScreenOrientation.h" +#include "mozilla/HalScreenConfiguration.h" /* * Hal.h contains the public Hal API. @@ -38,13 +40,9 @@ class nsIDOMWindow; namespace mozilla { -template -class Observer; - namespace hal { typedef Observer AlarmObserver; -typedef Observer ScreenConfigurationObserver; class WindowIdentifier; diff --git a/hal/HalScreenConfiguration.h b/hal/HalScreenConfiguration.h new file mode 100644 index 000000000000..f1bb42a751f5 --- /dev/null +++ b/hal/HalScreenConfiguration.h @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set sw=2 ts=8 et ft=cpp : */ +/* 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_HalScreenConfiguration_h +#define mozilla_HalScreenConfiguration_h + +#include "mozilla/Observer.h" + +namespace mozilla { +namespace hal { +struct ScreenConfiguration; +typedef Observer ScreenConfigurationObserver; +} // namespace hal +} // namespace mozilla + +#endif // mozilla_HalScreenConfiguration_h + diff --git a/hal/moz.build b/hal/moz.build index f8fd247839d0..f72669012d77 100644 --- a/hal/moz.build +++ b/hal/moz.build @@ -14,6 +14,7 @@ EXPORTS.mozilla += [ 'Hal.h', 'HalImpl.h', 'HalSandbox.h', + 'HalScreenConfiguration.h', 'HalSensor.h', 'HalTypes.h', 'HalWakeLock.h',