Bug 1355147 - Expose IsHeadless on GfxInfo. r=jrmuizel
authorBrendan Dahl <brendan.dahl@gmail.com>
Mon, 03 Jul 2017 15:39:16 -0700
changeset 371735 803e1b08f00f20c61a9bc7892bb97470ab991a45
parent 371734 1a4b6ccab14b146078951856ae0259cfb4c6ed8f
child 371736 19854c39011d6650b0e70f6ff8e8f27999c18c02
push id32253
push userkwierso@gmail.com
push dateSat, 29 Jul 2017 00:40:54 +0000
treeherdermozilla-central@ec666e910442 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1355147
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1355147 - Expose IsHeadless on GfxInfo. r=jrmuizel Allows marionette to check if the browser is in headless mode. MozReview-Commit-ID: 2kaqO3HO9Ke
widget/GfxInfoBase.cpp
widget/GfxInfoBase.h
widget/nsIGfxInfo.idl
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -1468,16 +1468,23 @@ GfxInfoBase::GetActiveCrashGuards(JSCont
 NS_IMETHODIMP
 GfxInfoBase::GetWebRenderEnabled(bool* aWebRenderEnabled)
 {
   *aWebRenderEnabled = gfxVars::UseWebRender();
   return NS_OK;
 }
 
 NS_IMETHODIMP
+GfxInfoBase::GetIsHeadless(bool* aIsHeadless)
+{
+  *aIsHeadless = gfxPlatform::IsHeadless();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 GfxInfoBase::GetContentBackend(nsAString & aContentBackend)
 {
   BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend();
   nsString outStr;
 
   switch (backend) {
   case BackendType::DIRECT2D1_1: {
     outStr.AppendPrintf("Direct2D 1.1");
--- a/widget/GfxInfoBase.h
+++ b/widget/GfxInfoBase.h
@@ -57,16 +57,17 @@ public:
   NS_IMETHOD_(void) LogFailure(const nsACString &failure) override;
   NS_IMETHOD GetInfo(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetFeatures(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetFeatureLog(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetActiveCrashGuards(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetContentBackend(nsAString & aContentBackend) override;
   NS_IMETHOD GetUsingGPUProcess(bool *aOutValue) override;
   NS_IMETHOD GetWebRenderEnabled(bool* aWebRenderEnabled) override;
+  NS_IMETHOD GetIsHeadless(bool* aIsHeadless) override;
 
   // Initialization function. If you override this, you must call this class's
   // version of Init first.
   // We need Init to be called separately from the constructor so we can
   // register as an observer after all derived classes have been constructed
   // and we know we have a non-zero refcount.
   // Ideally, Init() would be void-return, but the rules of
   // NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
--- a/widget/nsIGfxInfo.idl
+++ b/widget/nsIGfxInfo.idl
@@ -19,16 +19,17 @@ interface nsIGfxInfo : nsISupports
   readonly attribute DOMString DWriteVersion;
   readonly attribute DOMString cleartypeParameters;
 
   /*
    * These are valid across all platforms.
    */
   readonly attribute DOMString ContentBackend;
   readonly attribute boolean WebRenderEnabled;
+  readonly attribute boolean isHeadless;
 
   // XXX: Switch to a list of devices, rather than explicitly numbering them.
 
   /**
    * The name of the display adapter.
    */
   readonly attribute DOMString adapterDescription;
   readonly attribute DOMString adapterDescription2;