Bug 1405875 - Remove regression testing backend from layout debugger. r=mats
authorL. David Baron <dbaron@dbaron.org>
Thu, 05 Oct 2017 11:15:56 -0700
changeset 427311 92c0f810986fc9c6e3903a1246544a507452f2b4
parent 427310 e5d6b9275cb40349897b000e52f352087ab1273c
child 427312 3d7bbd9c6c096c50fb068a2f0ab68111d38da0f1
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersmats
bugs1405875
milestone58.0a1
Bug 1405875 - Remove regression testing backend from layout debugger. r=mats This removes the C++ and IDL for the UI removed in the previous patch. MozReview-Commit-ID: bSkPnWopi9
layout/tools/layout-debug/src/moz.build
layout/tools/layout-debug/src/nsDebugFactory.cpp
layout/tools/layout-debug/src/nsILayoutRegressionTester.idl
layout/tools/layout-debug/src/nsLayoutDebugCIID.h
layout/tools/layout-debug/src/nsRegressionTester.cpp
layout/tools/layout-debug/src/nsRegressionTester.h
layout/tools/layout-debug/tests/unit/test_componentsRegistered.js
--- a/layout/tools/layout-debug/src/moz.build
+++ b/layout/tools/layout-debug/src/moz.build
@@ -1,25 +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/.
 
 XPIDL_SOURCES += [
     'nsILayoutDebuggingTools.idl',
-    'nsILayoutRegressionTester.idl',
 ]
 
 XPIDL_MODULE = 'layout_debug'
 
 EXPORTS += [
     'nsLayoutDebugCIID.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsDebugFactory.cpp',
     'nsLayoutDebugCLH.cpp',
     'nsLayoutDebuggingTools.cpp',
-    'nsRegressionTester.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/layout/tools/layout-debug/src/nsDebugFactory.cpp
+++ b/layout/tools/layout-debug/src/nsDebugFactory.cpp
@@ -3,38 +3,33 @@
  * 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 "nscore.h"
 #include "nsLayoutDebugCIID.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIFactory.h"
 #include "nsISupports.h"
-#include "nsRegressionTester.h"
 #include "nsLayoutDebuggingTools.h"
 #include "nsLayoutDebugCLH.h"
 #include "nsIServiceManager.h"
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegressionTester)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLayoutDebuggingTools)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLayoutDebugCLH)
 
-NS_DEFINE_NAMED_CID(NS_REGRESSION_TESTER_CID);
 NS_DEFINE_NAMED_CID(NS_LAYOUT_DEBUGGINGTOOLS_CID);
 NS_DEFINE_NAMED_CID(NS_LAYOUTDEBUGCLH_CID);
 
 static const mozilla::Module::CIDEntry kLayoutDebugCIDs[] = {
-  { &kNS_REGRESSION_TESTER_CID, false, nullptr, nsRegressionTesterConstructor },
   { &kNS_LAYOUT_DEBUGGINGTOOLS_CID, false, nullptr, nsLayoutDebuggingToolsConstructor },
   { &kNS_LAYOUTDEBUGCLH_CID, false, nullptr, nsLayoutDebugCLHConstructor },
   { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kLayoutDebugContracts[] = {
-  { "@mozilla.org/layout-debug/regressiontester;1", &kNS_REGRESSION_TESTER_CID },
   { NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID, &kNS_LAYOUT_DEBUGGINGTOOLS_CID },
   { "@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug", &kNS_LAYOUTDEBUGCLH_CID },
   { nullptr }
 };
 
 static const mozilla::Module::CategoryEntry kLayoutDebugCategories[] = {
   { "command-line-handler", "m-layoutdebug", "@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug" },
   { nullptr }
deleted file mode 100644
--- a/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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 "nsISupports.idl"
-
-interface mozIDOMWindow;
-interface nsIFile;
-
-[scriptable, uuid(0a065e41-3a55-4b5c-bb41-1e848bb2d10c)]
-interface nsILayoutRegressionTester : nsISupports
-{
-  /**
-   * Dumps the content of a window
-   * @param aWindowToDump       the window to dump (may be an iframe etc)
-   * @param aFile               the file to dump to. It will be created if necessary, otherwise
-                                truncated. If nil, write to stdout.
-   * @param aFlagsMask          some flags that determine what to dump
-   * @param aFlagsMask          some flags that determine what to dump
-   * @param aResult             a status value indicating whether the dump happened, 
-                                whether the page was still loading, or whether some other error happened.
-   */
-  const short DUMP_FLAGS_MASK_DEFAULT        = 0;
-  const short DUMP_FLAGS_MASK_PRINT_MODE     = 1;
-  
-  const long DUMP_RESULT_COMPLETED           = 0;   // loaded OK
-  const long DUMP_RESULT_LOADING             = 1;   // still loading
-  const long DUMP_RESULT_ERROR               = 2;   // an error occurred
-  
-  long dumpFrameModel(in mozIDOMWindow aWindowToDump,
-                      in nsIFile aFile,
-                      in unsigned long aFlagsMask);
-
-  /**
-   * Compares the contents of frame model files
-   * @param aBaseFile           the baseline file, opened with read permissions
-   * @param aVerFile            file containing the results to verify, opened with read permissions
-   * @param aFlags              flags specifying output verbosity
-   * @param aResult             result of the comparison: zero if the files are same, non-zero if different
-   */
-  const short COMPARE_FLAGS_VERBOSE        = 0;
-  const short COMPARE_FLAGS_BRIEF          = 1;
-  boolean compareFrameModels(in nsIFile aBaseFile, in nsIFile aVerFile, in unsigned long aFlags);
-};
-
--- a/layout/tools/layout-debug/src/nsLayoutDebugCIID.h
+++ b/layout/tools/layout-debug/src/nsLayoutDebugCIID.h
@@ -5,20 +5,16 @@
 
 #ifndef nsFrameDebugCIID_h__
 #define nsFrameDebugCIID_h__
 
 #include "nsISupports.h"
 #include "nsIFactory.h"
 #include "nsIComponentManager.h"
 
-#define NS_REGRESSION_TESTER_CID \
-{ 0x698c54f4, 0x4ea9, 0x11d7, \
-{ 0x85, 0x9f, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 } }
-
 #define NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID \
   "@mozilla.org/layout-debug/layout-debuggingtools;1"
 // 3f4c3b63-e640-4712-abbf-fff1301ceb60
 #define NS_LAYOUT_DEBUGGINGTOOLS_CID { 0x3f4c3b68, 0xe640, 0x4712, \
     { 0xab, 0xbf, 0xff, 0xf1, 0x30, 0x1c, 0xeb, 0x60}}
 
 #endif // nsFrameDebugCIID_h__
 
deleted file mode 100644
--- a/layout/tools/layout-debug/src/nsRegressionTester.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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.h"
-#include "nsRegressionTester.h"
-
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "nsIWindowWatcher.h"
-#include "nsPIDOMWindow.h"
-#include "nsIPresShell.h"
-#include "nsIURI.h"
-#include "nsISimpleEnumerator.h"
-#include "nsIDocShell.h"
-#include "nsIContentViewer.h"
-#include "nsIContentViewerFile.h"
-#include "nsIFrame.h"
-#include "nsStyleStruct.h"
-#include "nsIFrameUtil.h"
-#include "nsLayoutCID.h"
-#include "nsIFile.h"
-#include "nsViewManager.h"
-#include "nsView.h"
-
-
-
-static NS_DEFINE_CID(kFrameUtilCID, NS_FRAME_UTIL_CID);
-
-
-nsRegressionTester::nsRegressionTester()
-{
-}
-
-nsRegressionTester::~nsRegressionTester()
-{
-}
-
-NS_IMPL_ISUPPORTS(nsRegressionTester, nsILayoutRegressionTester)
-
-NS_IMETHODIMP
-nsRegressionTester::DumpFrameModel(mozIDOMWindow* aWindowToDump,
-                                   nsIFile *aDestFile,
-                                   uint32_t aFlagsMask, int32_t *aResult)
-{
-  NS_ENSURE_ARG(aWindowToDump);
-  NS_ENSURE_ARG_POINTER(aResult);
-
-  *aResult = DUMP_RESULT_ERROR;
-
-#ifndef DEBUG
-  return NS_ERROR_NOT_AVAILABLE;
-#else
-  nsresult    rv = NS_ERROR_NOT_AVAILABLE;
-  uint32_t    busyFlags;
-  bool        stillLoading;
-
-  auto* windowToDump = nsPIDOMWindowInner::From(aWindowToDump);
-
-  nsCOMPtr<nsIDocShell> docShell = windowToDump->GetDocShell();
-
-  // find out if the document is loaded
-  docShell->GetBusyFlags(&busyFlags);
-  stillLoading = busyFlags & (nsIDocShell::BUSY_FLAGS_BUSY |
-                              nsIDocShell::BUSY_FLAGS_PAGE_LOADING);
-  if (stillLoading)
-  {
-    *aResult = DUMP_RESULT_LOADING;
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
-
-  nsIFrame* root = presShell->GetRootFrame();
-
-  FILE* fp = stdout;
-  if (aDestFile)
-  {
-    rv = aDestFile->OpenANSIFileDesc("w", &fp);
-    if (NS_FAILED(rv)) return rv;
-  }
-  if (aFlagsMask & DUMP_FLAGS_MASK_PRINT_MODE) {
-    nsCOMPtr <nsIContentViewer> viewer;
-    docShell->GetContentViewer(getter_AddRefs(viewer));
-    if (viewer){
-      nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
-      if (viewerFile) {
-         viewerFile->Print(true, fp, nullptr);
-      }
-    }
-  }
-  else {
-    root->DumpRegressionData(presShell->GetPresContext(), fp, 0);
-  }
-  if (fp != stdout)
-    fclose(fp);
-  *aResult = DUMP_RESULT_COMPLETED;
-  return NS_OK;
-#endif
-}
-
-NS_IMETHODIMP
-nsRegressionTester::CompareFrameModels(nsIFile *aBaseFile, nsIFile *aVerFile,
-                                       uint32_t aFlags, bool *aResult)
-{
-  NS_ENSURE_ARG(aBaseFile);
-  NS_ENSURE_ARG(aVerFile);
-  NS_ENSURE_ARG_POINTER(aResult);
-
-  *aResult = false;
-
-  nsresult rv;
-  FILE* baseFile;
-  rv = aBaseFile->OpenANSIFileDesc("r", &baseFile);
-  if (NS_FAILED(rv)) return rv;
-
-  FILE* verFile;
-  rv = aVerFile->OpenANSIFileDesc("r", &verFile);
-  if (NS_FAILED(rv)) {
-    fclose(baseFile);
-    return rv;
-  }
-
-  nsCOMPtr<nsIFrameUtil> frameUtil = do_CreateInstance(kFrameUtilCID, &rv);
-  if (NS_SUCCEEDED(rv))
-  {
-    int32_t outputLevel = (aFlags == COMPARE_FLAGS_VERBOSE) ? 0 : 1;
-    rv = frameUtil->CompareRegressionData(baseFile, verFile, outputLevel);
-    // CompareRegressionData closes |baseFile| and |verFile|.
-  } else {
-    fclose(verFile);
-    fclose(baseFile);
-  }
-
-  *aResult = NS_FAILED(rv);
-  return NS_OK;
-}
deleted file mode 100644
--- a/layout/tools/layout-debug/src/nsRegressionTester.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * 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 nsRegressionTester_h__
-#define nsRegressionTester_h__
-
-#include "nsCOMPtr.h"
-
-#include "nsILayoutRegressionTester.h"
-#include "nsILayoutDebugger.h"
-
-//*****************************************************************************
-//***    nsRegressionTester
-//*****************************************************************************
-class  nsRegressionTester : public nsILayoutRegressionTester
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSILAYOUTREGRESSIONTESTER
-
-  nsRegressionTester();
-
-protected:
-  virtual ~nsRegressionTester();
-};
-
-
-
-#endif /* nsRegressionTester_h__ */
--- a/layout/tools/layout-debug/tests/unit/test_componentsRegistered.js
+++ b/layout/tools/layout-debug/tests/unit/test_componentsRegistered.js
@@ -1,8 +1,6 @@
 function run_test() {
-    do_check_true("@mozilla.org/layout-debug/regressiontester;1" in
-		  Components.classes);
     do_check_true("@mozilla.org/layout-debug/layout-debuggingtools;1" in
 		  Components.classes);
     do_check_true("@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug" in
 		  Components.classes);    
-}
\ No newline at end of file
+}