From ce9f11eb180a16e312919771152d0a4c4c320ef3 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 19 Sep 2023 17:39:09 +0000 Subject: [PATCH] Bug 1848708 - Move Glean and GleanPings to plain webidl r=nika,janerik,perry.mcmanis Since we're exposing Glean types in not-chrome-only contexts like privileged "about:" pages, we can't live in chrome-webidl/ any longer. Differential Revision: https://phabricator.services.mozilla.com/D186266 --- dom/chrome-webidl/moz.build | 8 -------- dom/{chrome-webidl => webidl}/Glean.webidl | 6 +++--- dom/{chrome-webidl => webidl}/GleanPings.webidl | 2 +- dom/webidl/moz.build | 5 +++++ toolkit/components/glean/bindings/Glean.h | 1 + 5 files changed, 10 insertions(+), 12 deletions(-) rename dom/{chrome-webidl => webidl}/Glean.webidl (87%) rename dom/{chrome-webidl => webidl}/GleanPings.webidl (87%) diff --git a/dom/chrome-webidl/moz.build b/dom/chrome-webidl/moz.build index 947e5ea88b23..1557008941d2 100644 --- a/dom/chrome-webidl/moz.build +++ b/dom/chrome-webidl/moz.build @@ -28,9 +28,6 @@ with Files("MatchPattern.webidl"): with Files("WebExtension*.webidl"): BUG_COMPONENT = ("WebExtensions", "General") -with Files("Glean*.webidl"): - BUG_COMPONENT = ("Toolkit", "Telemetry") - with Files("IOUtils.webidl"): BUG_COMPONENT = ("Toolkit", "IOUtils and PathUtils") @@ -109,8 +106,3 @@ if CONFIG["MOZ_PLACES"]: "PlacesEvent.webidl", "PlacesObservers.webidl", ] - -WEBIDL_FILES += [ - "Glean.webidl", - "GleanPings.webidl", -] diff --git a/dom/chrome-webidl/Glean.webidl b/dom/webidl/Glean.webidl similarity index 87% rename from dom/chrome-webidl/Glean.webidl rename to dom/webidl/Glean.webidl index f8f55e241824..b73575942f1d 100644 --- a/dom/chrome-webidl/Glean.webidl +++ b/dom/webidl/Glean.webidl @@ -6,7 +6,7 @@ interface nsISupports; -[ChromeOnly, Exposed=Window] +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] interface GleanCategory { /** * Get a metric by name. @@ -17,7 +17,7 @@ interface GleanCategory { getter nsISupports (DOMString identifier); }; -[ChromeOnly, Exposed=Window] +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] interface GleanImpl { /** * Get a metric category by name. @@ -27,7 +27,7 @@ interface GleanImpl { getter GleanCategory (DOMString identifier); }; -[ChromeOnly, Exposed=Window] +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] interface GleanLabeled { /** * Get a specific metric for a given label. diff --git a/dom/chrome-webidl/GleanPings.webidl b/dom/webidl/GleanPings.webidl similarity index 87% rename from dom/chrome-webidl/GleanPings.webidl rename to dom/webidl/GleanPings.webidl index 3dee22205bae..088a9f34e468 100644 --- a/dom/chrome-webidl/GleanPings.webidl +++ b/dom/webidl/GleanPings.webidl @@ -6,7 +6,7 @@ interface nsIGleanPing; -[ChromeOnly, Exposed=Window] +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] interface GleanPingsImpl { /** * Get a ping by name. diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 9a151c6f232f..2b605249b25f 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -139,6 +139,9 @@ with Files("GeometryUtils.webidl"): with Files("GetUserMediaRequest.webidl"): BUG_COMPONENT = ("Core", "WebRTC") +with Files("Glean*.webidl"): + BUG_COMPONENT = ("Toolkit", "Telemetry") + with Files("Grid.webidl"): BUG_COMPONENT = ("Core", "CSS Parsing and Computation") @@ -583,6 +586,8 @@ WEBIDL_FILES = [ "GeolocationPositionError.webidl", "GeometryUtils.webidl", "GetUserMediaRequest.webidl", + "Glean.webidl", + "GleanPings.webidl", "Grid.webidl", "Headers.webidl", "Highlight.webidl", diff --git a/toolkit/components/glean/bindings/Glean.h b/toolkit/components/glean/bindings/Glean.h index 4305e68aa7c3..a6db055279eb 100644 --- a/toolkit/components/glean/bindings/Glean.h +++ b/toolkit/components/glean/bindings/Glean.h @@ -8,6 +8,7 @@ #define mozilla_glean_Glean_h #include "js/TypeDecls.h" +#include "nsGlobalWindowInner.h" #include "nsISupports.h" #include "nsTArrayForwardDeclare.h" #include "nsWrapperCache.h"