WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
232788
[Live Text] Add a helper method to remove recognized text from an image element
https://bugs.webkit.org/show_bug.cgi?id=232788
Summary
[Live Text] Add a helper method to remove recognized text from an image element
Wenson Hsieh
Reported
2021-11-06 12:22:17 PDT
.
Attachments
Patch
(4.26 KB, patch)
2021-11-06 12:24 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2021-11-06 12:24:39 PDT
Created
attachment 443490
[details]
Patch
Aditya Keerthi
Comment 2
2021-11-08 10:34:24 PST
Comment on
attachment 443490
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443490&action=review
> Source/WebCore/html/HTMLElement.cpp:1341 > + RefPtr<HTMLDivElement> containerToRemove;
Is this variable necessary? Why not just remove the container in the loop?
Wenson Hsieh
Comment 3
2021-11-08 10:38:19 PST
Comment on
attachment 443490
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443490&action=review
Thanks for the review!
>> Source/WebCore/html/HTMLElement.cpp:1341 >> + RefPtr<HTMLDivElement> containerToRemove; > > Is this variable necessary? Why not just remove the container in the loop?
I'll need to double check, but IIRC mutating the DOM underneath the scope of a DOM iterator will fire debug assertions (though in this scenario, it is technically safe since we break immediately afterwards).
Wenson Hsieh
Comment 4
2021-11-08 11:49:29 PST
(In reply to Wenson Hsieh from
comment #3
)
> Comment on
attachment 443490
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=443490&action=review
> > Thanks for the review! > > >> Source/WebCore/html/HTMLElement.cpp:1341 > >> + RefPtr<HTMLDivElement> containerToRemove; > > > > Is this variable necessary? Why not just remove the container in the loop? > > I'll need to double check, but IIRC mutating the DOM underneath the scope of > a DOM iterator will fire debug assertions (though in this scenario, it is > technically safe since we break immediately afterwards).
Yeah, directly removing the node underneath the iterator results in: ``` ASSERTION FAILED: ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(childToRemove) dom/ContainerNode.cpp(146) : bool WebCore::ContainerNode::removeNodeWithScriptAssertion(WebCore::Node &, ChildChange::Source) 1 0x37c1f4199 WTFCrash 2 0x37c1f41b9 WTFCrashWithSecurityImplication 3 0x3920467c1 WebCore::ContainerNode::removeNodeWithScriptAssertion(WebCore::Node&, WebCore::ContainerNode::ChildChange::Source) 4 0x392042e22 WebCore::ContainerNode::removeChild(WebCore::Node&) 5 0x392221136 WebCore::Node::remove() 6 0x3925543cf WebCore::HTMLElement::removeImageOverlaySoonIfNeeded()::$_4::operator()() const ``` (I'll keep the code as-is, at least for now)
Aditya Keerthi
Comment 5
2021-11-08 12:08:48 PST
(In reply to Wenson Hsieh from
comment #4
)
> (In reply to Wenson Hsieh from
comment #3
) > > Comment on
attachment 443490
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=443490&action=review
> > > > Thanks for the review! > > > > >> Source/WebCore/html/HTMLElement.cpp:1341 > > >> + RefPtr<HTMLDivElement> containerToRemove; > > > > > > Is this variable necessary? Why not just remove the container in the loop? > > > > I'll need to double check, but IIRC mutating the DOM underneath the scope of > > a DOM iterator will fire debug assertions (though in this scenario, it is > > technically safe since we break immediately afterwards). > > Yeah, directly removing the node underneath the iterator results in: > > ``` > ASSERTION FAILED: > ScriptDisallowedScope::InMainThread:: > isEventDispatchAllowedInSubtree(childToRemove) > dom/ContainerNode.cpp(146) : bool > WebCore::ContainerNode::removeNodeWithScriptAssertion(WebCore::Node &, > ChildChange::Source) > 1 0x37c1f4199 WTFCrash > 2 0x37c1f41b9 WTFCrashWithSecurityImplication > 3 0x3920467c1 > WebCore::ContainerNode::removeNodeWithScriptAssertion(WebCore::Node&, > WebCore::ContainerNode::ChildChange::Source) > 4 0x392042e22 WebCore::ContainerNode::removeChild(WebCore::Node&) > 5 0x392221136 WebCore::Node::remove() > 6 0x3925543cf > WebCore::HTMLElement::removeImageOverlaySoonIfNeeded()::$_4::operator()() > const > ``` > > (I'll keep the code as-is, at least for now)
👍
EWS
Comment 6
2021-11-08 12:55:34 PST
Committed
r285425
(
243981@main
): <
https://commits.webkit.org/243981@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 443490
[details]
.
Radar WebKit Bug Importer
Comment 7
2021-11-08 12:56:20 PST
<
rdar://problem/85169058
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug