fix(cc-dark-theme): adapt new report dialog

The new report dialog appeared with a light theme and its background
made some flashes.

This CL fixes the theme mismatch by forcing the dialog theme to match
the one set in the CC, and it also fixes the background flashes.

Fixed: twpowertools:197
Change-Id: Ia3aa4d179a8f08584a7fbfa66d58156779254e57
diff --git a/src/contentScripts/communityConsole/main.js b/src/contentScripts/communityConsole/main.js
index 4381b86..0200394 100644
--- a/src/contentScripts/communityConsole/main.js
+++ b/src/contentScripts/communityConsole/main.js
@@ -6,6 +6,7 @@
 import AvatarsHandler from './avatars.js';
 import {batchLock} from './batchLock.js';
 import {injectDarkThemeButton, isDarkThemeOn} from './darkTheme/darkTheme.js';
+import ReportDialogColorThemeFix from './darkTheme/reportDialog.js';
 import {unifiedProfilesFix} from './darkTheme/unifiedProfiles.js';
 // #!if ['chromium', 'chromium_mv3'].includes(browser_target)
 import {applyDragAndDropFixIfEnabled} from './dragAndDropFix.js';
@@ -17,7 +18,7 @@
 import Workflows from './workflows/workflows.js';
 
 var mutationObserver, options, avatars, infiniteScroll, workflows,
-    threadToolbar, flattenThreads;
+    threadToolbar, flattenThreads, reportDialogColorThemeFix;
 
 const watchedNodesSelectors = [
   // App container (used to set up the intersection observer and inject the dark
@@ -55,7 +56,7 @@
   // Thread list (used for the autorefresh feature)
   'ec-thread-list',
 
-  // Unified profile iframe
+  // Unified profile iframe and report dialog iframe
   'iframe',
 
   // Canned response tags (for the "import CR" popup for the workflows feature)
@@ -178,10 +179,14 @@
       window.TWPTAutoRefresh.setUp();
     }
 
-    // Redirect unified profile iframe to dark version if applicable
-    if (node.tagName == 'IFRAME' && isDarkThemeOn(options) &&
-        unifiedProfilesFix.checkIframe(node)) {
-      unifiedProfilesFix.fixIframe(node);
+    if (node.tagName == 'IFRAME') {
+      // Redirect unified profile iframe to dark version if applicable
+      if (isDarkThemeOn(options) && unifiedProfilesFix.checkIframe(node)) {
+        unifiedProfilesFix.fixIframe(node);
+      }
+
+      // Set report dialog iframe's theme to the appropriate theme
+      reportDialogColorThemeFix.fixThemeIfReportDialogIframeAndApplicable(node);
     }
 
     // Add the "import" button in the canned responses view for the workflows
@@ -283,6 +288,7 @@
   workflows = new Workflows();
   threadToolbar = new ThreadToolbar();
   flattenThreads = new FlattenThreads();
+  reportDialogColorThemeFix = new ReportDialogColorThemeFix(options);
 
   // autoRefresh, extraInfo, threadPageDesignWarning and workflowsImport are
   // initialized in start.js