3 Web Inspector: QuickConsole should update its selection when RuntimeManager.defaultExecutionContextIdentifier changes
4 https://bugs.webkit.org/show_bug.cgi?id=159183
5
6 Reviewed by NOBODY (OOPS!).
7
8 Currently, the UI listens for state changes in the Frame tree to decide when to reset
9 the selected execution context back to its default value. This is no good, because this
10 should happen even if we have no UI (i.e., testing models only). The UI should simply
11 display changes to the model rather than driving them based on other model changes.
12
13 Move the logic to reset the execution context into RuntimeManager. When the selected
14 context changes, an event is fired which causes the QuickConsole to rebuild its path components.
15
16 * UserInterface/Controllers/RuntimeManager.js:
17 (WebInspector.RuntimeManager):
18 (WebInspector.RuntimeManager.prototype.set defaultExecutionContextIdentifier):
19 Fire an event when the execution context actually changes.
20
21 (WebInspector.RuntimeManager.prototype._frameExecutionContextsCleared):
22 Added. If the selected context was cleared, reset back to default.
23
24 * UserInterface/Models/Frame.js:
25 (WebInspector.Frame.prototype.clearExecutionContexts):
26 Include the contexts that were cleared so clients can match against them.
27
28 * UserInterface/Views/QuickConsole.js:
29 (WebInspector.QuickConsole):
30 Use the proper constant name. Both the old and new names evaluated to `undefined`.
31 No need to keep track of the selected path component, it will always match the
32 defaultExecutionContextIdentifier in RuntimeManager.
33
34 (WebInspector.QuickConsole.prototype.get selectedExecutionContextIdentifier):
35 (WebInspector.QuickConsole.prototype.set selectedExecutionContextIdentifier):
36 Forward to RuntimeManager. This name is less awkward for the UI code that manages selections.
37
38 (WebInspector.QuickConsole.prototype._executionContextPathComponentsToDisplay):
39 Special-case for the main frame execution context.
40
41 (WebInspector.QuickConsole.prototype._framePageExecutionContextsChanged):
42 Remove indirection.
43
44 (WebInspector.QuickConsole.prototype._frameExecutionContextsCleared):
45 Fix the guard to handle undefined execution contexts in the case where it represents the main frame (undefined).
46
47 (WebInspector.QuickConsole.prototype._defaultExecutionContextChanged):
48 Rebuild when the model changes.
49
50 (WebInspector.QuickConsole.prototype._pathComponentSelected): Simplify.
51 (WebInspector.QuickConsole.prototype.get executionContextIdentifier):
52 (WebInspector.QuickConsole.prototype._removeExecutionContextPathComponentForFrame):
53 Move the fallback selection behavior into RuntimeManager.
54
55 (WebInspector.QuickConsole.prototype._updateExecutionContextPathComponentForFrame): Deleted.
56 This has been dead code ever since we removed iOS 6 legacy support.
57
582016-06-27 Brian Burg <bburg@apple.com>
59