Changeset 97611 in webkit


Ignore:
Timestamp:
Oct 17, 2011 6:21:12 AM (13 years ago)
Author:
mnaganov@chromium.org
Message:

Web Inspector: [Chromium] Add an ability to look up and explore an object from a heap profile.
https://bugs.webkit.org/show_bug.cgi?id=61179

This is exteremely helpful when dealing with DOM wrappers, as
their properties are mostly implemented with getters and thus not
stored in heap snapshots.

Reviewed by Pavel Feldman.

  • English.lproj/localizedStrings.js:
  • bindings/js/ScriptProfiler.cpp:

(WebCore::ScriptProfiler::objectByHeapObjectId):

  • bindings/js/ScriptProfiler.h:
  • bindings/v8/ScriptProfiler.cpp:

(WebCore::ScriptProfiler::objectByHeapObjectId):

  • bindings/v8/ScriptProfiler.h:
  • inspector/Inspector.json:
  • inspector/InspectorController.cpp:

(WebCore::InspectorController::InspectorController):

  • inspector/InspectorProfilerAgent.cpp:

(WebCore::InspectorProfilerAgent::create):
(WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
(WebCore::InspectorProfilerAgent::getObjectByHeapObjectId):

  • inspector/InspectorProfilerAgent.h:
  • inspector/front-end/DetailedHeapshotGridNodes.js:

(WebInspector.HeapSnapshotGridNode.prototype.hasHoverMessage.false.queryObjectContent):
(WebInspector.HeapSnapshotGenericObjectNode):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.queryObjectContent.else.formatResult):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.queryObjectContent):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.shortenWindowURL):

  • inspector/front-end/DetailedHeapshotView.js:

(WebInspector.DetailedHeapshotView.prototype._showObjectPopover):

  • inspector/front-end/HeapSnapshot.js:

(WebInspector.HeapSnapshotNode.prototype.get canBeQueried):
(WebInspector.HeapSnapshotNode.prototype.get flags):
(WebInspector.HeapSnapshotNode.prototype.get isDOMWindow):
(WebInspector.HeapSnapshot.prototype._init):
(WebInspector.HeapSnapshot.prototype.dispose):
(WebInspector.HeapSnapshot.prototype._flagsOfNode):
(WebInspector.HeapSnapshot.prototype._calculateFlags):
(WebInspector.HeapSnapshot.prototype.updateStaticData):
(WebInspector.HeapSnapshotNodesProvider.prototype._serialize):

  • inspector/front-end/HeapSnapshotProxy.js:

(WebInspector.HeapSnapshotProxy.prototype.get nodeFlags):

  • inspector/front-end/RemoteObject.js:

(WebInspector.RemoteObject.fromError):

  • inspector/front-end/heapProfiler.css:

(.detailed-heapshot-view tr:not(.selected) td.object-column span.highlight):

  • inspector/profiler/heap-snapshot-expected.txt:
  • inspector/profiler/heap-snapshot-test.js:

(initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockWithDOM):
(initialize_HeapSnapshotTest):

  • inspector/profiler/heap-snapshot.html:
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r97606 r97611  
     12011-10-17  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Web Inspector: [Chromium] Add an ability to look up and explore an object from a heap profile.
     4        https://bugs.webkit.org/show_bug.cgi?id=61179
     5
     6        This is exteremely helpful when dealing with DOM wrappers, as
     7        their properties are mostly implemented with getters and thus not
     8        stored in heap snapshots.
     9
     10        Reviewed by Pavel Feldman.
     11
     12        * inspector/profiler/heap-snapshot-expected.txt:
     13        * inspector/profiler/heap-snapshot-test.js:
     14        (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockWithDOM):
     15        (initialize_HeapSnapshotTest):
     16        * inspector/profiler/heap-snapshot.html:
     17
    1182011-10-17  Alexander Pavlov  <apavlov@chromium.org>
    219
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt

    r97372 r97611  
    1818Running: heapSnapshotAggregatesTest
    1919
     20Running: heapSnapshotFlagsTest
     21
    2022Running: heapSnapshotNodesProviderTest
    2123
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js

    r97372 r97611  
    6767};
    6868
     69InspectorTest.createHeapSnapshotMockWithDOM = function()
     70{
     71    return {
     72        snapshot: {},
     73        nodes: [
     74            { fields: ["type", "name", "id", "children_count", "children"],
     75              types: [["hidden", "object"], "", "", "", { fields: ["type", "name_or_index", "to_node"], types: [["element", "hidden", "internal"], "", ""] }] },
     76            // A tree with DOMWindow objects.
     77            //
     78            //    |----->DOMWindow--->A
     79            //    |                \
     80            //    |----->DOMWindow--->B--->C
     81            //    |        |     \
     82            //  (root)   hidden   --->D--internal / "native"-->N
     83            //    |         \         |
     84            //    |----->E   H     internal
     85            //    |                   v
     86            //    |----->F--->G------>M
     87            //
     88            /* (root) */    0,  0,  1, 4, 0,  1, 17, 0, 2, 27, 0, 3, 40, 0, 4, 44,
     89            /* DOMWindow */ 1, 11,  2, 2, 0,  1, 51, 0, 2, 55,
     90            /* DOMWindow */ 1, 11,  3, 3, 0,  1, 55, 0, 2, 62, 1, 3, 72,
     91            /* E */         1,  5,  4, 0,
     92            /* F */         1,  6,  5, 1, 0,  1, 76,
     93            /* A */         1,  1,  6, 0,
     94            /* B */         1,  2,  7, 1, 0,  1, 80,
     95            /* D */         1,  4,  8, 2, 2, 12, 84, 2, 1, 88,
     96            /* H */         1,  8,  9, 0,
     97            /* G */         1,  7, 10, 0,
     98            /* C */         1,  3, 11, 0,
     99            /* N */         1, 10, 12, 0,
     100            /* M */         1,  9, 13, 0
     101            ],
     102        strings: ["", "A", "B", "C", "D", "E", "F", "G", "H", "M", "N", "DOMWindow", "native"]
     103    };
    69104};
     105
     106};
  • trunk/LayoutTests/inspector/profiler/heap-snapshot.html

    r97372 r97611  
    149149        },
    150150
     151        function heapSnapshotFlagsTest(next)
     152        {
     153            var snapshot = new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMockWithDOM());
     154            var expectedCanBeQueried = {
     155                "": false,
     156               "A": true,
     157               "B": true,
     158               "C": true,
     159               "D": true,
     160               "E": false,
     161               "F": false,
     162               "G": false,
     163               "H": false,
     164               "M": false,
     165               "N": true,
     166               "DOMWindow": true
     167            };
     168            for (var nodes = snapshot._allNodes; nodes.hasNext(); nodes.next()) {
     169                var node = nodes.item;
     170                InspectorTest.assertEquals(expectedCanBeQueried[node.name], node.canBeQueried, "canBeQueried of \"" + node.name + "\"");
     171            }
     172            next();
     173        },
     174
    151175        function heapSnapshotNodesProviderTest(next)
    152176        {
  • trunk/Source/WebCore/ChangeLog

    r97606 r97611  
     12011-10-17  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Web Inspector: [Chromium] Add an ability to look up and explore an object from a heap profile.
     4        https://bugs.webkit.org/show_bug.cgi?id=61179
     5
     6        This is exteremely helpful when dealing with DOM wrappers, as
     7        their properties are mostly implemented with getters and thus not
     8        stored in heap snapshots.
     9
     10        Reviewed by Pavel Feldman.
     11
     12        * English.lproj/localizedStrings.js:
     13        * bindings/js/ScriptProfiler.cpp:
     14        (WebCore::ScriptProfiler::objectByHeapObjectId):
     15        * bindings/js/ScriptProfiler.h:
     16        * bindings/v8/ScriptProfiler.cpp:
     17        (WebCore::ScriptProfiler::objectByHeapObjectId):
     18        * bindings/v8/ScriptProfiler.h:
     19        * inspector/Inspector.json:
     20        * inspector/InspectorController.cpp:
     21        (WebCore::InspectorController::InspectorController):
     22        * inspector/InspectorProfilerAgent.cpp:
     23        (WebCore::InspectorProfilerAgent::create):
     24        (WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
     25        (WebCore::InspectorProfilerAgent::getObjectByHeapObjectId):
     26        * inspector/InspectorProfilerAgent.h:
     27        * inspector/front-end/DetailedHeapshotGridNodes.js:
     28        (WebInspector.HeapSnapshotGridNode.prototype.hasHoverMessage.false.queryObjectContent):
     29        (WebInspector.HeapSnapshotGenericObjectNode):
     30        (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
     31        (WebInspector.HeapSnapshotGenericObjectNode.prototype.queryObjectContent.else.formatResult):
     32        (WebInspector.HeapSnapshotGenericObjectNode.prototype.queryObjectContent):
     33        (WebInspector.HeapSnapshotGenericObjectNode.prototype.shortenWindowURL):
     34        * inspector/front-end/DetailedHeapshotView.js:
     35        (WebInspector.DetailedHeapshotView.prototype._showObjectPopover):
     36        * inspector/front-end/HeapSnapshot.js:
     37        (WebInspector.HeapSnapshotNode.prototype.get canBeQueried):
     38        (WebInspector.HeapSnapshotNode.prototype.get flags):
     39        (WebInspector.HeapSnapshotNode.prototype.get isDOMWindow):
     40        (WebInspector.HeapSnapshot.prototype._init):
     41        (WebInspector.HeapSnapshot.prototype.dispose):
     42        (WebInspector.HeapSnapshot.prototype._flagsOfNode):
     43        (WebInspector.HeapSnapshot.prototype._calculateFlags):
     44        (WebInspector.HeapSnapshot.prototype.updateStaticData):
     45        (WebInspector.HeapSnapshotNodesProvider.prototype._serialize):
     46        * inspector/front-end/HeapSnapshotProxy.js:
     47        (WebInspector.HeapSnapshotProxy.prototype.get nodeFlags):
     48        * inspector/front-end/RemoteObject.js:
     49        (WebInspector.RemoteObject.fromError):
     50        * inspector/front-end/heapProfiler.css:
     51        (.detailed-heapshot-view tr:not(.selected) td.object-column span.highlight):
     52
    1532011-10-17  Alexander Pavlov  <apavlov@chromium.org>
    254
  • trunk/Source/WebCore/bindings/js/ScriptProfiler.cpp

    r97372 r97611  
    3232
    3333#include "GCController.h"
     34#include "InspectorValues.h"
    3435#include "JSDOMBinding.h"
    3536#include <profiler/Profiler.h>
     
    4041{
    4142    gcController().garbageCollectNow();
     43}
     44
     45PassRefPtr<InspectorValue> ScriptProfiler::objectByHeapObjectId(unsigned, InjectedScriptManager*)
     46{
     47    return InspectorValue::null();
    4248}
    4349
  • trunk/Source/WebCore/bindings/js/ScriptProfiler.h

    r97372 r97611  
    3636namespace WebCore {
    3737
     38class InjectedScriptManager;
     39class InspectorValue;
     40
    3841class ScriptProfiler {
    3942    WTF_MAKE_NONCOPYABLE(ScriptProfiler);
     
    4952
    5053    static void collectGarbage();
     54    static PassRefPtr<InspectorValue> objectByHeapObjectId(unsigned id, InjectedScriptManager*);
    5155    static void start(ScriptState* state, const String& title);
    5256    static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
  • trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp

    r97372 r97611  
    3232#include "ScriptProfiler.h"
    3333
     34#include "InjectedScript.h"
    3435#include "InspectorValues.h"
    3536#include "RetainedDOMInfo.h"
     
    6465    // to free everything possible in just one pass.
    6566    while (!v8::V8::IdleNotification()) { }
     67}
     68
     69PassRefPtr<InspectorValue> ScriptProfiler::objectByHeapObjectId(unsigned id, InjectedScriptManager* injectedScriptManager)
     70{
     71    // As ids are unique, it doesn't matter which HeapSnapshot owns HeapGraphNode.
     72    // We need to find first HeapSnapshot containing a node with the specified id.
     73    const v8::HeapGraphNode* node = 0;
     74    for (int i = 0, l = v8::HeapProfiler::GetSnapshotsCount(); i < l; ++i) {
     75        const v8::HeapSnapshot* snapshot = v8::HeapProfiler::GetSnapshot(i);
     76        node = snapshot->GetNodeById(id);
     77        if (node)
     78            break;
     79    }
     80    if (!node)
     81        return InspectorValue::null();
     82
     83    v8::HandleScope scope;
     84    v8::Handle<v8::Value> value = node->GetHeapValue();
     85    if (!value->IsObject())
     86        return InspectorValue::null();
     87
     88    v8::Handle<v8::Object> object(value.As<v8::Object>());
     89    v8::Local<v8::Context> creationContext = object->CreationContext();
     90    v8::Context::Scope creationScope(creationContext);
     91    ScriptState* scriptState = ScriptState::forContext(creationContext);
     92    InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scriptState);
     93    return !injectedScript.hasNoValue() ?
     94            RefPtr<InspectorValue>(injectedScript.wrapObject(value, "")).release() : InspectorValue::null();
    6695}
    6796
  • trunk/Source/WebCore/bindings/v8/ScriptProfiler.h

    r97372 r97611  
    4040namespace WebCore {
    4141
    42 class InspectorObject;
     42class InjectedScriptManager;
     43class InspectorValue;
    4344
    4445class ScriptProfiler {
     
    5556
    5657    static void collectGarbage();
     58    static PassRefPtr<InspectorValue> objectByHeapObjectId(unsigned id, InjectedScriptManager*);
    5759    static void start(ScriptState* state, const String& title);
    5860    static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
  • trunk/Source/WebCore/inspector/Inspector.json

    r97372 r97611  
    20102010            {
    20112011                "name": "collectGarbage"
     2012            },
     2013            {
     2014                "name": "getObjectByHeapObjectId",
     2015                "parameters": [
     2016                    { "name": "objectId", "type": "integer" }
     2017                ],
     2018                "returns": [
     2019                    { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Evaluation result." }
     2020                ]
    20122021            }
    20132022        ],
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r97574 r97611  
    114114    , m_debuggerAgent(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get()))
    115115    , m_domDebuggerAgent(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent.get(), m_debuggerAgent.get(), m_inspectorAgent.get()))
    116     , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get()))
     116    , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get(), m_injectedScriptManager.get()))
    117117#endif
    118118#if ENABLE(WORKERS)
  • trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp

    r97372 r97611  
    6363static const char* const HeapProfileType = "HEAP";
    6464
    65 PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState)
    66 {
    67     return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState));
    68 }
    69 
    70 InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState)
     65PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
     66{
     67    return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState, injectedScriptManager));
     68}
     69
     70InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
    7171    : m_instrumentingAgents(instrumentingAgents)
    7272    , m_consoleAgent(consoleAgent)
    7373    , m_inspectedPage(inspectedPage)
    7474    , m_inspectorState(inspectorState)
     75    , m_injectedScriptManager(injectedScriptManager)
    7576    , m_frontend(0)
    7677    , m_enabled(false)
     
    379380}
    380381
     382void InspectorProfilerAgent::getObjectByHeapObjectId(ErrorString* error, int id, RefPtr<InspectorObject>* result)
     383{
     384    RefPtr<InspectorValue> heapObject = ScriptProfiler::objectByHeapObjectId(id, m_injectedScriptManager);
     385    if (!heapObject->isNull())
     386        heapObject->asObject(result);
     387    else
     388        *error = "Object is not available.";
     389}
     390
    381391} // namespace WebCore
    382392
  • trunk/Source/WebCore/inspector/InspectorProfilerAgent.h

    r97372 r97611  
    4242namespace WebCore {
    4343
     44class InjectedScriptManager;
    4445class InspectorArray;
    4546class InspectorConsoleAgent;
     
    5758    WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
    5859public:
    59     static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*);
     60    static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*, InjectedScriptManager*);
    6061    virtual ~InspectorProfilerAgent();
    6162
     
    9192    void toggleRecordButton(bool isProfiling);
    9293
     94    void getObjectByHeapObjectId(ErrorString*, int id, RefPtr<InspectorObject>* result);
     95
    9396private:
    9497    typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
     
    98101    void restoreEnablement();
    99102
    100     InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*);
     103    InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*, InjectedScriptManager*);
    101104    PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
    102105    PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot);
     
    106109    Page* m_inspectedPage;
    107110    InspectorState* m_inspectorState;
     111    InjectedScriptManager* m_injectedScriptManager;
    108112    InspectorFrontend::Profiler* m_frontend;
    109113    bool m_enabled;
  • trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js

    r97372 r97611  
    5757    hasHoverMessage: false,
    5858
    59     hoverMessage: function(callback)
    60     {
    61         callback("");
     59    queryObjectContent: function(callback)
     60    {
    6261    },
    6362
     
    186185        this.hasHoverMessage = true;
    187186    else if (this._type === "object" && this.isDOMWindow(this._name)) {
    188         var url = [];
    189         this._name = this.shortenWindowURL(this._name, false, url);
    190         this._url = url[0];
     187        this._name = this.shortenWindowURL(this._name, false);
    191188        this.hasHoverMessage = true;
    192     }
     189    } else if (node.flags & tree.snapshot.nodeFlags.canBeQueried)
     190        this.hasHoverMessage = true;
    193191};
    194192
     
    260258            break;
    261259        };
     260        if (this.hasHoverMessage)
     261            valueStyle += " highlight";
    262262        data["object"] = { valueStyle: valueStyle, value: value + " @" + this.snapshotNodeId };
    263263
     
    269269    },
    270270
    271     hoverMessage: function(callback)
     271    queryObjectContent: function(callback)
    272272    {
    273273        if (this._type === "string")
    274             callback("\"" + this._name + "\"", "console-formatted-string");
    275         else if (this._url)
    276             callback(this._url, "console-formatted-object");
     274            callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name));
     275        else {
     276            function formatResult(error, object)
     277            {
     278                if (!error && object.type)
     279                    callback(WebInspector.RemoteObject.fromPayload(object), !!error);
     280                else
     281                    callback(WebInspector.RemoteObject.fromError(WebInspector.UIString("Not available")));
     282            }
     283            ProfilerAgent.getObjectByHeapObjectId(this.snapshotNodeId, formatResult);
     284        }
    277285    },
    278286
     
    301309    },
    302310
    303     shortenWindowURL: function(fullName, hasObjectId, fullURLPtr)
     311    shortenWindowURL: function(fullName, hasObjectId)
    304312    {
    305313        var startPos = fullName.indexOf("/");
     
    307315        if (startPos !== -1 && endPos !== -1) {
    308316            var fullURL = fullName.substring(startPos + 1, endPos).trimLeft();
    309             if (fullURLPtr)
    310                 fullURLPtr[0] = fullURL;
    311317            var url = fullURL.trimURL();
    312318            if (url.length > 40)
  • trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js

    r97372 r97611  
    622622    this.helpButton.addEventListener("click", this._helpClicked.bind(this), false);
    623623
    624     var popoverHelper = new WebInspector.PopoverHelper(this.element, this._getHoverAnchor.bind(this), this._showStringContentPopover.bind(this));
     624    var popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, this._getHoverAnchor.bind(this), this._showObjectPopover.bind(this), null, true);
    625625
    626626    this._loadProfile(this._profileUid, profileCallback.bind(this));
     
    10671067    },
    10681068
    1069     _showStringContentPopover: function(anchor, popover)
    1070     {
    1071         var stringContentElement = document.createElement("span");
    1072         stringContentElement.className = "monospace";
    1073         stringContentElement.style.whiteSpace = "pre";
    1074 
    1075         function displayString(name, className)
    1076         {
    1077             stringContentElement.textContent = name;
    1078             stringContentElement.className += " " + className;
    1079             popover.show(stringContentElement, anchor);
    1080         }
    1081         anchor.node.hoverMessage(displayString);
     1069    _showObjectPopover: function(element, showCallback)
     1070    {
     1071        element.node.queryObjectContent(showCallback);
    10821072    },
    10831073
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js

    r97372 r97611  
    495495
    496496WebInspector.HeapSnapshotNode.prototype = {
     497    get canBeQueried()
     498    {
     499        var flags = this._snapshot._flagsOfNode(this);
     500        return !!(flags & this._snapshot._nodeFlags.canBeQueried);
     501    },
     502
    497503    get className()
    498504    {
     
    530536    },
    531537
     538    get flags()
     539    {
     540        return this._snapshot._flagsOfNode(this);
     541    },
     542
    532543    get id()
    533544    {
     
    543554    {
    544555        return this._type() === this._snapshot._nodeHiddenType;
     556    },
     557
     558    get isDOMWindow()
     559    {
     560        return this.name.substr(0, 9) === "DOMWindow";
    545561    },
    546562
     
    683699        this._edgeTypes.push("invisible");
    684700
     701        this._nodeFlags = { canBeQueried: 1 };
     702
    685703        this._markInvisibleEdges();
    686704    },
     
    700718        delete this._dominatedNodes;
    701719        delete this._dominatedIndex;
     720        delete this._flags;
    702721    },
    703722
     
    762781        var dominatedIndexTo = this._getDominatedIndex(node._nextNodeIndex);
    763782        return new WebInspector.HeapSnapshotArraySlice(this, "_dominatedNodes", dominatedIndexFrom, dominatedIndexTo);
     783    },
     784
     785    _flagsOfNode: function(node)
     786    {
     787        if (!this._flags)
     788            this._calculateFlags();
     789        return this._flags[node.nodeIndex];
    764790    },
    765791
     
    960986    },
    961987
     988    _calculateFlags: function()
     989    {
     990        var flag = this._nodeFlags.canBeQueried;
     991        this._flags = new Array(this.nodeCount);
     992        // Allow runtime properties query for objects accessible from DOMWindow objects
     993        // via regular properties, and for DOM wrappers. Trying to access random objects
     994        // can cause a crash due to insonsistent state of internal properties of wrappers.
     995        var list = [];
     996        for (var iter = this.rootNode.edges; iter.hasNext(); iter.next()) {
     997            if (iter.edge.node.isDOMWindow)
     998                list.push(iter.edge.node);
     999        }
     1000        while (list.length) {
     1001            var node = list.shift();
     1002            if (node.canBeQueried) continue;
     1003            this._flags[node.nodeIndex] = flag;
     1004            for (var iter = node.edges; iter.hasNext(); iter.next()) {
     1005                var edge = iter.edge;
     1006                if (!edge.isHidden && !edge.isInvisible &&
     1007                    edge.name && (!edge.isInternal || edge.name === "native") &&
     1008                    !edge.node.canBeQueried)
     1009                    list.push(edge.node);
     1010            }
     1011        }
     1012    },
     1013
    9621014    baseSnapshotHasNode: function(baseSnapshotId, className, nodeId)
    9631015    {
     
    10151067    updateStaticData: function()
    10161068    {
    1017         return {nodeCount: this.nodeCount, rootNodeIndex: this._rootNodeIndex, totalSize: this.totalSize, uid: this.uid};
     1069        return {nodeCount: this.nodeCount, rootNodeIndex: this._rootNodeIndex, totalSize: this.totalSize, uid: this.uid, nodeFlags: this._nodeFlags};
    10181070    }
    10191071};
     
    12361288    _serialize: function(node)
    12371289    {
    1238         return {id: node.id, name: node.name, nodeIndex: node.nodeIndex, retainedSize: node.retainedSize, selfSize: node.selfSize, type: node.type};
     1290        return {id: node.id, name: node.name, nodeIndex: node.nodeIndex, retainedSize: node.retainedSize, selfSize: node.selfSize, type: node.type, flags: node.flags};
    12391291    },
    12401292
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js

    r97372 r97611  
    371371    },
    372372
     373    get nodeFlags()
     374    {
     375        return this._staticData.nodeFlags;
     376    },
     377
    373378    pushBaseIds: function(snapshotId, className, nodeIds)
    374379    {
  • trunk/Source/WebCore/inspector/front-end/RemoteObject.js

    r97372 r97611  
    5555}
    5656
     57WebInspector.RemoteObject.fromError = function(errorDescription)
     58{
     59    return new WebInspector.RemoteObject(null, null, null, errorDescription);
     60}
     61
    5762WebInspector.RemoteObject.fromPrimitiveValue = function(value)
    5863{
  • trunk/Source/WebCore/inspector/front-end/heapProfiler.css

    r97372 r97611  
    195195}
    196196
     197.detailed-heapshot-view tr:not(.selected) td.object-column span.highlight {
     198    background-color: rgb(255, 255, 200);
     199}
     200
    197201.heapshot-help-status-bar-item .glyph {
    198202    -webkit-mask-position: -160px 0;
Note: See TracChangeset for help on using the changeset viewer.