RESOLVED FIXED 240326
Web Inspector: support EventSource resource type in Network Panel
https://bugs.webkit.org/show_bug.cgi?id=240326
Summary Web Inspector: support EventSource resource type in Network Panel
Yury Semikhatsky
Reported 2022-05-11 17:54:36 PDT
Web Inspector: support EventSource resource type in Network Panel
Attachments
Patch (17.23 KB, patch)
2022-05-11 18:00 PDT, Yury Semikhatsky
no flags
Patch (18.20 KB, patch)
2022-05-12 14:25 PDT, Yury Semikhatsky
no flags
Patch (18.59 KB, patch)
2022-05-12 14:26 PDT, Yury Semikhatsky
no flags
Patch (18.95 KB, patch)
2022-05-13 09:39 PDT, Yury Semikhatsky
ews-feeder: commit-queue-
Patch (18.98 KB, patch)
2022-05-16 11:44 PDT, Yury Semikhatsky
no flags
Patch (20.32 KB, patch)
2022-05-16 14:37 PDT, Yury Semikhatsky
no flags
Patch (19.53 KB, patch)
2022-05-17 16:02 PDT, Yury Semikhatsky
yurys: commit-queue+
Yury Semikhatsky
Comment 1 2022-05-11 18:00:27 PDT
EWS Watchlist
Comment 2 2022-05-11 18:02:20 PDT
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Devin Rousso
Comment 3 2022-05-12 11:07:21 PDT
Comment on attachment 459193 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459193&action=review > Source/WebInspectorUI/UserInterface/Models/Resource.js:178 > + return WI.UIString("EventSources"); > + return WI.UIString("EventSource"); Can you please add a comment to these localized strings so that localizers can understand this comes from the JS EventSource API (i.e. a named term/thing, not the programmer forgetting to add a space)? > LayoutTests/http/tests/inspector/network/eventsource-type.html:8 > + internals.settings.setHyperlinkAuditingEnabled(true); is this related? > LayoutTests/http/tests/inspector/network/eventsource-type.html:11 > + const eventSource = new EventSource('resources/event-source.py'); Style: please use four spaces > LayoutTests/http/tests/inspector/network/eventsource-type.html:28 > + test(resolve, reject) { NIT: can we rewrite this with an `async test()` instead so that it's a bit nicer to read? > LayoutTests/http/tests/inspector/network/eventsource-type.html:40 > + return resource.requestContentFromBackend(); ditto (:11) > LayoutTests/http/tests/inspector/network/eventsource-type.html:43 > + resourceHandler(resource, content); ditto (:11) > LayoutTests/http/tests/inspector/network/eventsource-type.html:51 > + function alwaysTest(resource) { > + } oops? > LayoutTests/http/tests/inspector/network/eventsource-type.html:54 > + name: "Resource.Type.EventSource.200", are there any other cases we should test? what about an `EventSource` that has multiple messages? > LayoutTests/http/tests/inspector/network/eventsource-type.html:59 > + InspectorTest.expectEqual(JSON.stringify(content), '{"body":"Success\\r\\n","base64Encoded":false}', "Resource should receive 'Success' in the response."); This seems a bit fragile to change if we modify `WI.SourceCode`. Can we instead check that `content.body` is a certain value and `content.base64Encoded` is a certain value (i.e. allow for other keys to be added that are not relevant)? > LayoutTests/http/tests/inspector/network/resources/event-source.py:7 > +# status = int(parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True).get('status', [200])[0]) oops? > LayoutTests/http/tests/inspector/network/resources/event-source.py:13 > + 'status: 200\r\n' do we have to use a carriage return? or can we just use only newlines?
Yury Semikhatsky
Comment 4 2022-05-12 14:24:50 PDT
Comment on attachment 459193 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459193&action=review >> Source/WebInspectorUI/UserInterface/Models/Resource.js:178 >> + return WI.UIString("EventSource"); > > Can you please add a comment to these localized strings so that localizers can understand this comes from the JS EventSource API (i.e. a named term/thing, not the programmer forgetting to add a space)? Added to localizedStrings.js, I don't see comments for any other types so please let me know if you meant a different location. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:8 >> + internals.settings.setHyperlinkAuditingEnabled(true); > > is this related? Removed. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:11 >> + const eventSource = new EventSource('resources/event-source.py'); > > Style: please use four spaces Done. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:28 >> + test(resolve, reject) { > > NIT: can we rewrite this with an `async test()` instead so that it's a bit nicer to read? Done. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:40 >> + return resource.requestContentFromBackend(); > > ditto (:11) Done. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:43 >> + resourceHandler(resource, content); > > ditto (:11) Done. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:51 >> + } > > oops? Removed. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:54 >> + name: "Resource.Type.EventSource.200", > > are there any other cases we should test? > > what about an `EventSource` that has multiple messages? Added another test with 3 events. >> LayoutTests/http/tests/inspector/network/eventsource-type.html:59 >> + InspectorTest.expectEqual(JSON.stringify(content), '{"body":"Success\\r\\n","base64Encoded":false}', "Resource should receive 'Success' in the response."); > > This seems a bit fragile to change if we modify `WI.SourceCode`. Can we instead check that `content.body` is a certain value and `content.base64Encoded` is a certain value (i.e. allow for other keys to be added that are not relevant)? Fixed. >> LayoutTests/http/tests/inspector/network/resources/event-source.py:7 >> +# status = int(parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True).get('status', [200])[0]) > > oops? Removed. >> LayoutTests/http/tests/inspector/network/resources/event-source.py:13 >> + 'status: 200\r\n' > > do we have to use a carriage return? or can we just use only newlines? I believe we do by the HTTP spec.
Yury Semikhatsky
Comment 5 2022-05-12 14:25:17 PDT
Yury Semikhatsky
Comment 6 2022-05-12 14:26:29 PDT
Yury Semikhatsky
Comment 7 2022-05-12 14:28:16 PDT
Comment on attachment 459193 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459193&action=review >>> LayoutTests/http/tests/inspector/network/resources/event-source.py:13 >>> + 'status: 200\r\n' >> >> do we have to use a carriage return? or can we just use only newlines? > > I believe we do by the HTTP spec. To clarify, I updated the code to send events separated by \n as the spec permits and preserved \r\n for the headers.
Devin Rousso
Comment 8 2022-05-12 14:57:59 PDT
Comment on attachment 459250 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459250&action=review r=me, neat! > Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:647 > +/* Display name for the type of network requests sent via EventSource API (https://developer.mozilla.org/en-US/docs/Web/API/EventSource) */ This needs to be added in the `WI.UIString` in the code as well, as otherwise the next time someone generates this file it wont have this comment. ``` WI.UIString("EventSource", "Display name for the type of network requests sent via EventSource API (https://developer.mozilla.org/en-US/docs/Web/API/EventSource)") ``` > Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:649 > +localizedStrings["EventSources"] = "EventSources"; please also add a similar comment for this too :)
Yury Semikhatsky
Comment 9 2022-05-13 09:35:37 PDT
Comment on attachment 459250 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459250&action=review >> Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:647 >> +/* Display name for the type of network requests sent via EventSource API (https://developer.mozilla.org/en-US/docs/Web/API/EventSource) */ > > This needs to be added in the `WI.UIString` in the code as well, as otherwise the next time someone generates this file it wont have this comment. > ``` > WI.UIString("EventSource", "Display name for the type of network requests sent via EventSource API (https://developer.mozilla.org/en-US/docs/Web/API/EventSource)") > ``` Done. >> Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:649 >> +localizedStrings["EventSources"] = "EventSources"; > > please also add a similar comment for this too :) Done.
Yury Semikhatsky
Comment 10 2022-05-13 09:38:30 PDT
> EWS has detected build failure on Windows-EWS while testing Patch 459250 for Bug 240326. > > Full details are available at: https://ews-> build.webkit.org/#/builders/10/builds/134348 > > Error lines: > > C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorPageAgent.cpp(239,46): error C2838: 'EventSource': illegal qualified name in member declaration (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-3.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj] > C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorPageAgent.cpp(239,1): error C2440: 'return': cannot con vert from 'WebCore::InspectorPageAgent::ResourceType' to 'Inspector::Protocol::Page::ResourceType' (compiling source file > C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-3.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj] I'm not sure what to do about these errors. Looks like Windows needs a clean build, is there a way to trigger that?
Yury Semikhatsky
Comment 11 2022-05-13 09:39:00 PDT
Yury Semikhatsky
Comment 12 2022-05-16 09:44:52 PDT
(In reply to Yury Semikhatsky from comment #10) > > EWS has detected build failure on Windows-EWS while testing Patch 459250 for Bug 240326. > > > > Full details are available at: https://ews-> build.webkit.org/#/builders/10/builds/134348 > > > > Error lines: > > > > C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorPageAgent.cpp(239,46): error C2838: 'EventSource': illegal qualified name in member declaration (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-3.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj] > > C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorPageAgent.cpp(239,1): error C2440: 'return': cannot con vert from 'WebCore::InspectorPageAgent::ResourceType' to 'Inspector::Protocol::Page::ResourceType' (compiling source file > C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-3.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj] > > I'm not sure what to do about these errors. Looks like Windows needs a clean > build, is there a way to trigger that? Fuji, any advice how to deal with this? The patch compiles locally on my Windows box without errors.
Yury Semikhatsky
Comment 13 2022-05-16 11:44:19 PDT
Yury Semikhatsky
Comment 14 2022-05-16 11:45:54 PDT
(In reply to Yury Semikhatsky from comment #12) > (In reply to Yury Semikhatsky from comment #10) > > > EWS has detected build failure on Windows-EWS while testing Patch 459250 for Bug 240326. > > > > > > Full details are available at: https://ews-> build.webkit.org/#/builders/10/builds/134348 > > > > > > Error lines: > > > > > > C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorPageAgent.cpp(239,46): error C2838: 'EventSource': illegal qualified name in member declaration (compiling source file C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-3.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj] > > > C:\cygwin\home\buildbot\worker\Windows-EWS\build\Source\WebCore\inspector/agents/InspectorPageAgent.cpp(239,1): error C2440: 'return': cannot con vert from 'WebCore::InspectorPageAgent::ResourceType' to 'Inspector::Protocol::Page::ResourceType' (compiling source file > C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource-84c9f43f-3.cpp) [C:\cygwin\home\buildbot\worker\Windows-EWS\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj] > > > > I'm not sure what to do about these errors. Looks like Windows needs a clean > > build, is there a way to trigger that? > > Fuji, any advice how to deal with this? The patch compiles locally on my > Windows box without errors. Ok, I cannot make sense of that error, looks like MSVS compiler problem to me given that it compiles with gcc and clang. Renamed the enum value to EventSource -> EventSourceResource which matches other names in the same enum and will hopefully fix the windows compilation.
Fujii Hironori
Comment 15 2022-05-16 13:05:09 PDT
It looks like a incremental build problem. AppleWin is still using CMake Visual Studio generator which is causing some incremental build problems. Fix the bug if you have a time. I think the next incremental build will succeed. Most WebKit developers just ignore the problem.
Yury Semikhatsky
Comment 16 2022-05-16 14:37:51 PDT
Yury Semikhatsky
Comment 17 2022-05-16 14:41:33 PDT
(In reply to Fujii Hironori from comment #15) > It looks like a incremental build problem. AppleWin is still using CMake > Visual Studio generator which is causing some incremental build problems. > Fix the bug if you have a time. > I think the next incremental build will succeed. Most WebKit developers just > ignore the problem. Got it, I let's see if commit-queue allows to submit with that bot failure, otherwise I guess I'll have to figure out how to do it manually.
Yury Semikhatsky
Comment 18 2022-05-16 14:43:18 PDT
Devin, I've added Requester enum to the list of exceptions which are allowed to have all upper case values. PTAL.
Fujii Hironori
Comment 19 2022-05-16 14:44:46 PDT
(In reply to Yury Semikhatsky from comment #17) > let's see if commit-queue allows to submit with that bot failure, The commit bot is checking only mac builds before landing.
Fujii Hironori
Comment 20 2022-05-17 14:34:37 PDT
(In reply to Fujii Hironori from comment #15) > It looks like a incremental build problem. AppleWin is still using CMake > Visual Studio generator which is causing some incremental build problems. Filed: Bug 240540 – [CMake][Visual Studio] PrivateHeaders/JavaScriptCore/InspectorProtocolObjects.h isn't regenerated in incremental builds
Yury Semikhatsky
Comment 21 2022-05-17 16:02:37 PDT
Yury Semikhatsky
Comment 22 2022-05-17 16:50:45 PDT
EWS
Comment 23 2022-05-17 18:18:35 PDT
Committed r294374 (250671@main): <https://commits.webkit.org/250671@main> Reviewed commits have been landed. Closing PR #707 and removing active labels.
Radar WebKit Bug Importer
Comment 24 2022-05-17 18:19:14 PDT
Note You need to log in before you can comment on or make changes to this bug.