Title: [102648] trunk/Source/WebCore
- Revision
- 102648
- Author
- [email protected]
- Date
- 2011-12-12 18:23:18 -0800 (Mon, 12 Dec 2011)
Log Message
Implement the _javascript_Core bindings for eventListenerHandlerLocation
https://bugs.webkit.org/show_bug.cgi?id=74313
Patch by Konrad Piascik <[email protected]> on 2011-12-12
Reviewed by Geoffrey Garen.
Open any page in Web Inspector and look at the event listeners. They should now
link to the script which created them.
* bindings/js/ScriptEventListener.cpp:
(WebCore::eventListenerHandlerLocation):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (102647 => 102648)
--- trunk/Source/WebCore/ChangeLog 2011-12-13 01:45:36 UTC (rev 102647)
+++ trunk/Source/WebCore/ChangeLog 2011-12-13 02:23:18 UTC (rev 102648)
@@ -1,3 +1,16 @@
+2011-12-12 Konrad Piascik <[email protected]>
+
+ Implement the _javascript_Core bindings for eventListenerHandlerLocation
+ https://bugs.webkit.org/show_bug.cgi?id=74313
+
+ Reviewed by Geoffrey Garen.
+
+ Open any page in Web Inspector and look at the event listeners. They should now
+ link to the script which created them.
+
+ * bindings/js/ScriptEventListener.cpp:
+ (WebCore::eventListenerHandlerLocation):
+
2011-12-12 Erik Arvidsson <[email protected]>
[V8] CodeGeneratorV8.pm does not correctly work with inherited HasIndexGetter
Modified: trunk/Source/WebCore/bindings/js/ScriptEventListener.cpp (102647 => 102648)
--- trunk/Source/WebCore/bindings/js/ScriptEventListener.cpp 2011-12-13 01:45:36 UTC (rev 102647)
+++ trunk/Source/WebCore/bindings/js/ScriptEventListener.cpp 2011-12-13 02:23:18 UTC (rev 102648)
@@ -34,6 +34,8 @@
#include "Attribute.h"
#include "Document.h"
#include "EventListener.h"
+#include "Executable.h"
+#include "JSFunction.h"
#include "JSNode.h"
#include "Frame.h"
#include <runtime/JSLock.h>
@@ -103,10 +105,23 @@
return ustringToString(jsFunction->toString(scriptStateFromNode(jsListener->isolatedWorld(), document)));
}
-bool eventListenerHandlerLocation(Document*, EventListener*, String&, int&)
+bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, int& lineNumber)
{
- // FIXME: Add support for getting function location.
- return false;
+ const JSEventListener* jsListener = JSEventListener::cast(eventListener);
+ if (!jsListener)
+ return false;
+ JSC::JSObject* jsObject = jsListener->jsFunction(document);
+ if (!jsObject)
+ return false;
+ JSC::JSFunction* jsFunction = static_cast<JSFunction*>(jsObject);
+ if (!jsFunction || jsFunction->isHostFunction())
+ return false;
+ JSC::FunctionExecutable* funcExecutable = jsFunction->jsExecutable();
+ if (!funcExecutable)
+ return false;
+ lineNumber = funcExecutable->lineNo();
+ sourceName = ustringToString(funcExecutable->sourceURL());
+ return true;
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes