WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
48416
IDBFactoryBackend's reference to IDBDatabaseBackend should be weak
https://bugs.webkit.org/show_bug.cgi?id=48416
Summary
IDBFactoryBackend's reference to IDBDatabaseBackend should be weak
Jeremy Orlow
Reported
2010-10-27 04:53:28 PDT
.
Attachments
patch
(8.11 KB, patch)
2010-10-27 04:56 PDT
,
Jeremy Orlow
steveblock
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Jeremy Orlow
Comment 1
2010-10-27 04:56:52 PDT
Created
attachment 72011
[details]
patch
Andrei Popescu
Comment 2
2010-10-27 05:54:55 PDT
LGTM
Steve Block
Comment 3
2010-11-01 10:58:18 PDT
Comment on
attachment 72011
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=72011&action=review
> WebCore/storage/IDBDatabaseBackendImpl.h:93 > + RefPtr<IDBFactoryBackendImpl> m_factory;
You mention that the factory has the lifetime of the application. If so, why do we need to take a ref to it?
Jeremy Orlow
Comment 4
2010-11-02 04:19:26 PDT
(In reply to
comment #3
)
> (From update of
attachment 72011
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=72011&action=review
> > > WebCore/storage/IDBDatabaseBackendImpl.h:93 > > + RefPtr<IDBFactoryBackendImpl> m_factory; > > You mention that the factory has the lifetime of the application. If so, why do we need to take a ref to it?
The other objects are ref counted and held by javascript. Are we guaranteed that a GC will happen and the GC will catch _all_ references before the page group goes away? Is there any reason to do this either? Given that the factory is a pretty light weight object (since it only has weak references) there seems like no advantage and big disadvantages (possible security bugs) for changing this behavior.
Steve Block
Comment 5
2010-11-02 06:11:30 PDT
> The other objects are ref counted and held by javascript. Are we guaranteed that a GC will happen and > the GC will catch _all_ references before the page group goes away?
So you mean the factory has page lifetime? If so, that makes sense. Perhaps you could update the comment to make that clear.
Jeremy Orlow
Comment 6
2010-11-02 11:05:15 PDT
(In reply to
comment #5
)
> > The other objects are ref counted and held by javascript. Are we guaranteed that a GC will happen and > > the GC will catch _all_ references before the page group goes away? > So you mean the factory has page lifetime? If so, that makes sense. Perhaps you could update the comment to make that clear.
No, it's page group lifetime which is a superset of the pages' lifetime. But pages will own IDBDatabase objects. And once the last one goes away, the IDBDatabaseBackendImpl will go to 0 which will cause the IDBFactory to clear its pointer. Basically the case where IDBFactory could possibly go away first is on shutdown where it's not clear whether all the pages' resources (especially those owned by JavaScript) will be killed before the page group goes away.
Jeremy Orlow
Comment 7
2010-11-05 04:58:13 PDT
I can has r+?
Steve Block
Comment 8
2010-11-05 06:38:05 PDT
Comment on
attachment 72011
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=72011&action=review
r=me
>>> WebCore/storage/IDBDatabaseBackendImpl.h:93 >>> + RefPtr<IDBFactoryBackendImpl> m_factory; >> >> You mention that the factory has the lifetime of the application. If so, why do we need to take a ref to it? > > The other objects are ref counted and held by javascript. Are we guaranteed that a GC will happen and the GC will catch _all_ references before the page group goes away? > > Is there any reason to do this either? Given that the factory is a pretty light weight object (since it only has weak references) there seems like no advantage and big disadvantages (possible security bugs) for changing this behavior.
OK, makes sense. I still think the comment could be more clear.
Jeremy Orlow
Comment 9
2010-11-05 06:57:45 PDT
Committed
r71411
: <
http://trac.webkit.org/changeset/71411
>
Jeremy Orlow
Comment 10
2010-11-05 07:12:19 PDT
(In reply to
comment #8
)
> (From update of
attachment 72011
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=72011&action=review
> > r=me > > >>> WebCore/storage/IDBDatabaseBackendImpl.h:93 > >>> + RefPtr<IDBFactoryBackendImpl> m_factory; > >> > >> You mention that the factory has the lifetime of the application. If so, why do we need to take a ref to it? > > > > The other objects are ref counted and held by javascript. Are we guaranteed that a GC will happen and the GC will catch _all_ references before the page group goes away? > > > > Is there any reason to do this either? Given that the factory is a pretty light weight object (since it only has weak references) there seems like no advantage and big disadvantages (possible security bugs) for changing this behavior. > > OK, makes sense. I still think the comment could be more clear.
I added a comment.
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