Changeset 202522 in webkit


Ignore:
Timestamp:
Jun 27, 2016 5:23:09 PM (8 years ago)
Author:
BJ Burg
Message:

Web Inspector: RuntimeManager should not use view object WebInspector.quickConsole
https://bugs.webkit.org/show_bug.cgi?id=128092
<rdar://problem/15966526>

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

This is a layering violation which makes it harder to use RuntimeManager.evaluateInInspectedWindow
from a testing context where the QuickConsole view does not exist.

Store the selected execution context identifier on RuntimeManager and use it
when doing subsequent evaluations that act on the currently selected frame.

  • UserInterface/Controllers/RuntimeManager.js:

(WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
(WebInspector.RuntimeManager.prototype.saveResult):
Use local state.

(WebInspector.RuntimeManager.prototype.get defaultExecutionContextIdentifier):
(WebInspector.RuntimeManager.prototype.set defaultExecutionContextIdentifier):
Added.

(WebInspector.RuntimeManager):

  • UserInterface/Models/ExecutionContext.js:

(WebInspector.ExecutionContext):
Move the symbolic name for the top level execution context to RuntimeManager.

  • UserInterface/Test/Test.js:

(WebInspector.loaded): No need to stub out WebInspector.QuickConsole any more.

  • UserInterface/Views/QuickConsole.js:

(WebInspector.QuickConsole.prototype._framePageExecutionContextsChanged):
(WebInspector.QuickConsole.prototype._removeExecutionContextPathComponentForFrame):
(WebInspector.QuickConsole.prototype._updateExecutionContextPathComponentForFrame):
(WebInspector.QuickConsole.prototype._pathComponentSelected):
For now, set RuntimeManager's selected execution context whenever we set the
selected path component. In a future patch, we should invert the dependency and have
the selected component change whenever RuntimeManager.defaultExecutionContext changes.

LayoutTests:

Add some really basic coverage for RuntimeManager.defaultExecutionContextIdentifier
and using it in RuntimeManager.evaluateInInspectedWindow.

  • inspector/runtime/change-execution-context-identifier-expected.txt: Added.
  • inspector/runtime/change-execution-context-identifier.html: Added.
  • inspector/runtime/resources/change-execution-context-identifier-subframe.html: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202517 r202522  
     12016-06-27  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: RuntimeManager should not use view object WebInspector.quickConsole
     4        https://bugs.webkit.org/show_bug.cgi?id=128092
     5        <rdar://problem/15966526>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        Add some really basic coverage for RuntimeManager.defaultExecutionContextIdentifier
     10        and using it in RuntimeManager.evaluateInInspectedWindow.
     11
     12        * inspector/runtime/change-execution-context-identifier-expected.txt: Added.
     13        * inspector/runtime/change-execution-context-identifier.html: Added.
     14        * inspector/runtime/resources/change-execution-context-identifier-subframe.html: Added.
     15
    1162016-06-27  Benjamin Poulain  <benjamin@webkit.org>
    217
  • trunk/Source/WebInspectorUI/ChangeLog

    r202384 r202522  
     12016-06-27  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: RuntimeManager should not use view object WebInspector.quickConsole
     4        https://bugs.webkit.org/show_bug.cgi?id=128092
     5        <rdar://problem/15966526>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        This is a layering violation which makes it harder to use RuntimeManager.evaluateInInspectedWindow
     10        from a testing context where the QuickConsole view does not exist.
     11
     12        Store the selected execution context identifier on RuntimeManager and use it
     13        when doing subsequent evaluations that act on the currently selected frame.
     14
     15        * UserInterface/Controllers/RuntimeManager.js:
     16        (WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
     17        (WebInspector.RuntimeManager.prototype.saveResult):
     18        Use local state.
     19
     20        (WebInspector.RuntimeManager.prototype.get defaultExecutionContextIdentifier):
     21        (WebInspector.RuntimeManager.prototype.set defaultExecutionContextIdentifier):
     22        Added.
     23
     24        (WebInspector.RuntimeManager):
     25        * UserInterface/Models/ExecutionContext.js:
     26        (WebInspector.ExecutionContext):
     27        Move the symbolic name for the top level execution context to RuntimeManager.
     28
     29        * UserInterface/Test/Test.js:
     30        (WebInspector.loaded): No need to stub out WebInspector.QuickConsole any more.
     31
     32        * UserInterface/Views/QuickConsole.js:
     33        (WebInspector.QuickConsole.prototype._framePageExecutionContextsChanged):
     34        (WebInspector.QuickConsole.prototype._removeExecutionContextPathComponentForFrame):
     35        (WebInspector.QuickConsole.prototype._updateExecutionContextPathComponentForFrame):
     36        (WebInspector.QuickConsole.prototype._pathComponentSelected):
     37        For now, set RuntimeManager's selected execution context whenever we set the
     38        selected path component. In a future patch, we should invert the dependency and have
     39        the selected component change whenever RuntimeManager.defaultExecutionContext changes.
     40
    1412016-06-23  Joseph Pecoraro  <pecoraro@apple.com>
    242
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js

    r201855 r202522  
    8383
    8484        // COMPATIBILITY (iOS 8): "saveResult" did not exist.
    85         var contextId = WebInspector.quickConsole.executionContextIdentifier;
     85        let contextId = this.defaultExecutionContextIdentifier;
    8686        RuntimeAgent.evaluate.invoke({expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, contextId, returnByValue, generatePreview, saveResult}, evalCallback.bind(this));
    8787    }
     
    105105            RuntimeAgent.saveResult(remoteObject.asCallArgument(), mycallback);
    106106        else
    107             RuntimeAgent.saveResult(remoteObject.asCallArgument(), WebInspector.quickConsole.executionContextIdentifier, mycallback);
     107            RuntimeAgent.saveResult(remoteObject.asCallArgument(), this.defaultExecutionContextIdentifier, mycallback);
    108108    }
    109109
     
    123123        });
    124124    }
     125
     126    get defaultExecutionContextIdentifier() { return this._defaultExecutionContextIdentifier; }
     127    set defaultExecutionContextIdentifier(value) { this._defaultExecutionContextIdentifier = value; }
    125128};
     129
     130WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier = undefined;
    126131
    127132WebInspector.RuntimeManager.Event = {
  • trunk/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js

    r188993 r202522  
    3030        super();
    3131
    32         console.assert(typeof id === "number" || id === WebInspector.QuickConsole.MainFrameContextExecutionIdentifier);
     32        console.assert(typeof id === "number" || id === WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier);
    3333        console.assert(typeof name === "string");
    3434
  • trunk/Source/WebInspectorUI/UserInterface/Test/Test.js

    r201171 r202522  
    6363    this.replayManager = new WebInspector.ReplayManager;
    6464
    65     // Global controllers.
    66     this.quickConsole = {executionContextIdentifier: undefined};
    67 
    6865    document.addEventListener("DOMContentLoaded", this.contentLoaded);
    6966
  • trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js

    r197245 r202522  
    150150            delete this._restoreSelectedExecutionContextForFrame;
    151151            this._selectedExecutionContextPathComponent = newExecutionContextPathComponent;
     152            WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
    152153            this._rebuildExecutionContextPathComponents();
    153154        }
     
    261262            next.previousSibling = prev;
    262263
    263         if (this._selectedExecutionContextPathComponent === executionContextPathComponent)
     264        if (this._selectedExecutionContextPathComponent === executionContextPathComponent) {
    264265            this._selectedExecutionContextPathComponent = this._mainFrameExecutionContextPathComponent;
     266            WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
     267        }
    265268
    266269        this._otherExecutionContextPathComponents.remove(executionContextPathComponent, true);
     
    285288        var newExecutionContextPathComponent = this._insertExecutionContextPathComponentForFrame(frame, true);
    286289
    287         if (wasSelected)
     290        if (wasSelected) {
    288291            this._selectedExecutionContextPathComponent = newExecutionContextPathComponent;
     292            WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
     293        }
    289294
    290295        this._rebuildExecutionContextPathComponents();
     
    297302
    298303        this._selectedExecutionContextPathComponent = event.data.pathComponent;
     304        WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
    299305
    300306        this._rebuildExecutionContextPathComponents();
     
    326332WebInspector.QuickConsole.ToolbarTopBorder = 1;
    327333
    328 WebInspector.QuickConsole.MainFrameContextExecutionIdentifier = undefined;
    329 
    330334WebInspector.QuickConsole.Event = {
    331335    DidResize: "quick-console-did-resize"
Note: See TracChangeset for help on using the changeset viewer.