From 0e9cbaa4d248a66eac8fe283279d2e2c76782be1 Mon Sep 17 00:00:00 2001 From: Greg Stoll Date: Mon, 21 Nov 2022 19:15:53 +0000 Subject: [PATCH] Bug 1793834 - part 1/12: adding a mostly-empty about:windows-messages page r=Gijs,fluent-reviewers,flod Differential Revision: https://phabricator.services.mozilla.com/D161148 --- .../static/browser_all_files_referenced.js | 6 ++++ docshell/base/nsAboutRedirector.cpp | 2 ++ docshell/build/components.conf | 1 + .../AboutWindowsMessages.cpp | 29 +++++++++++++++++++ .../AboutWindowsMessages.h | 29 +++++++++++++++++++ .../aboutwindowsmessages/components.conf | 17 +++++++++++ .../content/aboutWindowsMessages.css | 3 ++ .../content/aboutWindowsMessages.html | 22 ++++++++++++++ .../content/aboutWindowsMessages.js | 20 +++++++++++++ .../components/aboutwindowsmessages/jar.mn | 8 +++++ .../components/aboutwindowsmessages/moz.build | 23 +++++++++++++++ .../nsIAboutWindowsMessages.idl | 11 +++++++ toolkit/components/moz.build | 2 +- .../toolkit/about/aboutWindowsMessages.ftl | 11 +++++++ 14 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 toolkit/components/aboutwindowsmessages/AboutWindowsMessages.cpp create mode 100644 toolkit/components/aboutwindowsmessages/AboutWindowsMessages.h create mode 100644 toolkit/components/aboutwindowsmessages/components.conf create mode 100644 toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.css create mode 100644 toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.html create mode 100644 toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js create mode 100644 toolkit/components/aboutwindowsmessages/jar.mn create mode 100644 toolkit/components/aboutwindowsmessages/moz.build create mode 100644 toolkit/components/aboutwindowsmessages/nsIAboutWindowsMessages.idl create mode 100644 toolkit/locales/en-US/toolkit/about/aboutWindowsMessages.ftl diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 5260d40cd9f7..7e5c6705871d 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -279,6 +279,12 @@ var whitelist = [ file: "resource://gre/localization/en-US/toolkit/about/aboutThirdParty.ftl", platforms: ["linux", "macosx"], }, + // Bug 1973834 - referenced by aboutWindowsMessages.html which is only for Windows + { + file: + "resource://gre/localization/en-US/toolkit/about/aboutWindowsMessages.ftl", + platforms: ["linux", "macosx"], + }, // Bug 1721741: // (The references to these files are dynamically generated, so the test can't // find the references) diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index ef8569a04084..0181347078da 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -157,6 +157,8 @@ static const RedirEntry kRedirMap[] = { #ifdef XP_WIN {"third-party", "chrome://global/content/aboutThirdParty.html", nsIAboutModule::ALLOW_SCRIPT}, + {"windows-messages", "chrome://global/content/aboutWindowsMessages.html", + nsIAboutModule::ALLOW_SCRIPT}, #endif #ifndef MOZ_GLEAN_ANDROID {"glean", "chrome://global/content/aboutGlean.html", diff --git a/docshell/build/components.conf b/docshell/build/components.conf index 82da339a0176..31916e83b5fb 100644 --- a/docshell/build/components.conf +++ b/docshell/build/components.conf @@ -40,6 +40,7 @@ if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android': about_pages.append('profiles') if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'windows': about_pages.append('third-party') + about_pages.append('windows-messages') if not defined('MOZ_GLEAN_ANDROID'): about_pages.append('glean') diff --git a/toolkit/components/aboutwindowsmessages/AboutWindowsMessages.cpp b/toolkit/components/aboutwindowsmessages/AboutWindowsMessages.cpp new file mode 100644 index 000000000000..9fabbb7907bc --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/AboutWindowsMessages.cpp @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 "AboutWindowsMessages.h" + +#include "mozilla/ClearOnShutdown.h" +#include "mozilla/dom/Promise.h" +#include "mozilla/StaticPtr.h" +#include "nsThreadUtils.h" + +namespace mozilla { + +static StaticRefPtr sSingleton; + +NS_IMPL_ISUPPORTS(AboutWindowsMessages, nsIAboutWindowsMessages); + +/*static*/ +already_AddRefed AboutWindowsMessages::GetSingleton() { + if (!sSingleton) { + sSingleton = new AboutWindowsMessages; + ClearOnShutdown(&sSingleton); + } + + return do_AddRef(sSingleton); +} +} // namespace mozilla diff --git a/toolkit/components/aboutwindowsmessages/AboutWindowsMessages.h b/toolkit/components/aboutwindowsmessages/AboutWindowsMessages.h new file mode 100644 index 000000000000..c236bbcd30d0 --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/AboutWindowsMessages.h @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 __AboutWindowsMessages_h__ +#define __AboutWindowsMessages_h__ + +#include "mozilla/MozPromise.h" +#include "nsIAboutWindowsMessages.h" + +namespace mozilla { + +class AboutWindowsMessages final : public nsIAboutWindowsMessages { + ~AboutWindowsMessages() = default; + + public: + static already_AddRefed GetSingleton(); + + AboutWindowsMessages() = default; + + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSIABOUTWINDOWSMESSAGES +}; + +} // namespace mozilla + +#endif // __AboutWindowsMessages_h__ diff --git a/toolkit/components/aboutwindowsmessages/components.conf b/toolkit/components/aboutwindowsmessages/components.conf new file mode 100644 index 000000000000..52e9b12abec6 --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/components.conf @@ -0,0 +1,17 @@ +# -*- 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/. + +Classes = [ + { + 'cid': '{ba8cdb8a-9624-493d-aac4-23ee83378d7c}', + 'contract_ids': ['@mozilla.org/about-windowsmessages;1'], + 'type': 'AboutWindowsMessages', + 'singleton': True, + 'constructor': 'mozilla::AboutWindowsMessages::GetSingleton', + 'headers': ['mozilla/AboutWindowsMessages.h'], + 'processes': ProcessSelector.MAIN_PROCESS_ONLY, + }, +] \ No newline at end of file diff --git a/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.css b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.css new file mode 100644 index 000000000000..e0032240a4d2 --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.css @@ -0,0 +1,3 @@ +/* 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/. */ diff --git a/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.html b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.html new file mode 100644 index 000000000000..789bbac2224e --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.html @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + +

+ + + diff --git a/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js new file mode 100644 index 000000000000..d3a5b9283d0e --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/content/aboutWindowsMessages.js @@ -0,0 +1,20 @@ +/* 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"; + +let AboutWindowsMessages = null; + +function onLoad() {} + +try { + AboutWindowsMessages = Cc["@mozilla.org/about-windowsmessages;1"].getService( + Ci.nsIAboutWindowsMessages + ); + document.addEventListener("DOMContentLoaded", onLoad, { once: true }); +} catch (ex) { + // Do nothing if we fail to create a singleton instance, + // showing the default no-module message. + Cu.reportError(ex); +} diff --git a/toolkit/components/aboutwindowsmessages/jar.mn b/toolkit/components/aboutwindowsmessages/jar.mn new file mode 100644 index 000000000000..8761a6069059 --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/jar.mn @@ -0,0 +1,8 @@ +# 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/. + +toolkit.jar: + content/global/aboutWindowsMessages.css (content/aboutWindowsMessages.css) + content/global/aboutWindowsMessages.html (content/aboutWindowsMessages.html) + content/global/aboutWindowsMessages.js (content/aboutWindowsMessages.js) \ No newline at end of file diff --git a/toolkit/components/aboutwindowsmessages/moz.build b/toolkit/components/aboutwindowsmessages/moz.build new file mode 100644 index 000000000000..8693ab62488d --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/moz.build @@ -0,0 +1,23 @@ +# -*- 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/. + +with Files("**"): + BUG_COMPONENT = ("Core", "Widget: Win32") + +FINAL_LIBRARY = "xul" + +JAR_MANIFESTS += ["jar.mn"] +XPCOM_MANIFESTS += ["components.conf"] +XPIDL_MODULE = "AboutWindowsMessages" +XPIDL_SOURCES += ["nsIAboutWindowsMessages.idl"] + +EXPORTS.mozilla += [ + "AboutWindowsMessages.h", +] + +SOURCES += [ + "AboutWindowsMessages.cpp", +] diff --git a/toolkit/components/aboutwindowsmessages/nsIAboutWindowsMessages.idl b/toolkit/components/aboutwindowsmessages/nsIAboutWindowsMessages.idl new file mode 100644 index 000000000000..e3939cc6f884 --- /dev/null +++ b/toolkit/components/aboutwindowsmessages/nsIAboutWindowsMessages.idl @@ -0,0 +1,11 @@ +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ +/* 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 "nsISupports.idl" + +[scriptable, uuid(3c5cfbfd-545c-4910-a34a-203063914f96)] +interface nsIAboutWindowsMessages : nsISupports +{ +}; \ No newline at end of file diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index e9f897c24b8f..beae49ca83f3 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -115,7 +115,7 @@ if CONFIG["MOZ_UPDATE_AGENT"]: DIRS += ["build"] if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": - DIRS += ["aboutthirdparty", "gfx"] + DIRS += ["aboutthirdparty", "aboutwindowsmessages", "gfx"] if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android": EXTRA_JS_MODULES += [ diff --git a/toolkit/locales/en-US/toolkit/about/aboutWindowsMessages.ftl b/toolkit/locales/en-US/toolkit/about/aboutWindowsMessages.ftl new file mode 100644 index 000000000000..e958f2c1d90f --- /dev/null +++ b/toolkit/locales/en-US/toolkit/about/aboutWindowsMessages.ftl @@ -0,0 +1,11 @@ +# 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/. + +### Localization for the about:windows-messages page, which is only available +### on the Windows OS. +### This page records and shows messages sent from the OS to individual browser +### windows. These messages can be useful in debugging hard-to-reproduce issues +### with window sizing and position. + +windows-messages-page-title = Windows Messages Information