ASSIGNED144761
[Mac] Playback target clients do not unregister on page reload
https://bugs.webkit.org/show_bug.cgi?id=144761
Summary [Mac] Playback target clients do not unregister on page reload
Eric Carlson
Reported 2015-05-07 14:36:44 PDT
Playback target clients do not unregister on page reload
Attachments
Proposed patch. (1.39 KB, patch)
2015-05-07 14:40 PDT, Eric Carlson
beidson: review-
Proposed patch. (3.57 KB, patch)
2015-05-08 09:19 PDT, Eric Carlson
no flags
Updated patch. (3.95 KB, patch)
2015-05-08 09:26 PDT, Eric Carlson
beidson: review+
Patch for landing. (3.67 KB, text/plain)
2015-05-08 09:57 PDT, Eric Carlson
no flags
Patch for landing. (3.67 KB, patch)
2015-05-08 09:59 PDT, Eric Carlson
commit-queue: commit-queue-
Patch for landing, this time with one less OOPs (3.67 KB, patch)
2015-05-08 10:57 PDT, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2015-05-07 14:37:35 PDT
Eric Carlson
Comment 2 2015-05-07 14:40:23 PDT
Created attachment 252630 [details] Proposed patch.
WebKit Commit Bot
Comment 3 2015-05-07 14:43:27 PDT
Attachment 252630 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jer Noble
Comment 4 2015-05-07 14:48:49 PDT
Comment on attachment 252630 [details] Proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=252630&action=review r=me, with nit. > Source/WebCore/dom/Document.cpp:2254 > +#if ENABLE(WIRELESS_PLAYBACK_TARGET) > + if (!m_clientToIDMap.isEmpty() && page()) { > + Vector<WebCore::MediaPlaybackTargetClient*> clients; > + copyKeysToVector(m_clientToIDMap, clients); > + for (auto client : clients) > + removePlaybackTargetPickerClient(*client); > + } > +#endif this can just be: for (auto client : m_clientToIDMap.keys()) ....
Brady Eidson
Comment 5 2015-05-07 14:49:42 PDT
Comment on attachment 252630 [details] Proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=252630&action=review > Source/WebCore/ChangeLog:8 > + No new tests (OOPS!). OOPs! > Source/WebCore/ChangeLog:11 > + (WebCore::Document::prepareForDestruction): Unregister all target picker clients. Doing it in prepareForDestruction is reasonable, and fixes the letter of the bug, but not the spirit of the bug. In Frame::setDocument(): if (m_doc && !m_doc->inPageCache()) m_doc->prepareForDestruction(); What about if the current document goes into the page cache? Should probably be unregistered then as well. Simple notifications: void Document::documentWillSuspendForPageCache() void Document::documentDidResumeFromPageCache()
Eric Carlson
Comment 6 2015-05-08 09:18:01 PDT
(In reply to comment #4) > Comment on attachment 252630 [details] > Proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=252630&action=review > > r=me, with nit. > > > Source/WebCore/dom/Document.cpp:2254 > > +#if ENABLE(WIRELESS_PLAYBACK_TARGET) > > + if (!m_clientToIDMap.isEmpty() && page()) { > > + Vector<WebCore::MediaPlaybackTargetClient*> clients; > > + copyKeysToVector(m_clientToIDMap, clients); > > + for (auto client : clients) > > + removePlaybackTargetPickerClient(*client); > > + } > > +#endif > > this can just be: > > for (auto client : m_clientToIDMap.keys()) .... That won't work because .keys() returns an iterator and removePlaybackTargetPickerClient mutates the hash.
Eric Carlson
Comment 7 2015-05-08 09:18:50 PDT
(In reply to comment #5) > Comment on attachment 252630 [details] > Proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=252630&action=review > > > Source/WebCore/ChangeLog:11 > > + (WebCore::Document::prepareForDestruction): Unregister all target picker clients. > > Doing it in prepareForDestruction is reasonable, and fixes the letter of the > bug, but not the spirit of the bug. > > In Frame::setDocument(): > if (m_doc && !m_doc->inPageCache()) > m_doc->prepareForDestruction(); > > What about if the current document goes into the page cache? Should > probably be unregistered then as well. > > Simple notifications: > void Document::documentWillSuspendForPageCache() > void Document::documentDidResumeFromPageCache() Great suggestion, thanks!
Eric Carlson
Comment 8 2015-05-08 09:19:34 PDT
Created attachment 252720 [details] Proposed patch.
Eric Carlson
Comment 9 2015-05-08 09:26:00 PDT
Created attachment 252721 [details] Updated patch.
Brady Eidson
Comment 10 2015-05-08 09:28:26 PDT
Comment on attachment 252721 [details] Updated patch. View in context: https://bugs.webkit.org/attachment.cgi?id=252721&action=review R+ with the guards fixed. > Source/WebCore/html/HTMLMediaElement.cpp:465 > +#if ENABLE(WIRELESS_PLAYBACK_TARGET) > + document.registerForPageCacheSuspensionCallbacks(this); > +#endif Page cache registration is #if guarded here... > Source/WebCore/html/HTMLMediaElement.cpp:485 > +#if ENABLE(WIRELESS_PLAYBACK_TARGET) > document.unregisterForVisibilityStateChangedCallbacks(this); > +#endif I think these #if guards were meant to go down below... > Source/WebCore/html/HTMLMediaElement.cpp:497 > + document.unregisterForPageCacheSuspensionCallbacks(this); Unregistration is *not* #if guarded.
Eric Carlson
Comment 11 2015-05-08 09:57:44 PDT
Created attachment 252725 [details] Patch for landing.
Eric Carlson
Comment 12 2015-05-08 09:59:47 PDT
Created attachment 252726 [details] Patch for landing.
WebKit Commit Bot
Comment 13 2015-05-08 10:01:29 PDT
Comment on attachment 252726 [details] Patch for landing. Rejecting attachment 252726 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 252726, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in Source/WebCore/ChangeLog contains OOPS!. Full output: http://webkit-queues.appspot.com/results/5435357743022080
Eric Carlson
Comment 14 2015-05-08 10:57:47 PDT
Created attachment 252730 [details] Patch for landing, this time with one less OOPs
WebKit Commit Bot
Comment 15 2015-05-08 11:47:03 PDT
Comment on attachment 252730 [details] Patch for landing, this time with one less OOPs Clearing flags on attachment: 252730 Committed r184001: <http://trac.webkit.org/changeset/184001>
Note You need to log in before you can comment on or make changes to this bug.