@@ -42,6 +42,7 @@ async function makeExtension({
42
42
) ;
43
43
44
44
let manifest = {
45
+ name : `Test extension ${ id } ` ,
45
46
manifest_version,
46
47
browser_specific_settings : { gecko : { id } } ,
47
48
permissions,
@@ -117,11 +118,12 @@ async function makeExtension({
117
118
return ext ;
118
119
}
119
120
120
- async function testQuarantinePopup ( popup ) {
121
+ async function testQuarantinePopup ( popup , extensionId ) {
122
+ const addonName = WebExtensionPolicy . getByID ( extensionId ) . name ;
121
123
let [ title , line1 , line2 ] = await l10n . formatMessages ( [
122
124
{
123
125
id : "webext-quarantine-confirmation-title" ,
124
- args : { addonName : "Generated extension" } ,
126
+ args : { addonName } ,
125
127
} ,
126
128
"webext-quarantine-confirmation-line-1" ,
127
129
"webext-quarantine-confirmation-line-2" ,
@@ -157,12 +159,13 @@ async function testOriginControls(
157
159
let nextMenuItemClassName ;
158
160
159
161
switch ( contextMenuId ) {
160
- case "toolbar-context-menu" :
162
+ case "toolbar-context-menu" : {
161
163
let target = `#${ CSS . escape ( makeWidgetId ( extension . id ) ) } -BAP` ;
162
164
buttonOrWidget = document . querySelector ( target ) . parentElement ;
163
165
menu = await openChromeContextMenu ( contextMenuId , target ) ;
164
166
nextMenuItemClassName = "customize-context-manageExtension" ;
165
167
break ;
168
+ }
166
169
167
170
case "unified-extensions-context-menu" :
168
171
await openExtensionsPanel ( ) ;
@@ -224,7 +227,7 @@ async function testOriginControls(
224
227
: "origin-controls-toolbar-button-permission-needed"
225
228
: "origin-controls-toolbar-button" ,
226
229
args : {
227
- extensionTitle : "Generated extension" ,
230
+ extensionTitle : `Test extension ${ extension . id } ` ,
228
231
} ,
229
232
} ,
230
233
"Correct l10n message."
@@ -270,7 +273,7 @@ async function testOriginControls(
270
273
271
274
if ( quarantinePopup ) {
272
275
let popup = await quarantinePopup ;
273
- await testQuarantinePopup ( popup ) ;
276
+ await testQuarantinePopup ( popup , extension . id ) ;
274
277
275
278
if ( allowQuarantine ) {
276
279
popup . button . click ( ) ;
@@ -417,7 +420,7 @@ const originControlsInContextMenu = async options => {
417
420
await testOriginControls ( ext2 , options , {
418
421
items : [ ACCESS_OPTIONS , WHEN_CLICKED ] ,
419
422
selected : 1 ,
420
- attention : true ,
423
+ attention : false ,
421
424
} ) ;
422
425
423
426
// Could access mochi.test when clicked.
@@ -487,7 +490,7 @@ const originControlsInContextMenu = async options => {
487
490
await testOriginControls ( ext2 , options , {
488
491
items : [ ACCESS_OPTIONS , WHEN_CLICKED ] ,
489
492
selected : 1 ,
490
- attention : true ,
493
+ attention : false ,
491
494
quarantined : false ,
492
495
} ) ;
493
496
@@ -577,11 +580,15 @@ const originControlsInContextMenu = async options => {
577
580
578
581
await testOriginControls ( ext1 , options , { items : [ NO_ACCESS ] } ) ;
579
582
580
- // Click alraedy selected options, expect no permission changes.
583
+ // Click already selected options, expect no permission changes.
581
584
await testOriginControls ( ext2 , options , {
582
585
items : [ ACCESS_OPTIONS , WHEN_CLICKED , ALWAYS_ON ] ,
583
586
selected : 1 ,
584
587
click : 1 ,
588
+ // This extension has the activeTab permission, but the current tab
589
+ // has a tab url that matches one of the extension host permission
590
+ // which is not granted yet and so we expect the attention badge
591
+ // to be shown.
585
592
attention : true ,
586
593
} ) ;
587
594
await testOriginControls ( ext3 , options , {
@@ -602,12 +609,12 @@ const originControlsInContextMenu = async options => {
602
609
if ( unifiedButton ) {
603
610
ok (
604
611
unifiedButton . hasAttribute ( "attention" ) ,
605
- "ext2 is WHEN_CLICKED for example.com, show attention indicator. "
612
+ "ext2 is WHEN_CLICKED and showing the attention indicator for example.com "
606
613
) ;
607
614
Assert . deepEqual (
608
615
document . l10n . getAttributes ( unifiedButton ) ,
609
616
UNIFIED_ATTENTION ,
610
- "UEB attention for only one extension."
617
+ "UEB attention due to ext2 extension showing an attention indicator ."
611
618
) ;
612
619
}
613
620
@@ -727,9 +734,18 @@ add_task(async function originControls_in_unifiedExtensions_contextMenu() {
727
734
} ) ;
728
735
729
736
add_task ( async function test_attention_dot_when_pinning_extension ( ) {
730
- const extension = await makeExtension ( { permissions : [ "activeTab" ] } ) ;
737
+ const extension = await makeExtension ( {
738
+ permissions : [ "activeTab" ] ,
739
+ host_permissions : [ "*://mochi.test/*" ] ,
740
+ } ) ;
731
741
await extension . startup ( ) ;
732
742
743
+ await ExtensionPermissions . remove (
744
+ extension . id ,
745
+ { origins : [ "*://mochi.test/*" ] , permissions : [ ] } ,
746
+ extension . extension
747
+ ) ;
748
+
733
749
const unifiedButton = document . querySelector ( "#unified-extensions-button" ) ;
734
750
const extensionWidgetID = AppUiTestInternals . getBrowserActionWidgetId (
735
751
extension . id
0 commit comments