Changeset 49940 in webkit


Ignore:
Timestamp:
Oct 22, 2009 8:45:47 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-10-22 Keishi Hattori <casey.hattori@gmail.com>

Reviewed by Pavel Feldman.

Inspector should support monitorEvents/un monitorEvents() in the command line
https://bugs.webkit.org/show_bug.cgi?id=19879

  • inspector/front-end/EventListenersSidebarPane.js: (WebInspector.EventListenersSidebarPane.prototype.update.callback): Ignores event listeners generated by monitorEvent
  • inspector/front-end/InjectedScript.js: (InjectedScript._ensureCommandLineAPIInstalled): Added _inspectorCommandLineAPI._logEvent, _allEventTypes, _normalizeEventTypes, monitorEvent, unmonitorEvent.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r49939 r49940  
     12009-10-22  Keishi Hattori  <casey.hattori@gmail.com>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Inspector should support monitorEvents/un monitorEvents() in the command line
     6        https://bugs.webkit.org/show_bug.cgi?id=19879
     7
     8        * inspector/front-end/EventListenersSidebarPane.js:
     9        (WebInspector.EventListenersSidebarPane.prototype.update.callback): Ignores event listeners generated by monitorEvent
     10        * inspector/front-end/InjectedScript.js:
     11        (InjectedScript._ensureCommandLineAPIInstalled): Added _inspectorCommandLineAPI._logEvent, _allEventTypes,
     12        _normalizeEventTypes, monitorEvent, unmonitorEvent.
     13
    1142009-10-21  Joseph Pecoraro  <joepeck@webkit.org>
    215
  • trunk/WebCore/inspector/front-end/EventListenersSidebarPane.js

    r48813 r49940  
    7272                eventListener.node = WebInspector.domAgent.nodeForId(eventListener.nodeId);
    7373                delete eventListener.nodeId; // no longer needed
     74                if (/^function _inspectorCommandLineAPI_logEvent\(/.test(eventListener.listener.toString()))
     75                    continue; // ignore event listeners generated by monitorEvent
    7476                var type = eventListener.type;
    7577                var section = sectionMap[type];
  • trunk/WebCore/inspector/front-end/InjectedScript.js

    r49758 r49940  
    923923        profile: function() { return console.profile.apply(console, arguments) }, \
    924924        profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \
     925        _logEvent: function _inspectorCommandLineAPI_logEvent(e) { console.log(e.type, e); }, \
     926        _allEventTypes: [\"mouse\", \"key\", \"load\", \"unload\", \"abort\", \"error\", \
     927            \"select\", \"change\", \"submit\", \"reset\", \"focus\", \"blur\", \
     928            \"resize\", \"scroll\"], \
     929        _normalizeEventTypes: function(t) { \
     930            if (typeof t === \"undefined\") \
     931                t = _inspectorCommandLineAPI._allEventTypes; \
     932            else if (typeof t === \"string\") \
     933                t = [t]; \
     934            var i, te = []; \
     935            for (i = 0; i < t.length; i++) { \
     936                if (t[i] === \"mouse\") \
     937                    te.splice(0, 0, \"mousedown\", \"mouseup\", \"click\", \"dblclick\", \
     938                        \"mousemove\", \"mouseover\", \"mouseout\"); \
     939                else if (t[i] === \"key\") \
     940                    te.splice(0, 0, \"keydown\", \"keyup\", \"keypress\"); \
     941                else \
     942                    te.push(t[i]); \
     943            } \
     944            return te; \
     945        }, \
     946        monitorEvent: function(o, t) { \
     947            if (!o || !o.addEventListener || !o.removeEventListener) \
     948                return; \
     949            t = _inspectorCommandLineAPI._normalizeEventTypes(t); \
     950            for (i = 0; i < t.length; i++) { \
     951                o.removeEventListener(t[i], _inspectorCommandLineAPI._logEvent, false); \
     952                o.addEventListener(t[i], _inspectorCommandLineAPI._logEvent, false); \
     953            } \
     954        }, \
     955        unmonitorEvent: function(o, t) { \
     956            if (!o || !o.removeEventListener) \
     957                return; \
     958            t = _inspectorCommandLineAPI._normalizeEventTypes(t); \
     959            for (i = 0; i < t.length; i++) { \
     960                o.removeEventListener(t[i], _inspectorCommandLineAPI._logEvent, false); \
     961            } \
     962        }, \
    925963        _inspectedNodes: [], \
    926964        get $0() { return _inspectorCommandLineAPI._inspectedNodes[0] }, \
Note: See TracChangeset for help on using the changeset viewer.