WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
240212
Introduction.md: Explain active DOM objects
https://bugs.webkit.org/show_bug.cgi?id=240212
Summary
Introduction.md: Explain active DOM objects
Ryosuke Niwa
Reported
2022-05-07 22:44:45 PDT
Explain what active DOM objects do.
Attachments
Patch
(7.37 KB, patch)
2022-05-07 22:48 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Patch
(7.09 KB, patch)
2022-05-07 22:51 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Patch for landing
(7.63 KB, patch)
2022-05-09 22:06 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2022-05-07 22:48:00 PDT
Created
attachment 459008
[details]
Patch
Ryosuke Niwa
Comment 2
2022-05-07 22:51:52 PDT
Created
attachment 459009
[details]
Patch
Wenson Hsieh
Comment 3
2022-05-08 22:20:34 PDT
Comment on
attachment 459009
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=459009&action=review
> Introduction.md:1023 > + request.addEventListener("load", () => callback);
Nit - this should either be ``` request.addEventListener("load", () => callback()); ``` or ``` request.addEventListener("load", callback); ```
> Introduction.md:1029 > +In WebKit, we consider these objects has a *pending activity*.
"these objects has a" doesn't read quite so well.
Chris Dumez
Comment 4
2022-05-09 07:43:10 PDT
Comment on
attachment 459009
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=459009&action=review
This is good but I think we should mention that ActiveDOMObject::virtualHasPendingActivity() should return true (or we should be hold a PendingActivity) as long as we may fire events at the object. This is a big source of confusion for people who sometimes think they only need a pending activity when they're about to fire an event (e.g. queueing an event). Fact is if you don't hold a pending activity as soon as your object is created, then its JS wrapper may get garbage collected before we even get a chance to queue an event.
>> Introduction.md:1029 >> +In WebKit, we consider these objects has a *pending activity*. > > "these objects has a" doesn't read quite so well.
*have
Ryosuke Niwa
Comment 5
2022-05-09 09:06:15 PDT
(In reply to Chris Dumez from
comment #4
)
> Comment on
attachment 459009
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=459009&action=review
> > This is good but I think we should mention that > ActiveDOMObject::virtualHasPendingActivity() should return true (or we > should be hold a PendingActivity) as long as we may fire events at the > object. This is a big source of confusion for people who sometimes think > they only need a pending activity when they're about to fire an event (e.g. > queueing an event). Fact is if you don't hold a pending activity as soon as > your object is created, then its JS wrapper may get garbage collected before > we even get a chance to queue an event.
Okay. How about something like this: Note that virtualHasPendingActivity should return true so long as there is a possibility of dispatching an event or invoke JavaScript in any way in the future. In other words, a pending activity should exit while an object is doing some work in C++ well before any event dispatching is scheduled. Anytime there is no pending activity, JS wrappers of an object can get deleted by the garbage collector.
Chris Dumez
Comment 6
2022-05-09 18:50:03 PDT
> In other words, a pending activity should exit
You probably mean “exist” but otherwise yes, lgtm.
Ryosuke Niwa
Comment 7
2022-05-09 21:58:39 PDT
(In reply to Wenson Hsieh from
comment #3
)
> Comment on
attachment 459009
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=459009&action=review
> > > Introduction.md:1023 > > + request.addEventListener("load", () => callback); > > Nit - this should either be > ``` > request.addEventListener("load", () => callback()); > ``` > or > ``` > request.addEventListener("load", callback); > ```
Oops, will do the latter.
> > Introduction.md:1029 > > +In WebKit, we consider these objects has a *pending activity*. > > "these objects has a" doesn't read quite so well.
Rephrased it to: In WebKit, we consider such an object to have a *pending activity*. Expressing the presence of such a pending activity is a primary use case of [`ActiveDOMObject`](
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/ActiveDOMObject.h
).
Ryosuke Niwa
Comment 8
2022-05-09 21:59:32 PDT
(In reply to Chris Dumez from
comment #6
)
> > In other words, a pending activity should exit > > You probably mean “exist” but otherwise yes, lgtm.
Fixed.
Ryosuke Niwa
Comment 9
2022-05-09 22:06:07 PDT
Created
attachment 459093
[details]
Patch for landing
Ryosuke Niwa
Comment 10
2022-05-09 22:08:31 PDT
Committed
r293999
(
250435@trunk
): <
https://commits.webkit.org/250435@trunk
>
Radar WebKit Bug Importer
Comment 11
2022-05-09 22:09:13 PDT
<
rdar://problem/93006333
>
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