Bug 135120

Summary: Web Inspector: the inspector should live in its own process
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bfulgham, buildbot, cdumez, commit-queue, graouts, gyuyoung.kim, joepeck, mkwst, ossy, rakuco, rniwa, ryuan.choi, sam, sergio, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 137522    
Bug Blocks: 135830, 136350    
Attachments:
Description Flags
WIP
none
WIP (correct)
none
WIP (latest)
none
WIP (almost final)
none
WIP (almost final x2)
none
WIP (almost final x3)
none
WIP (almost final x4)
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion
none
WIP (latest final)
none
WIP (For Bots)
none
WIP (Rebased For Bots)
none
WIP (Binary Patch)
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch andersca: review+, andersca: commit-queue-

Brian Burg
Reported 2014-07-21 10:10:02 PDT
It would be approximately way easier to profile if it were isolated from the inspected page's Web Content process.
Attachments
WIP (83.83 KB, patch)
2014-09-04 22:56 PDT, Timothy Hatcher
no flags
WIP (correct) (94.26 KB, patch)
2014-09-04 22:58 PDT, Timothy Hatcher
no flags
WIP (latest) (117.19 KB, patch)
2014-09-05 17:34 PDT, Timothy Hatcher
no flags
WIP (almost final) (118.08 KB, patch)
2014-09-08 11:32 PDT, Timothy Hatcher
no flags
WIP (almost final x2) (117.63 KB, patch)
2014-09-08 12:31 PDT, Timothy Hatcher
no flags
WIP (almost final x3) (120.09 KB, patch)
2014-09-08 13:08 PDT, Timothy Hatcher
no flags
WIP (almost final x4) (120.42 KB, patch)
2014-09-08 16:37 PDT, Timothy Hatcher
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion (600.07 KB, application/zip)
2014-09-08 19:29 PDT, Build Bot
no flags
WIP (latest final) (121.31 KB, patch)
2014-09-12 10:29 PDT, Timothy Hatcher
no flags
WIP (For Bots) (135.61 KB, patch)
2014-09-21 11:15 PDT, Timothy Hatcher
no flags
WIP (Rebased For Bots) (135.54 KB, patch)
2014-09-21 13:18 PDT, Timothy Hatcher
no flags
WIP (Binary Patch) (136.41 KB, patch)
2014-09-21 16:09 PDT, Timothy Hatcher
no flags
Patch (154.15 KB, patch)
2014-09-21 20:06 PDT, Timothy Hatcher
no flags
Patch (154.04 KB, patch)
2014-09-21 23:56 PDT, Timothy Hatcher
no flags
Patch (154.56 KB, patch)
2014-09-22 08:01 PDT, Timothy Hatcher
no flags
Patch (156.45 KB, patch)
2014-09-22 15:14 PDT, Timothy Hatcher
no flags
Patch (156.66 KB, patch)
2014-09-22 16:27 PDT, Timothy Hatcher
andersca: review+
andersca: commit-queue-
Radar WebKit Bug Importer
Comment 1 2014-07-21 10:10:45 PDT
Timothy Hatcher
Comment 2 2014-07-22 11:51:56 PDT
Internal dupe of <rdar://problem/11749409>.
Timothy Hatcher
Comment 3 2014-08-28 14:49:19 PDT
I am working on this.
Timothy Hatcher
Comment 4 2014-09-04 22:56:47 PDT
Timothy Hatcher
Comment 5 2014-09-04 22:58:18 PDT
Created attachment 237677 [details] WIP (correct)
Timothy Hatcher
Comment 6 2014-09-05 17:34:42 PDT
Created attachment 237727 [details] WIP (latest)
Brian Burg
Comment 7 2014-09-05 18:05:04 PDT
Comment on attachment 237727 [details] WIP (latest) View in context: https://bugs.webkit.org/attachment.cgi?id=237727&action=review Looks pretty slick overall. Seeking some clarification on the code path for GTK/EFL: does it change at all? Some of the messages looked deleted but I didn't see any updates to the other platform-specific files. > Source/WebCore/inspector/InspectorController.cpp:198 > +void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* inspectorFrontendClient) Before, the Controller owned the client. Who owns it now? Can this pass a reference? > Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:-137 > - , m_frontendClient(0) This should still be initialized to nullptr, right? > Source/WebKit2/UIProcess/WebInspectorProxy.cpp:110 > pageGroup->preferences().setLogsPageMessagesToSystemConsoleEnabled(true); Can you update the comment above this to mean "developers can inspector the inspector in debug mode _without changing any settings_" ? AFAICT, that's what it does. > Source/WebKit2/WebProcess/WebPage/WebInspector.cpp:1 > /* Per the naming conventions, files that implement the InspectorProcess probably should be in Source/WebKit2/InspectorProcess/* not in WebProcess. > Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp:30 > +#include "WebPage.h" newline after ENABLE(...)
Timothy Hatcher
Comment 8 2014-09-05 18:44:50 PDT
Comment on attachment 237727 [details] WIP (latest) View in context: https://bugs.webkit.org/attachment.cgi?id=237727&action=review >> Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:-137 >> - , m_frontendClient(0) > > This should still be initialized to nullptr, right? It was removed. They aren't in the same process anymore. >> Source/WebKit2/UIProcess/WebInspectorProxy.cpp:110 >> pageGroup->preferences().setLogsPageMessagesToSystemConsoleEnabled(true); > > Can you update the comment above this to mean "developers can inspector the inspector in debug mode _without changing any settings_" ? AFAICT, that's what it does. Sure. >> Source/WebKit2/WebProcess/WebPage/WebInspector.cpp:1 >> /* > > Per the naming conventions, files that implement the InspectorProcess probably should be in Source/WebKit2/InspectorProcess/* not in WebProcess. They are in WebProcess, just two different web processes now.
Timothy Hatcher
Comment 9 2014-09-05 18:53:37 PDT
Comment on attachment 237727 [details] WIP (latest) View in context: https://bugs.webkit.org/attachment.cgi?id=237727&action=review >>> Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:-137 >>> - , m_frontendClient(0) >> >> This should still be initialized to nullptr, right? > > It was removed. They aren't in the same process anymore. Oh, this is WK1. m_frontendClient is a unique_ptr now which defaults to nullptr.
Timothy Hatcher
Comment 10 2014-09-05 18:55:25 PDT
Comment on attachment 237727 [details] WIP (latest) View in context: https://bugs.webkit.org/attachment.cgi?id=237727&action=review >> Source/WebCore/inspector/InspectorController.cpp:198 >> +void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* inspectorFrontendClient) > > Before, the Controller owned the client. Who owns it now? Can this pass a reference? The higher level objects in WK2 and WK1 own it now with a lifetime of the Page. It might be possible to pass as a reference, but it needs to be nullable.
Timothy Hatcher
Comment 11 2014-09-08 11:32:47 PDT
Created attachment 237798 [details] WIP (almost final) Posting to let EWS try things while I look into a layout test hang.
WebKit Commit Bot
Comment 12 2014-09-08 11:35:05 PDT
Attachment 237798 [details] did not pass style-queue: ERROR: Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp:32: Alphabetical sorting problem. [build/include_order] [4] ERROR: Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp:39: Alphabetical sorting problem. [build/include_order] [4] ERROR: Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp:42: Alphabetical sorting problem. [build/include_order] [4] ERROR: Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp:145: Declaration has space between type name and * in const char *sideString [whitespace/declaration] [3] ERROR: Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h:39: Should have a space between // and comment [whitespace/comments] [4] ERROR: Source/WebCore/WebCore.exp.in:0: Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script [list/order] [5] Total errors found: 6 in 38 files If any of these errors are false positives, please file a bug against check-webkit-style.
Timothy Hatcher
Comment 13 2014-09-08 12:31:38 PDT
Created attachment 237803 [details] WIP (almost final x2)
Timothy Hatcher
Comment 14 2014-09-08 13:08:49 PDT
Created attachment 237806 [details] WIP (almost final x3)
Timothy Hatcher
Comment 15 2014-09-08 16:37:33 PDT
Created attachment 237818 [details] WIP (almost final x4)
Build Bot
Comment 16 2014-09-08 19:29:06 PDT
Comment on attachment 237818 [details] WIP (almost final x4) Attachment 237818 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5085997704413184 New failing tests: http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash.html
Build Bot
Comment 17 2014-09-08 19:29:12 PDT
Created attachment 237830 [details] Archive of layout-test-results from webkit-ews-08 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-08 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Timothy Hatcher
Comment 18 2014-09-12 10:29:31 PDT
Created attachment 238037 [details] WIP (latest final)
Brian Burg
Comment 19 2014-09-12 23:21:37 PDT
Comment on attachment 238037 [details] WIP (latest final) View in context: https://bugs.webkit.org/attachment.cgi?id=238037&action=review Will look at this more later, but some quick comments: * Missing ChangeLogs. * Many tests in LayoutTests/inspector/ will crash under WK1 if you force them to run. This is a regression. * Saving resources seems to work, but it names the downloaded files as "Unknown". Is this a regression? > Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp:185 > + // Set a default sizes based on InspectorFrontendClientLocal. grammar.
Brian Burg
Comment 20 2014-09-13 11:26:27 PDT
It would also be nice to name the inspector process something different from com.apple.WebKit.WebContent[.Development] so that different web processes can be easily distinguished from Xcode.
Brian Burg
Comment 21 2014-09-13 15:58:57 PDT
Looks like Safari expects some symbols that were removed in this patch. Maybe these should be stubbed out and deprecated until Safari no longer uses them. dyld: lazy symbol binding failed: Symbol not found: _WKInspectorIsProfilingJavaScript Referenced from: /System/Library/StagedFrameworks/Safari/Safari.framework/Versions/A/Safari Expected in: /Users/burg/repos/replay-staging/OpenSource/WebKitBuild/Debug/WebKit2.framework/Versions/A/WebKit2
Brian Burg
Comment 22 2014-09-13 16:42:30 PDT
(In reply to comment #21) > Looks like Safari expects some symbols that were removed in this patch. Maybe these should be stubbed out and deprecated until Safari no longer uses them. > > dyld: lazy symbol binding failed: Symbol not found: _WKInspectorIsProfilingJavaScript > Referenced from: /System/Library/StagedFrameworks/Safari/Safari.framework/Versions/A/Safari > Expected in: /Users/burg/repos/replay-staging/OpenSource/WebKitBuild/Debug/WebKit2.framework/Versions/A/WebKit2 To clarify, this happens when you open the Develop menu in Safari launched from `run-safari`. Another bug (which I'll have to unapply the patch to get around, for now): the `pagehide` event is not getting fired when the inspector closes, so breakpoints and the current view state are not being persisted across reopening the inspector.
Timothy Hatcher
Comment 23 2014-09-13 18:27:59 PDT
(In reply to comment #20) > It would also be nice to name the inspector process something different from com.apple.WebKit.WebContent[.Development] so that different web processes can be easily distinguished from Xcode. Joe and I talked about this too. One issue is we are not guaranteed to be in our own process. Safari sets the process limit to 20. We should force our own process that all inspectors share, then we can name it properly.
Timothy Hatcher
Comment 24 2014-09-13 18:28:46 PDT
(In reply to comment #21) > Looks like Safari expects some symbols that were removed in this patch. Maybe these should be stubbed out and deprecated until Safari no longer uses them. > > dyld: lazy symbol binding failed: Symbol not found: _WKInspectorIsProfilingJavaScript > Referenced from: /System/Library/StagedFrameworks/Safari/Safari.framework/Versions/A/Safari > Expected in: /Users/burg/repos/replay-staging/OpenSource/WebKitBuild/Debug/WebKit2.framework/Versions/A/WebKit2 Oops. Yeah, we need to stub those out.
Timothy Hatcher
Comment 25 2014-09-13 18:33:15 PDT
(In reply to comment #22) > Another bug (which I'll have to unapply the patch to get around, for now): the `pagehide` event is not getting fired when the inspector closes, so breakpoints and the current view state are not being persisted across reopening the inspector. I thought Joe was having issues with page hide not firing already?
Brian Burg
Comment 26 2014-09-13 20:14:24 PDT
(In reply to comment #25) > (In reply to comment #22) > > Another bug (which I'll have to unapply the patch to get around, for now): the `pagehide` event is not getting fired when the inspector closes, so breakpoints and the current view state are not being persisted across reopening the inspector. > > I thought Joe was having issues with page hide not firing already? I recall some discussion about this, but can't find a bug. And, it is definitely a regression with this patch applied vs not.
Joseph Pecoraro
Comment 27 2014-09-15 11:12:35 PDT
(In reply to comment #26) > (In reply to comment #25) > > (In reply to comment #22) > > > Another bug (which I'll have to unapply the patch to get around, for now): the `pagehide` event is not getting fired when the inspector closes, so breakpoints and the current view state are not being persisted across reopening the inspector. > > > > I thought Joe was having issues with page hide not firing already? > > I recall some discussion about this, but can't find a bug. And, it is definitely a regression with this patch applied vs not. In my last tip of tree build page hide events were working as expected. Were you still seeing issues? That will certainly affect state restoration as well.
Timothy Hatcher
Comment 28 2014-09-21 11:15:54 PDT
Created attachment 238427 [details] WIP (For Bots) This version passes inspector and inspector-protocol tests. Still need ChangeLogs, then I will post it for review. Checking EWS first.
Brian Burg
Comment 29 2014-09-21 12:03:37 PDT
Comment on attachment 238427 [details] WIP (For Bots) View in context: https://bugs.webkit.org/attachment.cgi?id=238427&action=review > Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js:127 > + console.assert(InspectorFrontendAPI[methodName], "Unexpected InspectorFrontendAPI method name: " + InspectorFrontendAPI[methodName]); I wish we could do: if (!console.assert(pred, ...)) return; But this would require some more intelligent rewriting to strip console assertions.
Timothy Hatcher
Comment 30 2014-09-21 13:18:47 PDT
Created attachment 238430 [details] WIP (Rebased For Bots)
Brian Burg
Comment 31 2014-09-21 16:05:30 PDT
Comment on attachment 238430 [details] WIP (Rebased For Bots) "Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ" ^-- this is causing the patch to not apply. What diff command are you using? I've never had this problem using `Tools/Scripts/webkit-patch upload`
Timothy Hatcher
Comment 32 2014-09-21 16:09:32 PDT
Created attachment 238437 [details] WIP (Binary Patch)
WebKit Commit Bot
Comment 33 2014-09-21 16:10:46 PDT
Attachment 238437 [details] did not pass style-queue: ERROR: Source/WebKit2/UIProcess/WebInspectorProxy.cpp:351: Missing space before { [whitespace/braces] [5] Total errors found: 1 in 52 files If any of these errors are false positives, please file a bug against check-webkit-style.
Timothy Hatcher
Comment 34 2014-09-21 20:06:47 PDT
Timothy Hatcher
Comment 35 2014-09-21 20:18:27 PDT
This will need a WebKIt2 owner review.
Brian Burg
Comment 36 2014-09-21 20:35:52 PDT
Comment on attachment 238446 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=238446&action=review > Source/WebKit2/ChangeLog:108 > + Stop taking an optional InspectorFrontendChannel and be it directly. Create a connection that can 'be it'
Timothy Hatcher
Comment 37 2014-09-21 23:56:24 PDT
Timothy Hatcher
Comment 38 2014-09-22 08:01:54 PDT
Timothy Hatcher
Comment 39 2014-09-22 15:14:21 PDT
Timothy Hatcher
Comment 40 2014-09-22 16:27:32 PDT
Anders Carlsson
Comment 41 2014-09-24 09:59:27 PDT
Comment on attachment 238503 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=238503&action=review > Source/WebCore/testing/Internals.cpp:1495 > + m_frontendWindow.clear(); This should use = nullptr. > Source/WebKit2/UIProcess/API/C/WKInspector.cpp:177 > -bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef) > +bool WKInspectorIsDebuggingJavaScript(WKInspectorRef) As discussed, these should move to WKDeprecatedFunctions. > Source/WebKit2/UIProcess/WebInspectorProxy.cpp:359 > + static std::once_flag onceFlag; > + static LazyNeverDestroyed<RefPtr<WebContext>> context; > + > + std::call_once(onceFlag, [] { > + WebContextConfiguration configuration; > + WebContext::applyPlatformSpecificConfigurationDefaults(configuration); > + context.construct(WebContext::create(configuration)); > + context.get()->setProcessModel(ProcessModelMultipleSecondaryProcesses); > + }); There's no need to put a smart pointer inside a LazyNeverDestroyed. This can just be something like: static WebContext* context; if (!context) { /// initialize context } return *context; > Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in:25 > -messages -> WebInspector LegacyReceiver { > +messages -> WebInspector { Very nice!
Timothy Hatcher
Comment 42 2014-09-24 13:07:13 PDT
Joseph Pecoraro
Comment 43 2014-09-24 15:06:43 PDT
Timothy Hatcher
Comment 44 2014-09-24 21:15:15 PDT
Brent Fulgham
Comment 45 2014-09-25 17:36:42 PDT
64-bit Windows build fix: http://trac.webkit.org/changeset/173986.
Note You need to log in before you can comment on or make changes to this bug.