Skip to content

Commit d42b499

Browse files
committed
Bug 1988751 - Forbid notification permission in nested first party iframes r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D265282
1 parent 49d3158 commit d42b499

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

dom/notification/NotificationUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ bool IsNotificationForbiddenFor(nsIPrincipal* aPrincipal,
9797
if (outForeignByAncestorContext) {
9898
// nested first party
9999
ReportTelemetry(GleanLabel::eNestedFirstParty, aPurpose);
100-
return false;
100+
return StaticPrefs::
101+
dom_webnotifications_forbid_nested_first_party_enabled();
101102
}
102103

103104
// third party

modules/libpref/init/StaticPrefList.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5646,6 +5646,11 @@
56465646
value: false
56475647
mirror: always
56485648

5649+
- name: dom.webnotifications.forbid_nested_first_party.enabled
5650+
type: RelaxedAtomicBool
5651+
value: true
5652+
mirror: always
5653+
56495654
- name: dom.webnotifications.enabled
56505655
type: RelaxedAtomicBool
56515656
value: true

testing/web-platform/tests/notifications/cross-origin-nested.tentative.https.sub.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656

5757
promise_test(async t => {
5858
const result = await promises.get("child");
59-
assert_equals(result.permission, "granted", `should grant the permission`);
60-
assert_true(result.shown, `notification should be shown`);
59+
assert_equals(result.permission, "denied", `should deny the permission`);
60+
assert_false(result.shown, `notification should not be shown`);
6161

6262
const childRequestResult = await promises.get("childRequest");
63-
assert_equals(childRequestResult.permission, "granted", "should accept the permission request");
63+
assert_equals(childRequestResult.permission, "denied", "should deny the permission request");
6464
}, "nested first party iframe");
6565

6666
promise_test(async t => {
@@ -71,7 +71,7 @@
7171

7272
promise_test(async t => {
7373
const result = await promises.get("childWorker");
74-
assert_equals(result.permission, "granted", `should grant the permission`);
75-
assert_true(result.shown, `notification should be shown`);
74+
assert_equals(result.permission, "denied", `should deny the permission`);
75+
assert_false(result.shown, `notification should not be shown`);
7676
}, "nested first party worker");
7777
</script>

0 commit comments

Comments
 (0)