Bug 102328 - MutationObserver wrapper should not be collected while still observing
Summary: MutationObserver wrapper should not be collected while still observing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Elliott Sprehn
URL:
Keywords:
Depends on: 102701
Blocks: 93661 102555
  Show dependency treegraph
 
Reported: 2012-11-14 21:34 PST by Elliott Sprehn
Modified: 2012-11-19 18:17 PST (History)
8 users (show)

See Also:


Attachments
Patch (9.89 KB, patch)
2012-11-14 21:36 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff
Patch (9.85 KB, patch)
2012-11-14 22:26 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff
Patch for landing (9.85 KB, patch)
2012-11-15 10:34 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff
Patch (10.86 KB, patch)
2012-11-19 16:59 PST, Adam Klein
no flags Details | Formatted Diff | Diff
Patch for landing (15.33 KB, patch)
2012-11-19 17:19 PST, Adam Klein
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Sprehn 2012-11-14 21:34:03 PST
MutationObserver wrapper should not be collected while still observing
Comment 1 Elliott Sprehn 2012-11-14 21:36:23 PST
Created attachment 174338 [details]
Patch
Comment 2 Early Warning System Bot 2012-11-14 21:49:12 PST
Comment on attachment 174338 [details]
Patch

Attachment 174338 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/14834626
Comment 3 Early Warning System Bot 2012-11-14 21:51:53 PST
Comment on attachment 174338 [details]
Patch

Attachment 174338 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/14847258
Comment 4 EFL EWS Bot 2012-11-14 22:10:50 PST
Comment on attachment 174338 [details]
Patch

Attachment 174338 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/14831650
Comment 5 Elliott Sprehn 2012-11-14 22:26:04 PST
Created attachment 174350 [details]
Patch

Woops, deleted too many lines from the JSC code.
Comment 6 Adam Barth 2012-11-15 10:23:47 PST
Comment on attachment 174350 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=174350&action=review

> Source/WebCore/dom/MutationObserver.cpp:60
> -PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback)
> +PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback, ScriptExecutionContext* context)

Don't we usually pass the ScriptExecutionContext as the first argument?
Comment 7 Elliott Sprehn 2012-11-15 10:30:43 PST
(In reply to comment #6)
> (From update of attachment 174350 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174350&action=review
> 
> > Source/WebCore/dom/MutationObserver.cpp:60
> > -PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback)
> > +PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback, ScriptExecutionContext* context)
> 
> Don't we usually pass the ScriptExecutionContext as the first argument?

Yeah we've talked about this before. The code generator passes it as the last one (ex. V8MutationCallback::create), but humans pass it first like XMLHttpRequest. We should fix the code generator so code isn't weird like in V8MutationObserverCustom having two create() calls with a different order.

I'll change this to match XMLHttpRequest.
Comment 8 Elliott Sprehn 2012-11-15 10:34:47 PST
Created attachment 174483 [details]
Patch for landing
Comment 9 Adam Barth 2012-11-15 10:49:18 PST
Comment on attachment 174483 [details]
Patch for landing

Silly code generator.  Trix are for kids.
Comment 10 WebKit Review Bot 2012-11-15 12:35:03 PST
Comment on attachment 174483 [details]
Patch for landing

Rejecting attachment 174483 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
commit-queue/Source/WebKit/chromium/third_party/v8-i18n --revision 157 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
50>At revision 157.

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/14843700
Comment 11 WebKit Review Bot 2012-11-15 13:48:37 PST
Comment on attachment 174483 [details]
Patch for landing

Clearing flags on attachment: 174483

Committed r134830: <http://trac.webkit.org/changeset/134830>
Comment 12 WebKit Review Bot 2012-11-15 13:48:41 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 WebKit Review Bot 2012-11-19 11:59:36 PST
Re-opened since this is blocked by bug 102701
Comment 14 Adam Klein 2012-11-19 12:03:52 PST
In offline discussion, abarth suggested an alternate approach using opaque roots: put each MutationObserver wrapper in the same object group(s) as the Nodes it's observing.
Comment 15 Adam Barth 2012-11-19 13:02:25 PST
In particular, we can't use ActiveDOMObject because MutationObservers need to work with Frameless documents, like those created by XMLHttpRequest.
Comment 16 Adam Klein 2012-11-19 16:56:37 PST
I tried to do this with implicit references and ran into flakiness. Opaque roots seem to work great, patch coming...
Comment 17 Adam Klein 2012-11-19 16:59:51 PST
Created attachment 175083 [details]
Patch
Comment 18 Elliott Sprehn 2012-11-19 17:03:32 PST
Comment on attachment 175083 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=175083&action=review

Nice!

> Source/WebCore/dom/MutationObserverRegistration.cpp:130
> +    if (m_transientRegistrationNodes) {

Early return is usually nicer than indenting everything.
Comment 19 Adam Barth 2012-11-19 17:08:34 PST
Comment on attachment 175083 [details]
Patch

This looks good.  Do we need to skip these tests for JSC while we work on a fix for the JSC bindings?
Comment 20 Adam Klein 2012-11-19 17:19:25 PST
Created attachment 175088 [details]
Patch for landing
Comment 21 Adam Klein 2012-11-19 17:19:47 PST
(In reply to comment #19)
> (From update of attachment 175083 [details])
> This looks good.  Do we need to skip these tests for JSC while we work on a fix for the JSC bindings?

Skipped in all non-chromium ports with a pointer to bug 102744.
Comment 22 WebKit Review Bot 2012-11-19 18:17:12 PST
Comment on attachment 175088 [details]
Patch for landing

Clearing flags on attachment: 175088

Committed r135228: <http://trac.webkit.org/changeset/135228>
Comment 23 WebKit Review Bot 2012-11-19 18:17:17 PST
All reviewed patches have been landed.  Closing bug.