Changeset 89317 in webkit


Ignore:
Timestamp:
Jun 20, 2011 5:01:18 PM (13 years ago)
Author:
Joseph Pecoraro
Message:

2011-06-20 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Pavel Feldman.

Web Inspector: CRASH if Expanding Event Listener on document
https://bugs.webkit.org/show_bug.cgi?id=61834

Add a test to list the event listeners in the sidebar.
This test includes event listeners on the document, and
it expands each of the sections which would have caused
the CRASH fixed by this patch.

  • http/tests/inspector/elements-test.js: (initialize_ElementTest.InspectorTest.expandAndDumpSelectedElementEventListeners): (initialize_ElementTest.InspectorTest.expandSelectedElementEventListeners): (initialize_ElementTest.InspectorTest.expandSelectedElementEventListenersSubsections): (initialize_ElementTest.InspectorTest.expandSelectedElementEventListenersEventBars): (initialize_ElementTest.InspectorTest.dumpSelectedElementEventListeners): (initialize_ElementTest.InspectorTest.dumpObjectPropertySection):
  • inspector/elements/event-listener-sidebar-expected.txt: Added.
  • inspector/elements/event-listener-sidebar.html: Added.
  • platform/chromium/inspector/elements/event-listener-sidebar-expected.txt: Added. Chromium has slightly different results. It has more properties and includes extra information, like line numbers, for functions.

2011-06-20 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Pavel Feldman.

Web Inspector: CRASH if Expanding Event Listener on document
https://bugs.webkit.org/show_bug.cgi?id=61834

Node::ownerDocument returns null for a document node. So, in
the case of a document node in resolveNode, use Node::document
which returns the node, as a document.

  • inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::resolveNode):
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89316 r89317  
     12011-06-20  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: CRASH if Expanding Event Listener on document
     6        https://bugs.webkit.org/show_bug.cgi?id=61834
     7
     8        Add a test to list the event listeners in the sidebar.
     9        This test includes event listeners on the document, and
     10        it expands each of the sections which would have caused
     11        the CRASH fixed by this patch.
     12
     13        * http/tests/inspector/elements-test.js:
     14        (initialize_ElementTest.InspectorTest.expandAndDumpSelectedElementEventListeners):
     15        (initialize_ElementTest.InspectorTest.expandSelectedElementEventListeners):
     16        (initialize_ElementTest.InspectorTest.expandSelectedElementEventListenersSubsections):
     17        (initialize_ElementTest.InspectorTest.expandSelectedElementEventListenersEventBars):
     18        (initialize_ElementTest.InspectorTest.dumpSelectedElementEventListeners):
     19        (initialize_ElementTest.InspectorTest.dumpObjectPropertySection):
     20        * inspector/elements/event-listener-sidebar-expected.txt: Added.
     21        * inspector/elements/event-listener-sidebar.html: Added.
     22        * platform/chromium/inspector/elements/event-listener-sidebar-expected.txt: Added.
     23        Chromium has slightly different results. It has more properties
     24        and includes extra information, like line numbers, for functions.
     25
    1262011-06-20  Joseph Pecoraro  <joepeck@webkit.org>
    227
  • trunk/LayoutTests/http/tests/inspector/elements-test.js

    r88331 r89317  
    103103};
    104104
     105InspectorTest.expandAndDumpSelectedElementEventListeners = function(callback)
     106{
     107    InspectorTest.expandSelectedElementEventListeners(function() {
     108        InspectorTest.dumpSelectedElementEventListeners(callback);
     109    });
     110}
     111
     112InspectorTest.expandSelectedElementEventListeners = function(callback)
     113{
     114    var sidebarPane = WebInspector.panels.elements.sidebarPanes.eventListeners;
     115    sidebarPane.expand();
     116
     117    InspectorTest.runAfterPendingDispatches(function() {
     118        InspectorTest.expandSelectedElementEventListenersSubsections(callback);
     119    });
     120}
     121
     122InspectorTest.expandSelectedElementEventListenersSubsections = function(callback)
     123{
     124    var eventListenerSections = WebInspector.panels.elements.sidebarPanes.eventListeners.sections;
     125    for (var i = 0; i < eventListenerSections.length; ++i)
     126        eventListenerSections[i].expand();
     127
     128    // Multiple sections may expand.
     129    InspectorTest.runAfterPendingDispatches(function() {
     130        InspectorTest.expandSelectedElementEventListenersEventBars(callback);
     131    });
     132}
     133
     134InspectorTest.expandSelectedElementEventListenersEventBars = function(callback)
     135{
     136    var eventListenerSections = WebInspector.panels.elements.sidebarPanes.eventListeners.sections;
     137    for (var i = 0; i < eventListenerSections.length; ++i) {
     138        var eventBarChildren = eventListenerSections[i].eventBars.children;
     139        for (var j = 0; j < eventBarChildren.length; ++j)
     140            eventBarChildren[j]._section.expand();
     141    }
     142
     143    // Multiple sections may expand.
     144    InspectorTest.runAfterPendingDispatches(callback);
     145}
     146
     147InspectorTest.dumpSelectedElementEventListeners = function(callback)
     148{
     149    var eventListenerSections = WebInspector.panels.elements.sidebarPanes.eventListeners.sections;
     150    for (var i = 0; i < eventListenerSections.length; ++i) {
     151        var section = eventListenerSections[i];
     152        var eventType = section._title;
     153        InspectorTest.addResult("");
     154        InspectorTest.addResult("======== " + eventType + " ========");
     155        var eventBarChildren = section.eventBars.children;
     156        for (var j = 0; j < eventBarChildren.length; ++j) {
     157            var objectPropertiesSection = eventBarChildren[j]._section;
     158            InspectorTest.dumpObjectPropertySection(objectPropertiesSection);
     159        }
     160    }
     161
     162    callback();
     163}
     164
     165InspectorTest.dumpObjectPropertySection = function(section)
     166{
     167    var expandedSubstring = section.expanded ? "[expanded]" : "[collapsed]";
     168    InspectorTest.addResult(expandedSubstring + " " + section.titleElement.textContent + " " + section.subtitleAsTextForTest);
     169    if (!section.propertiesForTest)
     170        return;
     171
     172    for (var i = 0; i < section.propertiesForTest.length; ++i) {
     173        var property = section.propertiesForTest[i];
     174        var key = property.name;
     175        var value = property.value._description;
     176        InspectorTest.addResult("    " + key + ": " + value);
     177    }
     178}
     179
    105180// FIXME: this returns the first tree item found (may fail for same-named properties in a style).
    106181InspectorTest.getElementStylePropertyTreeItem = function(propertyName)
  • trunk/Source/WebCore/ChangeLog

    r89316 r89317  
     12011-06-20  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: CRASH if Expanding Event Listener on document
     6        https://bugs.webkit.org/show_bug.cgi?id=61834
     7
     8        Node::ownerDocument returns null for a document node. So, in
     9        the case of a document node in resolveNode, use Node::document
     10        which returns the node, as a document.
     11
     12        * inspector/InspectorDOMAgent.cpp:
     13        (WebCore::InspectorDOMAgent::resolveNode):
     14
    1152011-06-20  Joseph Pecoraro  <joepeck@webkit.org>
    216
  • trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp

    r88950 r89317  
    14481448PassRefPtr<InspectorObject> InspectorDOMAgent::resolveNode(Node* node)
    14491449{
    1450     Document* document = node->ownerDocument();
     1450    Document* document = node->isDocumentNode() ? node->document() : node->ownerDocument();
    14511451    Frame* frame = document ? document->frame() : 0;
    14521452    if (!frame)
Note: See TracChangeset for help on using the changeset viewer.