RESOLVED FIXED Bug 189874
Web Inspector: display fullscreen enter/exit events in Timelines and Network node waterfalls
https://bugs.webkit.org/show_bug.cgi?id=189874
Summary Web Inspector: display fullscreen enter/exit events in Timelines and Network ...
Devin Rousso
Reported 2018-09-21 19:20:58 PDT
It is often useful to know when an element/page entered or existed fullscreen mode, especially if you can relate that event to nearby timeline/network activity.
Attachments
[Patch] WIP (16.60 KB, patch)
2018-10-08 14:12 PDT, Devin Rousso
no flags
[Patch] WIP (16.63 KB, patch)
2018-10-08 23:01 PDT, Devin Rousso
no flags
Patch (27.82 KB, patch)
2018-10-10 23:59 PDT, Devin Rousso
no flags
Archive of layout-test-results from ews103 for mac-sierra (2.33 MB, application/zip)
2018-10-11 01:05 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews116 for mac-sierra (3.11 MB, application/zip)
2018-10-11 02:05 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews115 for mac-sierra (3.15 MB, application/zip)
2018-10-11 04:02 PDT, EWS Watchlist
no flags
Patch (27.66 KB, patch)
2018-10-11 11:52 PDT, Devin Rousso
no flags
Patch (27.71 KB, patch)
2018-10-11 12:44 PDT, Devin Rousso
no flags
Patch (35.32 KB, patch)
2018-10-11 21:28 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2018-09-21 19:21:23 PDT
Devin Rousso
Comment 2 2018-10-08 14:12:39 PDT
Created attachment 351813 [details] [Patch] WIP
Devin Rousso
Comment 3 2018-10-08 23:01:33 PDT
Created attachment 351861 [details] [Patch] WIP
Devin Rousso
Comment 4 2018-10-10 23:59:56 PDT
Created attachment 352025 [details] Patch Rebase and tests
EWS Watchlist
Comment 5 2018-10-11 01:05:27 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 6 2018-10-11 01:05:29 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 7 2018-10-11 02:05:44 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 8 2018-10-11 02:05:46 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 9 2018-10-11 04:02:31 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 10 2018-10-11 04:02:33 PDT Comment hidden (obsolete)
Devin Rousso
Comment 11 2018-10-11 11:52:34 PDT
Devin Rousso
Comment 12 2018-10-11 12:44:57 PDT
Joseph Pecoraro
Comment 13 2018-10-11 19:00:35 PDT
Comment on attachment 352066 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352066&action=review r=me > Source/WebInspectorUI/UserInterface/Models/DOMNode.js:144 > + let lowerCaseName = this.localName() || this.nodeName().toLowerCase(); > + if (lowerCaseName === "video" || lowerCaseName === "audio") Should we make this a helper? `_isMediaElement` or `_shouldListenForEventListeners`? It seems like something that might be easier to find in the future. > Source/WebInspectorUI/UserInterface/Models/DOMNode.js:747 > + && domEvent.timestamp - previousDOMEvent.timestamp < 0.001 Whats up with this? Should we just give each domEvent a sequential identifier, and compare those? That seems like it would prevent this fuzzy matching. Something like: this._addDOMEvent({ eventName, timestamp: ..., data, __identifier: DOMManager.nextDOMEventSequentialIdentifier++, }); > Source/WebInspectorUI/UserInterface/Views/DOMEventsBreakdownView.js:106 > + let fullscreenDOMEvents = WI.DOMNode.getFullscreenDOMEvents(this._domEvents); > + let fullscreenRanges = fullscreenDOMEvents.reduce((accumulator, current) => { > + let {enabled} = current.data; > + if (enabled || !accumulator.length) { > + accumulator.push({ > + startTimestamp: enabled ? current.timestamp : startTimestamp, > + }); > + } > + accumulator.lastValue.endTimestamp = (enabled && current === fullscreenDOMEvents.lastValue) ? endTimestamp : current.timestamp; > + return accumulator; > + }, []); This doesn't read any better than a for-loop to me. Is there any advantage to using reduce here? > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:685 > + for (let i = 0; i < fullscreenDOMEvents.length; i += 2) { Lets assert that we have pairs. Something like: console.assert((fullscreenDOMEvents.length % 2) === 0); If someone were to change getFullscreenDOMEvents to not elide common `enabled` siblings then this would help catch that. > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:691 > + let originator = fullscreenDOMEvents[i].originator; If we hit the line 679 case above then range starts without a known originator but ends with a known originator and we would miss that here. I'd suggest: let originator = fullscreenDOMEvents[i].originator || fullscreenDOMEvents[i + 1].originator; > LayoutTests/ChangeLog:7 > + Reviewed by Joseph Pecoraro. lol? > LayoutTests/http/tests/inspector/dom/didFireEvent.html:43 > + Style: Remove empty line. > LayoutTests/http/tests/inspector/dom/didFireEvent.html:68 > + InspectorTest.pass(`Should recieve a "webkitfullscreenchange" event.`); Typo: recieve => receive Aside: This typo exists in LayoutTests/inspector/dom/getSupportedEventNames.html as well! > LayoutTests/http/tests/inspector/dom/didFireEvent.html:140 > + <button id="fullscreen"></button> It looks like this button is not needed. Was it for local testing?
Devin Rousso
Comment 14 2018-10-11 19:20:17 PDT
Comment on attachment 352066 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352066&action=review >> Source/WebInspectorUI/UserInterface/Models/DOMNode.js:144 >> + if (lowerCaseName === "video" || lowerCaseName === "audio") > > Should we make this a helper? `_isMediaElement` or `_shouldListenForEventListeners`? It seems like something that might be easier to find in the future. `_shouldListenForEventListeners` sounds like a good name. >> Source/WebInspectorUI/UserInterface/Models/DOMNode.js:747 >> + && domEvent.timestamp - previousDOMEvent.timestamp < 0.001 > > Whats up with this? Should we just give each domEvent a sequential identifier, and compare those? That seems like it would prevent this fuzzy matching. > > Something like: > > this._addDOMEvent({ > eventName, > timestamp: ..., > data, > __identifier: DOMManager.nextDOMEventSequentialIdentifier++, > }); This is for the situation where an element and one of it's ancestors are listening for the same event: #document (listening for "webkitfullscreenchange") <video> (listening for "webkitfullscreenchange") If we cause <video> to go fullscreen, then both <video> and #document will get a "webkitfullscreenchange" event, but they will be slightly off in timing. Furthermore, both events will be sent directly to <video>, since `EventFiredCallback` uses the event's absolute `target`, not it's `currentTarget` (this way we get the actual node that triggered the fullscreen, not the #document). We don't want both events to appear for <video> (it would call `_addDOMEvent` for the #document event) since it really only received one of the events. We also can't use the serial identifier since we are actually receiving two distinct event payloads. I think a better solution may be to rework `EventFiredCallback` to keep track of the last event fired to ensure that it is never sent to the frontend more than once. >> Source/WebInspectorUI/UserInterface/Views/DOMEventsBreakdownView.js:106 >> + }, []); > > This doesn't read any better than a for-loop to me. Is there any advantage to using reduce here? No reason anymore. I used to chain it with a `forEach`, but I have since reworked it. I'll change it. >> LayoutTests/ChangeLog:7 >> + Reviewed by Joseph Pecoraro. > > lol? LOL I have no idea how this got here. I might've accidentally added it when editing some of the blocking patches 😅 >> LayoutTests/http/tests/inspector/dom/didFireEvent.html:68 >> + InspectorTest.pass(`Should recieve a "webkitfullscreenchange" event.`); > > Typo: recieve => receive > > Aside: This typo exists in LayoutTests/inspector/dom/getSupportedEventNames.html as well! That was also probably my fault. I hate english sometimes 😑 >> LayoutTests/http/tests/inspector/dom/didFireEvent.html:140 >> + <button id="fullscreen"></button> > > It looks like this button is not needed. Was it for local testing? This was used when I was trying to figure out the debug WK1 issue. I tried using a "mousedown" instead of "keydown".
Devin Rousso
Comment 15 2018-10-11 21:28:36 PDT
Joseph Pecoraro
Comment 16 2018-10-15 13:50:00 PDT
Comment on attachment 352134 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352134&action=review New code looks good to me. > Source/JavaScriptCore/inspector/protocol/DOM.json:670 > + { "name": "data", "type": "object", "optional": true, "description": "Holds ancillary information about the event or its target." } We'll want to update our ITMLKit friends.
WebKit Commit Bot
Comment 17 2018-10-25 15:59:37 PDT
Comment on attachment 352134 [details] Patch Clearing flags on attachment: 352134 Committed r237431: <https://trac.webkit.org/changeset/237431>
WebKit Commit Bot
Comment 18 2018-10-25 15:59:39 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.