webInspector.panels.elements.onSelectionChanged should be fired when a DOM element is selected in elements panel.
Created attachment 66064 [details] patch - Added Panel.name - Fixed the way onSelectionChanged is dispatched from ElementsPanel.js - Added console API into context of code being evaluated by webInspector.inspectedWindow.evaluate() (so we can do inspect() there) - Added basic test for extension API events
Created attachment 66071 [details] patch - Extracted stringifying wrapper around expressions evaluated by extensions into a more readable function.
Comment on attachment 66071 [details] patch oops, wrong patch. sorry.
Created attachment 66073 [details] patch
Comment on attachment 66073 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=66073&action=prettypatch > WebCore/inspector/front-end/ExtensionServer.js:225 > + var result = window.eval( I believe we can get rid of this eval by providing the function body directly or even call the eval without wrapping it into an anonymous function as we discussed offline. A bigger problem is that this code doesn't allow extensions to declare global functions, r- for this.
Created attachment 66207 [details] patch - changed webInspector.inspectedWindow.evaluaet() to return object instead of its stringified representation - rewrote wrapper for evaluated code - added more tests for eval
(In reply to comment #5) > (From update of attachment 66073 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=66073&action=prettypatch > > > WebCore/inspector/front-end/ExtensionServer.js:225 > > + var result = window.eval( > I believe we can get rid of this eval by providing the function body directly or even call the eval without wrapping it into an anonymous function as we discussed offline. A bigger problem is that this code doesn't allow extensions to declare global functions, r- for this. The latter happened to be not the case: the code being evaluated still runs in global context. Added a test for that, though, and rewrote wrapper code to a shorter (though less readable) version without outer function.
Manually committed r66601: http://trac.webkit.org/changeset/66601
http://trac.webkit.org/browser/trunk/LayoutTests/inspector/extensions-events.html is flaky on the Leopard Commit bot and is causing the bot to back up. :(
1 CONSOLE MESSAGE: line 663: [object HTMLParagraphElement] 1 CONSOLE MESSAGE: line 667: [object HTMLParagraphElement] Is the diff.
(In reply to comment #10) > 1 CONSOLE MESSAGE: line 663: [object HTMLParagraphElement] > 1 CONSOLE MESSAGE: line 667: [object HTMLParagraphElement] > > Is the diff. This should have been fixed by r67394: http://trac.webkit.org/changeset/67394 It is not actual flakiness, rather a stable, though unexpected, side effect from r67385: the inspect() console command line API call uses console.log() internally, which causes line number of a line within InjectedScript.js that called console.log() to appear in test expectations. Hence a change to InjectedScripts.js that causes a call to console.log() to move causes test expectations change.