Bug 47257 - DeviceOrientation crash when page is in page cache and is navigated while listener is registered
Summary: DeviceOrientation crash when page is in page cache and is navigated while lis...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 30335
  Show dependency treegraph
 
Reported: 2010-10-06 04:52 PDT by Steve Block
Modified: 2010-10-14 07:15 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.11 KB, patch)
2010-10-14 04:24 PDT, Steve Block
jorlow: review+
steveblock: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Block 2010-10-06 04:52:18 PDT
When a page is navigated while a listener is registered for DeviceOrientation events, a crash can occur if the controller later attempts to dispatch an event. We need to make sure all listeners are removed when the page is navigated.

We currently remove all listeners from DOMWindow::removeAllEventListeners() but this is not called on page reload. We could add similar code to DOMWindow::clear().
Comment 1 Steve Block 2010-10-14 04:18:38 PDT
This occurs only when the page is in the page cache, as in this case, event listeners are not unregistered.

Note that a crash is only observed with V8.
Comment 2 Steve Block 2010-10-14 04:24:32 PDT
Created attachment 70725 [details]
Patch
Comment 3 Jeremy Orlow 2010-10-14 05:19:38 PDT
Comment on attachment 70725 [details]
Patch

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

r=me

> LayoutTests/fast/dom/DeviceOrientation/script-tests/event-after-navigation.js:1
> +description('Tests for a crash where an event is fired after the page has been navigated away when the original page is in the page cache.<br><br>Note that the crash is only seen with V8.');

Is there any reason this crash can only possibly happen in V8?  If not, this comment probably should be removed, even if we currently only see it in V8.  If so, it should probably mention why it's V8 specific.  This way it'll be clear whether the comment is stale.
Comment 4 Steve Block 2010-10-14 05:26:48 PDT
> Is there any reason this crash can only possibly happen in V8?  If not, this
> comment probably should be removed, even if we currently only see it in V8.
No, there's no fundamental reason why it should only happen with V8. The controller should never try to fire events once the document has gone. I'll remove the comment before landing.
Comment 5 Steve Block 2010-10-14 07:15:05 PDT
Committed r69764: <http://trac.webkit.org/changeset/69764>