@@ -140,16 +140,16 @@ class ReportBrokenSiteHelper {
140140 this . win = sourceMenu . win ;
141141 }
142142
143+ getViewNode ( id ) {
144+ return PanelMultiView . getViewNode ( this . win . document , id ) ;
145+ }
146+
143147 get mainView ( ) {
144- return this . win . document . getElementById (
145- "report-broken-site-popup-mainView"
146- ) ;
148+ return this . getViewNode ( "report-broken-site-popup-mainView" ) ;
147149 }
148150
149151 get sentView ( ) {
150- return this . win . document . getElementById (
151- "report-broken-site-popup-reportSentView"
152- ) ;
152+ return this . getViewNode ( "report-broken-site-popup-reportSentView" ) ;
153153 }
154154
155155 get openPanel ( ) {
@@ -249,75 +249,56 @@ class ReportBrokenSiteHelper {
249249 }
250250
251251 // UI element getters
252-
253252 get URLInput ( ) {
254- return this . win . document . getElementById ( "report-broken-site-popup-url" ) ;
253+ return this . getViewNode ( "report-broken-site-popup-url" ) ;
255254 }
256255
257256 get URLInvalidMessage ( ) {
258- return this . win . document . getElementById (
259- "report-broken-site-popup-invalid-url-msg"
260- ) ;
257+ return this . getViewNode ( "report-broken-site-popup-invalid-url-msg" ) ;
261258 }
262259
263260 get reasonInput ( ) {
264- return this . win . document . getElementById ( "report-broken-site-popup-reason" ) ;
261+ return this . getViewNode ( "report-broken-site-popup-reason" ) ;
265262 }
266263
267264 get reasonDropdownPopup ( ) {
268265 return this . reasonInput . querySelector ( "menupopup" ) ;
269266 }
270267
271268 get reasonRequiredMessage ( ) {
272- return this . win . document . getElementById (
273- "report-broken-site-popup-missing-reason-msg"
274- ) ;
269+ return this . getViewNode ( "report-broken-site-popup-missing-reason-msg" ) ;
275270 }
276271
277272 get reasonLabelRequired ( ) {
278- return this . win . document . getElementById (
279- "report-broken-site-popup-reason-label"
280- ) ;
273+ return this . getViewNode ( "report-broken-site-popup-reason-label" ) ;
281274 }
282275
283276 get reasonLabelOptional ( ) {
284- return this . win . document . getElementById (
285- "report-broken-site-popup-reason-optional-label"
286- ) ;
277+ return this . getViewNode ( "report-broken-site-popup-reason-optional-label" ) ;
287278 }
288279
289280 get descriptionTextarea ( ) {
290- return this . win . document . getElementById (
291- "report-broken-site-popup-description"
292- ) ;
281+ return this . getViewNode ( "report-broken-site-popup-description" ) ;
293282 }
294283
295284 get sendMoreInfoLink ( ) {
296- return this . win . document . getElementById (
297- "report-broken-site-popup-send-more-info-link"
298- ) ;
285+ return this . getViewNode ( "report-broken-site-popup-send-more-info-link" ) ;
299286 }
300287
301288 get backButton ( ) {
302289 return this . mainView . querySelector ( ".subviewbutton-back" ) ;
303290 }
304291
305292 get sendButton ( ) {
306- return this . win . document . getElementById (
307- "report-broken-site-popup-send-button"
308- ) ;
293+ return this . getViewNode ( "report-broken-site-popup-send-button" ) ;
309294 }
310295
311296 get cancelButton ( ) {
312- return this . win . document . getElementById (
313- "report-broken-site-popup-cancel-button"
314- ) ;
297+ return this . getViewNode ( "report-broken-site-popup-cancel-button" ) ;
315298 }
316299
317300 get okayButton ( ) {
318- return this . win . document . getElementById (
319- "report-broken-site-popup-okay-button"
320- ) ;
301+ return this . getViewNode ( "report-broken-site-popup-okay-button" ) ;
321302 }
322303
323304 // Test helpers
@@ -334,9 +315,7 @@ class ReportBrokenSiteHelper {
334315 }
335316
336317 chooseReason ( value ) {
337- const item = this . win . document . getElementById (
338- `report-broken-site-popup-reason-${ value } `
339- ) ;
318+ const item = this . getViewNode ( `report-broken-site-popup-reason-${ value } ` ) ;
340319 const input = this . reasonInput ;
341320 input . selectedItem = item ;
342321 input . dispatchEvent (
@@ -498,6 +477,10 @@ class MenuHelper {
498477 this . win = win ;
499478 }
500479
480+ getViewNode ( id ) {
481+ return PanelMultiView . getViewNode ( this . win . document , id ) ;
482+ }
483+
501484 get showsBackButton ( ) {
502485 return true ;
503486 }
@@ -567,21 +550,15 @@ class AppMenuHelper extends MenuHelper {
567550 menuDescription = "AppMenu" ;
568551
569552 get reportBrokenSite ( ) {
570- return this . win . PanelMultiView . getViewNode (
571- this . win . document ,
572- "appMenu-report-broken-site-button"
573- ) ;
553+ return this . getViewNode ( "appMenu-report-broken-site-button" ) ;
574554 }
575555
576556 get reportSiteIssue ( ) {
577557 return undefined ;
578558 }
579559
580560 get popup ( ) {
581- return this . win . PanelMultiView . getViewNode (
582- this . win . document ,
583- "appMenu-popup"
584- ) ;
561+ return this . win . document . getElementById ( "appMenu-popup" ) ;
585562 }
586563
587564 async open ( ) {
@@ -599,24 +576,15 @@ class AppMenuHelpSubmenuHelper extends MenuHelper {
599576 menuDescription = "AppMenu help sub-menu" ;
600577
601578 get reportBrokenSite ( ) {
602- return this . win . PanelMultiView . getViewNode (
603- this . win . document ,
604- "appMenu_help_reportBrokenSite"
605- ) ;
579+ return this . getViewNode ( "appMenu_help_reportBrokenSite" ) ;
606580 }
607581
608582 get reportSiteIssue ( ) {
609- return this . win . PanelMultiView . getViewNode (
610- this . win . document ,
611- "appMenu_help_reportSiteIssue"
612- ) ;
583+ return this . getViewNode ( "appMenu_help_reportSiteIssue" ) ;
613584 }
614585
615586 get popup ( ) {
616- return this . win . PanelMultiView . getViewNode (
617- this . win . document ,
618- "appMenu-popup"
619- ) ;
587+ return this . win . document . getElementById ( "appMenu-popup" ) ;
620588 }
621589
622590 async open ( ) {
@@ -625,8 +593,7 @@ class AppMenuHelpSubmenuHelper extends MenuHelper {
625593 const anchor = this . win . document . getElementById ( "PanelUI-menu-button" ) ;
626594 this . win . PanelUI . showHelpView ( anchor ) ;
627595
628- const appMenuHelpSubview =
629- this . win . document . getElementById ( "PanelUI-helpView" ) ;
596+ const appMenuHelpSubview = this . getViewNode ( "PanelUI-helpView" ) ;
630597 await BrowserTestUtils . waitForEvent ( appMenuHelpSubview , "ViewShown" ) ;
631598 }
632599
@@ -645,31 +612,19 @@ class HelpMenuHelper extends MenuHelper {
645612 }
646613
647614 get reportBrokenSite ( ) {
648- return this . win . PanelMultiView . getViewNode (
649- this . win . document ,
650- "help_reportBrokenSite"
651- ) ;
615+ return this . win . document . getElementById ( "help_reportBrokenSite" ) ;
652616 }
653617
654618 get reportSiteIssue ( ) {
655- return this . win . PanelMultiView . getViewNode (
656- this . win . document ,
657- "help_reportSiteIssue"
658- ) ;
619+ return this . win . document . getElementById ( "help_reportSiteIssue" ) ;
659620 }
660621
661622 get popup ( ) {
662- return this . win . PanelMultiView . getViewNode (
663- this . win . document ,
664- "PanelUI-helpView"
665- ) ;
623+ return this . getViewNode ( "PanelUI-helpView" ) ;
666624 }
667625
668626 get helpMenu ( ) {
669- return this . win . PanelMultiView . getViewNode (
670- this . win . document ,
671- "menu_HelpPopup"
672- ) ;
627+ return this . win . document . getElementById ( "menu_HelpPopup" ) ;
673628 }
674629
675630 async openReportBrokenSite ( ) {
@@ -720,10 +675,7 @@ class ProtectionsPanelHelper extends MenuHelper {
720675
721676 get reportBrokenSite ( ) {
722677 this . win . gProtectionsHandler . _initializePopup ( ) ;
723- return this . win . PanelMultiView . getViewNode (
724- this . win . document ,
725- "protections-popup-report-broken-site-button"
726- ) ;
678+ return this . getViewNode ( "protections-popup-report-broken-site-button" ) ;
727679 }
728680
729681 get reportSiteIssue ( ) {
@@ -732,10 +684,7 @@ class ProtectionsPanelHelper extends MenuHelper {
732684
733685 get popup ( ) {
734686 this . win . gProtectionsHandler . _initializePopup ( ) ;
735- return this . win . PanelMultiView . getViewNode (
736- this . win . document ,
737- "protections-popup"
738- ) ;
687+ return this . win . document . getElementById ( "protections-popup" ) ;
739688 }
740689
741690 async open ( ) {
@@ -753,7 +702,7 @@ class ProtectionsPanelHelper extends MenuHelper {
753702 if ( this . opened ) {
754703 const popup = this . popup ;
755704 const promise = BrowserTestUtils . waitForEvent ( popup , "popuphidden" ) ;
756- this . win . PanelMultiView . hidePopup ( popup , false ) ;
705+ PanelMultiView . hidePopup ( popup , false ) ;
757706 await promise ;
758707 }
759708 }
0 commit comments