[PEPC] Fix crash when a PermissionElement is made from a shutdown reference. [chromium/src : main]

0 views
Skip to first unread message

Thomas Nguyen (Gerrit)

unread,
Jan 23, 2026, 11:27:48 AMJan 23
to Ravjit Uppal, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Joey Arhar and Ravjit Uppal

Thomas Nguyen added 1 comment

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . unresolved

I think we need to protect some other places of dereferencing the execution context in this file.

Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
  • Ravjit Uppal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
Gerrit-Change-Number: 7509220
Gerrit-PatchSet: 2
Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Comment-Date: Fri, 23 Jan 2026 16:27:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Balazs Engedy (Gerrit)

unread,
Jan 23, 2026, 5:44:00 PMJan 23
to Ravjit Uppal, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Joey Arhar and Ravjit Uppal

Balazs Engedy added 1 comment

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . unresolved

I think we need to protect some other places of dereferencing the execution context in this file.

Balazs Engedy

My suggestion: Let's make _this change_ nevertheless to bring us in line with other HTMLElement subclass implementations, *and* audit if other places need hardening too.

For the purposes of this CL, I would propose that we limit the scope of auditing to cover exactly those methods/behaviors that we can reasonably expect to happen on a HTMLPermissionElement that is created for an already shut down document. This way, we ensure that we land a CL that actually prevents a crash in the scenario we were seeing in the crash report, and we are not just kicking the can further down the road and crashing one line later (i.e. successful construction of the element, but then the next thing done on it crashes).

I didn't immediately find any safeguards that prevents the element from being inserted into the same, already shut-down document, I'm hoping I just missed it, but then we would need to update InsertedInto() as well. I am assuming that at least a shut-down document cannot have a layout tree attached, the other read-only attributes do not need an execution context.

In the <geolocation> element there are some more complex reactions to setting attributes like `autolocate` and `watch`, it wasn't immediately clear to me how those behave on a null execution context.

Separately from that work, there can be other fun edge cases, like a warmed up HTMLPermissionElement from an active document being removed and reinsterted into, and adopted by, a shut-down document. Then vice versa.

It sounds to me that there must be some existing patterns that other elements implement so that this does not get out of hand and result in us changing almost always that the executioncontext is non-null.

Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
  • Ravjit Uppal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
Gerrit-Change-Number: 7509220
Gerrit-PatchSet: 2
Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
Gerrit-CC: Balazs Engedy <eng...@chromium.org>
Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Comment-Date: Fri, 23 Jan 2026 22:43:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Nguyen <tun...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Nguyen (Gerrit)

unread,
Jan 23, 2026, 6:03:03 PMJan 23
to Ravjit Uppal, Balazs Engedy, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Joey Arhar and Ravjit Uppal

Thomas Nguyen added 1 comment

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . unresolved

I think we need to protect some other places of dereferencing the execution context in this file.

Balazs Engedy

My suggestion: Let's make _this change_ nevertheless to bring us in line with other HTMLElement subclass implementations, *and* audit if other places need hardening too.

For the purposes of this CL, I would propose that we limit the scope of auditing to cover exactly those methods/behaviors that we can reasonably expect to happen on a HTMLPermissionElement that is created for an already shut down document. This way, we ensure that we land a CL that actually prevents a crash in the scenario we were seeing in the crash report, and we are not just kicking the can further down the road and crashing one line later (i.e. successful construction of the element, but then the next thing done on it crashes).

I didn't immediately find any safeguards that prevents the element from being inserted into the same, already shut-down document, I'm hoping I just missed it, but then we would need to update InsertedInto() as well. I am assuming that at least a shut-down document cannot have a layout tree attached, the other read-only attributes do not need an execution context.

In the <geolocation> element there are some more complex reactions to setting attributes like `autolocate` and `watch`, it wasn't immediately clear to me how those behave on a null execution context.

Separately from that work, there can be other fun edge cases, like a warmed up HTMLPermissionElement from an active document being removed and reinsterted into, and adopted by, a shut-down document. Then vice versa.

It sounds to me that there must be some existing patterns that other elements implement so that this does not get out of hand and result in us changing almost always that the executioncontext is non-null.

Thomas Nguyen

It is a good point indeed. Changes to the execution context can lead to complications, and we should to prevent such cases. This pattern of re-invalidating the context when elements are moved within a document is common in other elements; we noted as a backlog by may have previously underestimated this.

Regarding the hardening, just in a safe side, we might consider scenarios such as during the triggering of ParseAttribute, which may ultimately involve dereferencing the execution context.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_permission_element.cc;l=806;drc=bf712ec1a13783224debb691ba88ad5c15b93194;bpv=1;bpt=1
(just tracing the code but I have not verify myself)
Gerrit-Comment-Date: Fri, 23 Jan 2026 23:02:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Nguyen <tun...@chromium.org>
Comment-In-Reply-To: Balazs Engedy <eng...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Joey Arhar (Gerrit)

unread,
Jan 23, 2026, 7:17:27 PMJan 23
to Ravjit Uppal, Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Ravjit Uppal

Joey Arhar added 2 comments

File chrome/test/data/permissions/geolocation_element_iframe_use_after_free.html
File-level comment, Patchset 2 (Latest):
Joey Arhar . unresolved

Could this be written as a WPT crash test instead?

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Latest): return GetDocument().GetTaskRunner(TaskType::kInternalDefault);
Joey Arhar . resolved

Interesting, I didn't know that an element's ExecutionContext could be different from its document's ExecutionContext

Open in Gerrit

Related details

Attention is currently required from:
  • Ravjit Uppal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
Gerrit-Change-Number: 7509220
Gerrit-PatchSet: 2
Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
Gerrit-CC: Balazs Engedy <eng...@chromium.org>
Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
Gerrit-Comment-Date: Sat, 24 Jan 2026 00:17:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Balazs Engedy (Gerrit)

unread,
Jan 26, 2026, 4:37:21 AMJan 26
to Ravjit Uppal, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Ravjit Uppal

Balazs Engedy added 2 comments

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . unresolved

I think we need to protect some other places of dereferencing the execution context in this file.

Balazs Engedy

My suggestion: Let's make _this change_ nevertheless to bring us in line with other HTMLElement subclass implementations, *and* audit if other places need hardening too.

For the purposes of this CL, I would propose that we limit the scope of auditing to cover exactly those methods/behaviors that we can reasonably expect to happen on a HTMLPermissionElement that is created for an already shut down document. This way, we ensure that we land a CL that actually prevents a crash in the scenario we were seeing in the crash report, and we are not just kicking the can further down the road and crashing one line later (i.e. successful construction of the element, but then the next thing done on it crashes).

I didn't immediately find any safeguards that prevents the element from being inserted into the same, already shut-down document, I'm hoping I just missed it, but then we would need to update InsertedInto() as well. I am assuming that at least a shut-down document cannot have a layout tree attached, the other read-only attributes do not need an execution context.

In the <geolocation> element there are some more complex reactions to setting attributes like `autolocate` and `watch`, it wasn't immediately clear to me how those behave on a null execution context.

Separately from that work, there can be other fun edge cases, like a warmed up HTMLPermissionElement from an active document being removed and reinsterted into, and adopted by, a shut-down document. Then vice versa.

It sounds to me that there must be some existing patterns that other elements implement so that this does not get out of hand and result in us changing almost always that the executioncontext is non-null.

Thomas Nguyen

It is a good point indeed. Changes to the execution context can lead to complications, and we should to prevent such cases. This pattern of re-invalidating the context when elements are moved within a document is common in other elements; we noted as a backlog by may have previously underestimated this.

Regarding the hardening, just in a safe side, we might consider scenarios such as during the triggering of ParseAttribute, which may ultimately involve dereferencing the execution context.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_permission_element.cc;l=806;drc=bf712ec1a13783224debb691ba88ad5c15b93194;bpv=1;bpt=1
(just tracing the code but I have not verify myself)
Balazs Engedy

Naive question: is `ParseAttribute` also called when you set it from programmatically from JS? It sounds like it would be good to extend the test to not just create a <geolocation> element, but to set all the attributes on it that developers would normally set, and then insert it into the shutdown document (is there some event that we can wait on to ensure that happens)?

Line 1292, Patchset 2 (Latest): return GetDocument().GetTaskRunner(TaskType::kInternalDefault);
Joey Arhar . unresolved

Interesting, I didn't know that an element's ExecutionContext could be different from its document's ExecutionContext

Balazs Engedy

It's actually not a different ExecutionContext, but the document's taskrunner getter returns a fallback in case the execution context is null.

Gerrit-Comment-Date: Mon, 26 Jan 2026 09:37:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Nguyen <tun...@chromium.org>
Comment-In-Reply-To: Joey Arhar <jar...@chromium.org>
Comment-In-Reply-To: Balazs Engedy <eng...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Nguyen (Gerrit)

unread,
Jan 26, 2026, 4:57:05 AMJan 26
to Ravjit Uppal, Balazs Engedy, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Ravjit Uppal

Thomas Nguyen added 1 comment

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . unresolved

I think we need to protect some other places of dereferencing the execution context in this file.

Balazs Engedy

My suggestion: Let's make _this change_ nevertheless to bring us in line with other HTMLElement subclass implementations, *and* audit if other places need hardening too.

For the purposes of this CL, I would propose that we limit the scope of auditing to cover exactly those methods/behaviors that we can reasonably expect to happen on a HTMLPermissionElement that is created for an already shut down document. This way, we ensure that we land a CL that actually prevents a crash in the scenario we were seeing in the crash report, and we are not just kicking the can further down the road and crashing one line later (i.e. successful construction of the element, but then the next thing done on it crashes).

I didn't immediately find any safeguards that prevents the element from being inserted into the same, already shut-down document, I'm hoping I just missed it, but then we would need to update InsertedInto() as well. I am assuming that at least a shut-down document cannot have a layout tree attached, the other read-only attributes do not need an execution context.

In the <geolocation> element there are some more complex reactions to setting attributes like `autolocate` and `watch`, it wasn't immediately clear to me how those behave on a null execution context.

Separately from that work, there can be other fun edge cases, like a warmed up HTMLPermissionElement from an active document being removed and reinsterted into, and adopted by, a shut-down document. Then vice versa.

It sounds to me that there must be some existing patterns that other elements implement so that this does not get out of hand and result in us changing almost always that the executioncontext is non-null.

Thomas Nguyen

It is a good point indeed. Changes to the execution context can lead to complications, and we should to prevent such cases. This pattern of re-invalidating the context when elements are moved within a document is common in other elements; we noted as a backlog by may have previously underestimated this.

Regarding the hardening, just in a safe side, we might consider scenarios such as during the triggering of ParseAttribute, which may ultimately involve dereferencing the execution context.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_permission_element.cc;l=806;drc=bf712ec1a13783224debb691ba88ad5c15b93194;bpv=1;bpt=1
(just tracing the code but I have not verify myself)
Balazs Engedy

Naive question: is `ParseAttribute` also called when you set it from programmatically from JS? It sounds like it would be good to extend the test to not just create a <geolocation> element, but to set all the attributes on it that developers would normally set, and then insert it into the shutdown document (is there some event that we can wait on to ensure that happens)?

Gerrit-Comment-Date: Mon, 26 Jan 2026 09:56:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Nguyen <tun...@chromium.org>
Comment-In-Reply-To: Balazs Engedy <eng...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ravjit Uppal (Gerrit)

unread,
Jan 26, 2026, 10:55:44 AMJan 26
to Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Balazs Engedy, Joey Arhar and Thomas Nguyen

Ravjit Uppal added 2 comments

File chrome/test/data/permissions/geolocation_element_iframe_use_after_free.html
File-level comment, Patchset 2:
Joey Arhar . resolved

Could this be written as a WPT crash test instead?

Ravjit Uppal

Done

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . unresolved

I think we need to protect some other places of dereferencing the execution context in this file.

Balazs Engedy

My suggestion: Let's make _this change_ nevertheless to bring us in line with other HTMLElement subclass implementations, *and* audit if other places need hardening too.

For the purposes of this CL, I would propose that we limit the scope of auditing to cover exactly those methods/behaviors that we can reasonably expect to happen on a HTMLPermissionElement that is created for an already shut down document. This way, we ensure that we land a CL that actually prevents a crash in the scenario we were seeing in the crash report, and we are not just kicking the can further down the road and crashing one line later (i.e. successful construction of the element, but then the next thing done on it crashes).

I didn't immediately find any safeguards that prevents the element from being inserted into the same, already shut-down document, I'm hoping I just missed it, but then we would need to update InsertedInto() as well. I am assuming that at least a shut-down document cannot have a layout tree attached, the other read-only attributes do not need an execution context.

In the <geolocation> element there are some more complex reactions to setting attributes like `autolocate` and `watch`, it wasn't immediately clear to me how those behave on a null execution context.

Separately from that work, there can be other fun edge cases, like a warmed up HTMLPermissionElement from an active document being removed and reinsterted into, and adopted by, a shut-down document. Then vice versa.

It sounds to me that there must be some existing patterns that other elements implement so that this does not get out of hand and result in us changing almost always that the executioncontext is non-null.

Thomas Nguyen

It is a good point indeed. Changes to the execution context can lead to complications, and we should to prevent such cases. This pattern of re-invalidating the context when elements are moved within a document is common in other elements; we noted as a backlog by may have previously underestimated this.

Regarding the hardening, just in a safe side, we might consider scenarios such as during the triggering of ParseAttribute, which may ultimately involve dereferencing the execution context.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_permission_element.cc;l=806;drc=bf712ec1a13783224debb691ba88ad5c15b93194;bpv=1;bpt=1
(just tracing the code but I have not verify myself)
Balazs Engedy

Naive question: is `ParseAttribute` also called when you set it from programmatically from JS? It sounds like it would be good to extend the test to not just create a <geolocation> element, but to set all the attributes on it that developers would normally set, and then insert it into the shutdown document (is there some event that we can wait on to ensure that happens)?

Thomas Nguyen

Agree, we should do that (as I saw precedent case of checking null ExecutionContext in ParseAttribute) such as in form element.

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/forms/html_form_element.cc;l=857?q=third_party%2Fblink%2Frenderer%2Fcore%2Fhtml%2Fforms%2Fhtml_form_element.cc&ss=chromium%2Fchromium%2Fsrc
And the test

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/html/semantics/forms/the-form-element/form-action-in-inactive-document-crash.html

Ravjit Uppal

We do get a crash if we try to insert the element into a already shutdown element. I added a null check in `InsertedInto` and extended the test.

Open in Gerrit

Related details

Attention is currently required from:
  • Balazs Engedy
  • Joey Arhar
  • Thomas Nguyen
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
Gerrit-Change-Number: 7509220
Gerrit-PatchSet: 3
Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
Gerrit-CC: Balazs Engedy <eng...@chromium.org>
Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
Gerrit-Comment-Date: Mon, 26 Jan 2026 15:55:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Nguyen <tun...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Joey Arhar (Gerrit)

unread,
Jan 26, 2026, 5:38:37 PMJan 26
to Ravjit Uppal, Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Balazs Engedy, Ravjit Uppal and Thomas Nguyen

Joey Arhar added 2 comments

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2: return GetDocument().GetTaskRunner(TaskType::kInternalDefault);
Joey Arhar . resolved

Interesting, I didn't know that an element's ExecutionContext could be different from its document's ExecutionContext

Balazs Engedy

It's actually not a different ExecutionContext, but the document's taskrunner getter returns a fallback in case the execution context is null.

Joey Arhar

Acknowledged

File third_party/blink/web_tests/external/wpt/html/semantics/permission-element/geolocation-element/iframe-use-after-free.html
File-level comment, Patchset 4 (Latest):
Joey Arhar . unresolved

crashtests don't need to use testharness and end with crash.html: https://web-platform-tests.org/writing-tests/crashtest.html

you can use the class=test-wait described there to replace the t.step_wait from testharness

Open in Gerrit

Related details

Attention is currently required from:
  • Balazs Engedy
  • Ravjit Uppal
  • Thomas Nguyen
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
Gerrit-Change-Number: 7509220
Gerrit-PatchSet: 4
Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
Gerrit-CC: Balazs Engedy <eng...@chromium.org>
Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
Gerrit-Comment-Date: Mon, 26 Jan 2026 22:38:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Ravjit Uppal (Gerrit)

unread,
Jan 27, 2026, 3:41:16 PMJan 27
to Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Balazs Engedy, Joey Arhar and Thomas Nguyen

Ravjit Uppal voted and added 2 comments

Votes added by Ravjit Uppal

Auto-Submit+1
Commit-Queue+1

2 comments

File third_party/blink/renderer/core/html/html_permission_element.cc
Line 1292, Patchset 2 (Parent): return GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault);
Thomas Nguyen . resolved

I think we need to protect some other places of dereferencing the execution context in this file.

Balazs Engedy

My suggestion: Let's make _this change_ nevertheless to bring us in line with other HTMLElement subclass implementations, *and* audit if other places need hardening too.

For the purposes of this CL, I would propose that we limit the scope of auditing to cover exactly those methods/behaviors that we can reasonably expect to happen on a HTMLPermissionElement that is created for an already shut down document. This way, we ensure that we land a CL that actually prevents a crash in the scenario we were seeing in the crash report, and we are not just kicking the can further down the road and crashing one line later (i.e. successful construction of the element, but then the next thing done on it crashes).

I didn't immediately find any safeguards that prevents the element from being inserted into the same, already shut-down document, I'm hoping I just missed it, but then we would need to update InsertedInto() as well. I am assuming that at least a shut-down document cannot have a layout tree attached, the other read-only attributes do not need an execution context.

In the <geolocation> element there are some more complex reactions to setting attributes like `autolocate` and `watch`, it wasn't immediately clear to me how those behave on a null execution context.

Separately from that work, there can be other fun edge cases, like a warmed up HTMLPermissionElement from an active document being removed and reinsterted into, and adopted by, a shut-down document. Then vice versa.

It sounds to me that there must be some existing patterns that other elements implement so that this does not get out of hand and result in us changing almost always that the executioncontext is non-null.

Thomas Nguyen

It is a good point indeed. Changes to the execution context can lead to complications, and we should to prevent such cases. This pattern of re-invalidating the context when elements are moved within a document is common in other elements; we noted as a backlog by may have previously underestimated this.

Regarding the hardening, just in a safe side, we might consider scenarios such as during the triggering of ParseAttribute, which may ultimately involve dereferencing the execution context.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_permission_element.cc;l=806;drc=bf712ec1a13783224debb691ba88ad5c15b93194;bpv=1;bpt=1
(just tracing the code but I have not verify myself)
Balazs Engedy

Naive question: is `ParseAttribute` also called when you set it from programmatically from JS? It sounds like it would be good to extend the test to not just create a <geolocation> element, but to set all the attributes on it that developers would normally set, and then insert it into the shutdown document (is there some event that we can wait on to ensure that happens)?

Thomas Nguyen

Agree, we should do that (as I saw precedent case of checking null ExecutionContext in ParseAttribute) such as in form element.

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/forms/html_form_element.cc;l=857?q=third_party%2Fblink%2Frenderer%2Fcore%2Fhtml%2Fforms%2Fhtml_form_element.cc&ss=chromium%2Fchromium%2Fsrc
And the test

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/html/semantics/forms/the-form-element/form-action-in-inactive-document-crash.html

Ravjit Uppal

We do get a crash if we try to insert the element into a already shutdown element. I added a null check in `InsertedInto` and extended the test.

Ravjit Uppal

Done

File third_party/blink/web_tests/external/wpt/html/semantics/permission-element/geolocation-element/iframe-use-after-free.html
File-level comment, Patchset 4:
Joey Arhar . resolved

crashtests don't need to use testharness and end with crash.html: https://web-platform-tests.org/writing-tests/crashtest.html

you can use the class=test-wait described there to replace the t.step_wait from testharness

Ravjit Uppal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Balazs Engedy
  • Joey Arhar
  • Thomas Nguyen
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
    Gerrit-Change-Number: 7509220
    Gerrit-PatchSet: 5
    Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
    Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
    Gerrit-CC: Balazs Engedy <eng...@chromium.org>
    Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
    Gerrit-Comment-Date: Tue, 27 Jan 2026 20:40:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Ravjit Uppal <rav...@chromium.org>
    Comment-In-Reply-To: Thomas Nguyen <tun...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joey Arhar (Gerrit)

    unread,
    Jan 27, 2026, 4:52:52 PMJan 27
    to Ravjit Uppal, Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
    Attention needed from Balazs Engedy, Ravjit Uppal and Thomas Nguyen

    Joey Arhar added 1 comment

    File third_party/blink/web_tests/external/wpt/html/semantics/permission-element/geolocation-element/iframe-use-after-free-crash.html
    Line 20, Patchset 5 (Latest): setTimeout(() => {
    Joey Arhar . unresolved

    Maybe instead of using setTimeout since that's disallowed in wpt, you could wait for a load event to be fired on the iframe? and if thats not enough, maybe add a couple requestAnimationFrames?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Balazs Engedy
    • Ravjit Uppal
    • Thomas Nguyen
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
      Gerrit-Change-Number: 7509220
      Gerrit-PatchSet: 5
      Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
      Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
      Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
      Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
      Gerrit-CC: Balazs Engedy <eng...@chromium.org>
      Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
      Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
      Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
      Gerrit-Comment-Date: Tue, 27 Jan 2026 21:52:42 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ravjit Uppal (Gerrit)

      unread,
      Jan 28, 2026, 6:17:56 AMJan 28
      to Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
      Attention needed from Balazs Engedy, Joey Arhar and Thomas Nguyen

      Ravjit Uppal voted and added 1 comment

      Votes added by Ravjit Uppal

      Auto-Submit+1

      1 comment

      File third_party/blink/web_tests/external/wpt/html/semantics/permission-element/geolocation-element/iframe-use-after-free-crash.html
      Line 20, Patchset 5: setTimeout(() => {
      Joey Arhar . resolved

      Maybe instead of using setTimeout since that's disallowed in wpt, you could wait for a load event to be fired on the iframe? and if thats not enough, maybe add a couple requestAnimationFrames?

      Ravjit Uppal

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Balazs Engedy
      • Joey Arhar
      • Thomas Nguyen
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
        Gerrit-Change-Number: 7509220
        Gerrit-PatchSet: 6
        Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
        Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
        Gerrit-CC: Balazs Engedy <eng...@chromium.org>
        Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
        Gerrit-Attention: Joey Arhar <jar...@chromium.org>
        Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
        Gerrit-Comment-Date: Wed, 28 Jan 2026 11:17:43 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Joey Arhar <jar...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Joey Arhar (Gerrit)

        unread,
        Jan 28, 2026, 2:14:37 PMJan 28
        to Ravjit Uppal, Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
        Attention needed from Balazs Engedy, Ravjit Uppal and Thomas Nguyen

        Joey Arhar voted

        Code-Review+1
        Commit-Queue+2
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Balazs Engedy
        • Ravjit Uppal
        • Thomas Nguyen
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
        Gerrit-Change-Number: 7509220
        Gerrit-PatchSet: 6
        Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
        Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
        Gerrit-CC: Balazs Engedy <eng...@chromium.org>
        Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
        Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
        Gerrit-Comment-Date: Wed, 28 Jan 2026 19:14:27 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Blink W3C Test Autoroller (Gerrit)

        unread,
        Jan 28, 2026, 2:18:25 PMJan 28
        to Ravjit Uppal, Balazs Engedy, Thomas Nguyen, Chromium LUCI CQ, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
        Attention needed from Balazs Engedy, Ravjit Uppal and Thomas Nguyen

        Message from Blink W3C Test Autoroller

        Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/57392.

        When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.

        WPT Export docs:
        https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process

        Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
        Gerrit-Attention: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Attention: Thomas Nguyen <tun...@chromium.org>
        Gerrit-Attention: Balazs Engedy <eng...@chromium.org>
        Gerrit-Comment-Date: Wed, 28 Jan 2026 19:18:18 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: No
        satisfied_requirement
        open
        diffy

        Chromium LUCI CQ (Gerrit)

        unread,
        Jan 28, 2026, 2:19:17 PMJan 28
        to Ravjit Uppal, Blink W3C Test Autoroller, Balazs Engedy, Thomas Nguyen, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org

        Chromium LUCI CQ submitted the change

        Change information

        Commit message:
        [PEPC] Fix crash when a PermissionElement is made from a shutdown reference.
        Bug: 476235673
        Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
        Auto-Submit: Ravjit Uppal <rav...@chromium.org>
        Commit-Queue: Joey Arhar <jar...@chromium.org>
        Reviewed-by: Joey Arhar <jar...@chromium.org>
        Cr-Commit-Position: refs/heads/main@{#1576086}
        Files:
        • M third_party/blink/renderer/core/html/html_permission_element.cc
        • A third_party/blink/web_tests/external/wpt/html/semantics/permission-element/geolocation-element/iframe-use-after-free-crash.html
        Change size: S
        Delta: 2 files changed, 34 insertions(+), 2 deletions(-)
        Branch: refs/heads/main
        Submit Requirements:
        • requirement satisfiedCode-Review: +1 by Joey Arhar
        Open in Gerrit
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: merged
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
        Gerrit-Change-Number: 7509220
        Gerrit-PatchSet: 7
        Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        open
        diffy
        satisfied_requirement

        Blink W3C Test Autoroller (Gerrit)

        unread,
        Jan 28, 2026, 3:51:01 PMJan 28
        to Ravjit Uppal, Chromium LUCI CQ, Balazs Engedy, Thomas Nguyen, AyeAye, permissio...@chromium.org, blink-revie...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org

        Message from Blink W3C Test Autoroller

        The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/57392

        Open in Gerrit

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice3462d661420324d47a463e4339ba6fdb811721
        Gerrit-Change-Number: 7509220
        Gerrit-PatchSet: 7
        Gerrit-Owner: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
        Gerrit-Reviewer: Ravjit Uppal <rav...@chromium.org>
        Gerrit-Reviewer: Thomas Nguyen <tun...@chromium.org>
        Gerrit-CC: Balazs Engedy <eng...@chromium.org>
        Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
        Gerrit-Comment-Date: Wed, 28 Jan 2026 20:50:53 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: No
        satisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages