[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756
pfeldman at chromium.org
pfeldman at chromium.org
Fri Feb 26 22:26:53 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 0da2acce2c2d56f895dd62f0644001f22fcdb46b
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Feb 22 07:59:29 2010 +0000
2010-02-21 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Timothy Hatcher.
Web Inspector: stop on inline breakpoints on reload.
- ScriptBreakpoint struct has been introduced and reused in InspectorController
and debug server.
- JavaScriptDebugServer was moved to bindings/js and renamed to ScriptDebugServer
There were no changes to semantics, only some mechanical changes:
- addBreakpoint and updateBreakpoint were merged into setBreakpoint
- ScriptDebugServer now operates ScriptBreakpoint instances instead of
BreakpointInfo.
- It no longer allocates maps and breakpoint info in heap - all done on stack.
- JavaScriptDebugListener is now ScriptDebugServer::Listener
- Listener methods no longer have ExecState (was unused).
- addListener/removeListener pair wuth no page argument removed (was unused).
- InspectorController now binds sourceID to url and maintains a map of 'sticky'
breakpoints. Whenever script is loaded and there is a sticky breakpoint url matching,
breakpoint is being 'restored' synchronously in debug server and pushed to frontend.
Front-end no longer stores map of sticky breakpoints.
- setBreakpoint/removeBreakpoint/didParseSource trio handle this logic.
- A bunch of if(USE_JSC/V8/other) forks removed.
- InspectorFrontend now operates primitive types only, got rid of USE_JSC as well.
https://bugs.webkit.org/show_bug.cgi?id=28799
* GNUmakefile.am:
* WebCore.base.exp:
* WebCore.gypi:
* WebCore.order:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::currentCallFrame):
(WebCore::JSInjectedScriptHost::isActivation):
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::shared):
(WebCore::ScriptDebugServer::ScriptDebugServer):
(WebCore::ScriptDebugServer::~ScriptDebugServer):
(WebCore::ScriptDebugServer::addListener):
(WebCore::ScriptDebugServer::removeListener):
(WebCore::ScriptDebugServer::pageCreated):
(WebCore::ScriptDebugServer::hasListenersInterestedInPage):
(WebCore::ScriptDebugServer::setBreakpoint):
(WebCore::ScriptDebugServer::removeBreakpoint):
(WebCore::ScriptDebugServer::hasBreakpoint):
(WebCore::ScriptDebugServer::clearBreakpoints):
(WebCore::ScriptDebugServer::setPauseOnExceptionsState):
(WebCore::ScriptDebugServer::pauseProgram):
(WebCore::ScriptDebugServer::continueProgram):
(WebCore::ScriptDebugServer::stepIntoStatement):
(WebCore::ScriptDebugServer::stepOverStatement):
(WebCore::ScriptDebugServer::stepOutOfFunction):
(WebCore::ScriptDebugServer::currentCallFrame):
(WebCore::ScriptDebugServer::currentCallFrameState):
(WebCore::ScriptDebugServer::dispatchDidParseSource):
(WebCore::ScriptDebugServer::dispatchFailedToParseSource):
(WebCore::toPage):
(WebCore::ScriptDebugServer::detach):
(WebCore::ScriptDebugServer::sourceParsed):
(WebCore::ScriptDebugServer::dispatchFunctionToListeners):
(WebCore::ScriptDebugServer::setJavaScriptPaused):
(WebCore::ScriptDebugServer::pauseIfNeeded):
(WebCore::ScriptDebugServer::callEvent):
(WebCore::ScriptDebugServer::atStatement):
(WebCore::ScriptDebugServer::returnEvent):
(WebCore::ScriptDebugServer::exception):
(WebCore::ScriptDebugServer::willExecuteProgram):
(WebCore::ScriptDebugServer::didExecuteProgram):
(WebCore::ScriptDebugServer::didReachBreakpoint):
(WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
(WebCore::ScriptDebugServer::recompileAllJSFunctions):
(WebCore::ScriptDebugServer::didAddListener):
(WebCore::ScriptDebugServer::didRemoveListener):
(WebCore::ScriptDebugServer::didRemoveLastListener):
* bindings/js/ScriptDebugServer.h:
(WebCore::ScriptDebugServer::Listener::~Listener):
(WebCore::ScriptDebugServer::):
(WebCore::ScriptDebugServer::pauseOnExceptionsState):
(WebCore::ScriptDebugServer::hasListeners):
(WebCore::ScriptDebugServer::hasGlobalListeners):
* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::shared):
* bindings/v8/ScriptDebugServer.h:
(WebCore::ScriptDebugServer::Listener::~Listener):
(WebCore::ScriptDebugServer::addListener):
(WebCore::ScriptDebugServer::removeListener):
(WebCore::ScriptDebugServer::setBreakpoint):
(WebCore::ScriptDebugServer::removeBreakpoint):
(WebCore::ScriptDebugServer::clearBreakpoints):
(WebCore::ScriptDebugServer::):
(WebCore::ScriptDebugServer::pauseOnExceptionsState):
(WebCore::ScriptDebugServer::setPauseOnExceptionsState):
(WebCore::ScriptDebugServer::pauseProgram):
(WebCore::ScriptDebugServer::continueProgram):
(WebCore::ScriptDebugServer::stepIntoStatement):
(WebCore::ScriptDebugServer::stepOverStatement):
(WebCore::ScriptDebugServer::stepOutOfFunction):
(WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
(WebCore::ScriptDebugServer::recompileAllJSFunctions):
(WebCore::ScriptDebugServer::currentCallFrameState):
(WebCore::ScriptDebugServer::pageCreated):
(WebCore::ScriptDebugServer::ScriptDebugServer):
(WebCore::ScriptDebugServer::~ScriptDebugServer):
* bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
(WebCore::V8InjectedScriptHost::currentCallFrameCallback):
(WebCore::V8InjectedScriptHost::isActivationCallback):
* inspector/InjectedScriptHost.cpp:
* inspector/InjectedScriptHost.h:
* inspector/InjectedScriptHost.idl:
* inspector/InspectorBackend.cpp:
(WebCore::InspectorBackend::setBreakpoint):
(WebCore::InspectorBackend::removeBreakpoint):
(WebCore::InspectorBackend::pauseInDebugger):
(WebCore::InspectorBackend::stepOverStatementInDebugger):
(WebCore::InspectorBackend::stepIntoStatementInDebugger):
(WebCore::InspectorBackend::stepOutOfFunctionInDebugger):
(WebCore::InspectorBackend::pauseOnExceptionsState):
(WebCore::InspectorBackend::setPauseOnExceptionsState):
* inspector/InspectorBackend.h:
* inspector/InspectorBackend.idl:
* inspector/ScriptBreakpoint.h: Added.
(WebCore::InspectorBreakpoint::InspectorBreakpoint):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::setWindowVisible):
(WebCore::InspectorController::scriptObjectReady):
(WebCore::InspectorController::close):
(WebCore::InspectorController::didCommitLoad):
(WebCore::InspectorController::addProfile):
(WebCore::InspectorController::startUserInitiatedProfiling):
(WebCore::InspectorController::stopUserInitiatedProfiling):
(WebCore::InspectorController::enableProfiler):
(WebCore::InspectorController::disableProfiler):
(WebCore::InspectorController::enableDebuggerFromFrontend):
(WebCore::InspectorController::disableDebugger):
(WebCore::InspectorController::resumeDebugger):
(WebCore::InspectorController::setBreakpoint):
(WebCore::InspectorController::removeBreakpoint):
(WebCore::InspectorController::didParseSource):
(WebCore::InspectorController::failedToParseSource):
(WebCore::InspectorController::didPause):
* inspector/InspectorController.h:
* inspector/InspectorFrontend.cpp:
(WebCore::InspectorFrontend::parsedScriptSource):
(WebCore::InspectorFrontend::restoredBreakpoint):
(WebCore::InspectorFrontend::failedToParseScriptSource):
(WebCore::InspectorFrontend::resumedScript):
* inspector/InspectorFrontend.h:
* inspector/JavaScriptDebugListener.h: Removed.
* inspector/JavaScriptDebugServer.cpp: Removed.
* inspector/JavaScriptDebugServer.h: Removed.
* inspector/front-end/Breakpoint.js:
(WebInspector.Breakpoint.prototype.set condition):
* inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
(WebInspector.BreakpointsSidebarPane.prototype._breakpointEnableChanged):
* inspector/front-end/InspectorBackendStub.js:
(.WebInspector.InspectorBackendStub.prototype.addBreakpoint):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.sourceFrameForResource):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel):
(WebInspector.ScriptsPanel.prototype.addScript):
(WebInspector.ScriptsPanel.prototype.addBreakpoint):
(WebInspector.ScriptsPanel.prototype.removeBreakpoint):
(WebInspector.ScriptsPanel.prototype._showScriptOrResource):
* inspector/front-end/inspector.js:
(WebInspector.restoredBreakpoint):
* page/Page.cpp:
(WebCore::Page::Page):
* platform/android/TemporaryLinkStubs.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b9639c1..2b736dc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,177 @@
+2010-02-21 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: stop on inline breakpoints on reload.
+ - ScriptBreakpoint struct has been introduced and reused in InspectorController
+ and debug server.
+ - JavaScriptDebugServer was moved to bindings/js and renamed to ScriptDebugServer
+ There were no changes to semantics, only some mechanical changes:
+ - addBreakpoint and updateBreakpoint were merged into setBreakpoint
+ - ScriptDebugServer now operates ScriptBreakpoint instances instead of
+ BreakpointInfo.
+ - It no longer allocates maps and breakpoint info in heap - all done on stack.
+ - JavaScriptDebugListener is now ScriptDebugServer::Listener
+ - Listener methods no longer have ExecState (was unused).
+ - addListener/removeListener pair wuth no page argument removed (was unused).
+ - InspectorController now binds sourceID to url and maintains a map of 'sticky'
+ breakpoints. Whenever script is loaded and there is a sticky breakpoint url matching,
+ breakpoint is being 'restored' synchronously in debug server and pushed to frontend.
+ Front-end no longer stores map of sticky breakpoints.
+ - setBreakpoint/removeBreakpoint/didParseSource trio handle this logic.
+ - A bunch of if(USE_JSC/V8/other) forks removed.
+ - InspectorFrontend now operates primitive types only, got rid of USE_JSC as well.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28799
+
+ * GNUmakefile.am:
+ * WebCore.base.exp:
+ * WebCore.gypi:
+ * WebCore.order:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::JSInjectedScriptHost::currentCallFrame):
+ (WebCore::JSInjectedScriptHost::isActivation):
+ * bindings/js/ScriptDebugServer.cpp:
+ (WebCore::ScriptDebugServer::shared):
+ (WebCore::ScriptDebugServer::ScriptDebugServer):
+ (WebCore::ScriptDebugServer::~ScriptDebugServer):
+ (WebCore::ScriptDebugServer::addListener):
+ (WebCore::ScriptDebugServer::removeListener):
+ (WebCore::ScriptDebugServer::pageCreated):
+ (WebCore::ScriptDebugServer::hasListenersInterestedInPage):
+ (WebCore::ScriptDebugServer::setBreakpoint):
+ (WebCore::ScriptDebugServer::removeBreakpoint):
+ (WebCore::ScriptDebugServer::hasBreakpoint):
+ (WebCore::ScriptDebugServer::clearBreakpoints):
+ (WebCore::ScriptDebugServer::setPauseOnExceptionsState):
+ (WebCore::ScriptDebugServer::pauseProgram):
+ (WebCore::ScriptDebugServer::continueProgram):
+ (WebCore::ScriptDebugServer::stepIntoStatement):
+ (WebCore::ScriptDebugServer::stepOverStatement):
+ (WebCore::ScriptDebugServer::stepOutOfFunction):
+ (WebCore::ScriptDebugServer::currentCallFrame):
+ (WebCore::ScriptDebugServer::currentCallFrameState):
+ (WebCore::ScriptDebugServer::dispatchDidParseSource):
+ (WebCore::ScriptDebugServer::dispatchFailedToParseSource):
+ (WebCore::toPage):
+ (WebCore::ScriptDebugServer::detach):
+ (WebCore::ScriptDebugServer::sourceParsed):
+ (WebCore::ScriptDebugServer::dispatchFunctionToListeners):
+ (WebCore::ScriptDebugServer::setJavaScriptPaused):
+ (WebCore::ScriptDebugServer::pauseIfNeeded):
+ (WebCore::ScriptDebugServer::callEvent):
+ (WebCore::ScriptDebugServer::atStatement):
+ (WebCore::ScriptDebugServer::returnEvent):
+ (WebCore::ScriptDebugServer::exception):
+ (WebCore::ScriptDebugServer::willExecuteProgram):
+ (WebCore::ScriptDebugServer::didExecuteProgram):
+ (WebCore::ScriptDebugServer::didReachBreakpoint):
+ (WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
+ (WebCore::ScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::ScriptDebugServer::didAddListener):
+ (WebCore::ScriptDebugServer::didRemoveListener):
+ (WebCore::ScriptDebugServer::didRemoveLastListener):
+ * bindings/js/ScriptDebugServer.h:
+ (WebCore::ScriptDebugServer::Listener::~Listener):
+ (WebCore::ScriptDebugServer::):
+ (WebCore::ScriptDebugServer::pauseOnExceptionsState):
+ (WebCore::ScriptDebugServer::hasListeners):
+ (WebCore::ScriptDebugServer::hasGlobalListeners):
+ * bindings/v8/ScriptDebugServer.cpp:
+ (WebCore::ScriptDebugServer::shared):
+ * bindings/v8/ScriptDebugServer.h:
+ (WebCore::ScriptDebugServer::Listener::~Listener):
+ (WebCore::ScriptDebugServer::addListener):
+ (WebCore::ScriptDebugServer::removeListener):
+ (WebCore::ScriptDebugServer::setBreakpoint):
+ (WebCore::ScriptDebugServer::removeBreakpoint):
+ (WebCore::ScriptDebugServer::clearBreakpoints):
+ (WebCore::ScriptDebugServer::):
+ (WebCore::ScriptDebugServer::pauseOnExceptionsState):
+ (WebCore::ScriptDebugServer::setPauseOnExceptionsState):
+ (WebCore::ScriptDebugServer::pauseProgram):
+ (WebCore::ScriptDebugServer::continueProgram):
+ (WebCore::ScriptDebugServer::stepIntoStatement):
+ (WebCore::ScriptDebugServer::stepOverStatement):
+ (WebCore::ScriptDebugServer::stepOutOfFunction):
+ (WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
+ (WebCore::ScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::ScriptDebugServer::currentCallFrameState):
+ (WebCore::ScriptDebugServer::pageCreated):
+ (WebCore::ScriptDebugServer::ScriptDebugServer):
+ (WebCore::ScriptDebugServer::~ScriptDebugServer):
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::V8InjectedScriptHost::currentCallFrameCallback):
+ (WebCore::V8InjectedScriptHost::isActivationCallback):
+ * inspector/InjectedScriptHost.cpp:
+ * inspector/InjectedScriptHost.h:
+ * inspector/InjectedScriptHost.idl:
+ * inspector/InspectorBackend.cpp:
+ (WebCore::InspectorBackend::setBreakpoint):
+ (WebCore::InspectorBackend::removeBreakpoint):
+ (WebCore::InspectorBackend::pauseInDebugger):
+ (WebCore::InspectorBackend::stepOverStatementInDebugger):
+ (WebCore::InspectorBackend::stepIntoStatementInDebugger):
+ (WebCore::InspectorBackend::stepOutOfFunctionInDebugger):
+ (WebCore::InspectorBackend::pauseOnExceptionsState):
+ (WebCore::InspectorBackend::setPauseOnExceptionsState):
+ * inspector/InspectorBackend.h:
+ * inspector/InspectorBackend.idl:
+ * inspector/ScriptBreakpoint.h: Added.
+ (WebCore::InspectorBreakpoint::InspectorBreakpoint):
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ (WebCore::InspectorController::setWindowVisible):
+ (WebCore::InspectorController::scriptObjectReady):
+ (WebCore::InspectorController::close):
+ (WebCore::InspectorController::didCommitLoad):
+ (WebCore::InspectorController::addProfile):
+ (WebCore::InspectorController::startUserInitiatedProfiling):
+ (WebCore::InspectorController::stopUserInitiatedProfiling):
+ (WebCore::InspectorController::enableProfiler):
+ (WebCore::InspectorController::disableProfiler):
+ (WebCore::InspectorController::enableDebuggerFromFrontend):
+ (WebCore::InspectorController::disableDebugger):
+ (WebCore::InspectorController::resumeDebugger):
+ (WebCore::InspectorController::setBreakpoint):
+ (WebCore::InspectorController::removeBreakpoint):
+ (WebCore::InspectorController::didParseSource):
+ (WebCore::InspectorController::failedToParseSource):
+ (WebCore::InspectorController::didPause):
+ * inspector/InspectorController.h:
+ * inspector/InspectorFrontend.cpp:
+ (WebCore::InspectorFrontend::parsedScriptSource):
+ (WebCore::InspectorFrontend::restoredBreakpoint):
+ (WebCore::InspectorFrontend::failedToParseScriptSource):
+ (WebCore::InspectorFrontend::resumedScript):
+ * inspector/InspectorFrontend.h:
+ * inspector/JavaScriptDebugListener.h: Removed.
+ * inspector/JavaScriptDebugServer.cpp: Removed.
+ * inspector/JavaScriptDebugServer.h: Removed.
+ * inspector/front-end/Breakpoint.js:
+ (WebInspector.Breakpoint.prototype.set condition):
+ * inspector/front-end/BreakpointsSidebarPane.js:
+ (WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
+ (WebInspector.BreakpointsSidebarPane.prototype._breakpointEnableChanged):
+ * inspector/front-end/InspectorBackendStub.js:
+ (.WebInspector.InspectorBackendStub.prototype.addBreakpoint):
+ * inspector/front-end/ResourcesPanel.js:
+ (WebInspector.ResourcesPanel.prototype.sourceFrameForResource):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ (WebInspector.ScriptsPanel.prototype.addScript):
+ (WebInspector.ScriptsPanel.prototype.addBreakpoint):
+ (WebInspector.ScriptsPanel.prototype.removeBreakpoint):
+ (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
+ * inspector/front-end/inspector.js:
+ (WebInspector.restoredBreakpoint):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * platform/android/TemporaryLinkStubs.cpp:
+
2010-02-21 Gavin Barraclough <barraclough at apple.com>
Reviewed by Oliver Hunt.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index b73d8d0..4ef8343 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1225,9 +1225,7 @@ webcore_sources += \
WebCore/inspector/InspectorTimelineAgent.h \
WebCore/inspector/JavaScriptCallFrame.cpp \
WebCore/inspector/JavaScriptCallFrame.h \
- WebCore/inspector/JavaScriptDebugListener.h \
- WebCore/inspector/JavaScriptDebugServer.cpp \
- WebCore/inspector/JavaScriptDebugServer.h \
+ WebCore/inspector/ScriptBreakpoint.h \
WebCore/inspector/TimelineRecordFactory.cpp \
WebCore/inspector/TimelineRecordFactory.h \
WebCore/loader/Cache.cpp \
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 2afdd34..a07aee4 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -419,8 +419,6 @@ __ZN7WebCore19TextResourceDecoderD1Ev
__ZN7WebCore19applicationIsSafariEv
__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
__ZN7WebCore20ResourceResponseBaseC2Ev
-__ZN7WebCore21JavaScriptDebugServer23recompileAllJSFunctionsEPNS_5TimerIS0_EE
-__ZN7WebCore21JavaScriptDebugServer6sharedEv
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
__ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
__ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKNS_6StringEPNS_14SVGSMILElementEd
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index b8316cf..75d854b 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1614,9 +1614,7 @@
'inspector/InspectorTimelineAgent.h',
'inspector/JavaScriptCallFrame.cpp',
'inspector/JavaScriptCallFrame.h',
- 'inspector/JavaScriptDebugListener.h',
- 'inspector/JavaScriptDebugServer.cpp',
- 'inspector/JavaScriptDebugServer.h',
+ 'inspector/ScriptBreakpoint.h',
'inspector/TimelineRecordFactory.cpp',
'inspector/TimelineRecordFactory.h',
'loader/appcache/ApplicationCache.cpp',
diff --git a/WebCore/WebCore.order b/WebCore/WebCore.order
index 3144ec1..a8d20fd 100644
--- a/WebCore/WebCore.order
+++ b/WebCore/WebCore.order
@@ -215,11 +215,6 @@ __ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3
__ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
__ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E13allocateTableEi
__ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E15deallocateTableEP
-__ZN7WebCore21JavaScriptDebugServer6sharedEv
-__ZN7WebCore21JavaScriptDebugServerC1Ev
-__ZN7WebCore21JavaScriptDebugServerC2Ev
-__ZN7WebCore21JavaScriptDebugServer11pageCreatedEPNS_4PageE
-__ZN7WebCore21JavaScriptDebugServer28hasListenersInterestedInPageEPNS_4PageE
__ZNK3WTF9HashTableIPN7WebCore4PageESt4pairIS3_PNS_7HashSetIPNS1_23JavaScriptDebugListenerENS_7PtrHashIS7_EENS_10HashTraitsIS7_
__ZN7WebCore8Settings27setLocalStorageDatabasePathERKNS_6StringE
__ZN7WebCore5FrameC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
@@ -19813,7 +19808,6 @@ __ZN3WTF6VectorIN3JSC16ProtectedJSValueELm0EE15reserveCapacityEm
__ZN3WTF6VectorIN3JSC16ProtectedJSValueELm0EE6shrinkEm
__ZN7WebCore13HTMLTokenizer9parseTextERNS_15SegmentedStringENS0_5StateE
__ZN7WebCore19InspectorController14enableProfilerEb
-__ZN7WebCore21JavaScriptDebugServer27recompileAllJSFunctionsSoonEv
__ZN7WebCore33jsConsolePrototypeFunctionProfileEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZN7WebCore7Console7profileERKN3JSC7UStringEPNS_15ScriptCallStackE
__ZN7WebCore36jsConsolePrototypeFunctionProfileEndEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
@@ -19849,8 +19843,6 @@ __ZN7WebCoreL6getURLEPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS3_
__ZN7WebCoreL13getLineNumberEPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS3_
__ZN7WebCoreL11getChildrenEPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS3_
__ZNK3WTF7HashMapIxNS_6RefPtrIN7WebCore17InspectorResourceEEENS_7IntHashIyEENS_10HashTraitsIxEENS7_IS4_EEE3getERKx
-__ZN7WebCore5TimerINS_21JavaScriptDebugServerEE5firedEv
-__ZN7WebCore21JavaScriptDebugServer23recompileAllJSFunctionsEPNS_5TimerIS0_EE
__ZNK3JSC21CollectorHeapIteratorILNS_8HeapTypeE0EEdeEv
__ZN3JSC21CollectorHeapIteratorILNS_8HeapTypeE0EEppEv
__ZN3WTF6VectorIN3JSC12ProtectedPtrINS1_10JSFunctionEEELm0EE14expandCapacityEm
@@ -23874,19 +23866,15 @@ __ZN7WebCore13TextTokenizerC2EPNS_22HTMLViewSourceDocumentE
__ZN7WebCore22HTMLViewSourceDocument17addViewSourceTextERKNS_6StringE
__ZN7WebCore52jsInspectorControllerPrototypeFunctionEnableDebuggerEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZN7WebCore19InspectorController14enableDebuggerEv
-__ZN7WebCore21JavaScriptDebugServer11addListenerEPNS_23JavaScriptDebugListenerEPNS_4PageE
__ZN3WTF7HashMapIPN7WebCore4PageEPNS_7HashSetIPNS1_23JavaScriptDebugListenerENS_7PtrHashIS6_EENS_10HashTraitsIS6_EEEENS7_IS3_EE
__ZN3WTF7HashSetIPN7WebCore23JavaScriptDebugListenerENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
__ZN3WTF9HashTableIPN7WebCore23JavaScriptDebugListenerES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_
-__ZN7WebCore21JavaScriptDebugServer14didAddListenerEPNS_4PageE
__ZN7WebCore4Page11setDebuggerEPN3JSC8DebuggerE
-__ZN7WebCore21JavaScriptDebugServer16clearBreakpointsEv
__ZN3WTF20deleteAllPairSecondsIPNS_7HashSetIjNS_7IntHashIjEENS_10HashTraitsIjEEEEKNS_7HashMapIlS7_NS2_ImEENS4_IlEENS4_IS7_EEEEE
__ZNK7WebCore25JSCanvasGradientPrototype9classInfoEv
__ZNK7WebCore30JSInspectorControllerPrototype9classInfoEv
__ZN3WTF7HashMapIPN3JSC14SourceProviderEPNS1_9ExecStateENS_7PtrHashIS3_EENS_10HashTraitsIS3_EENS8_IS5_EEE3addERKS3_RKS5_
__ZN3WTF9HashTableIPN3JSC14SourceProviderESt4pairIS3_PNS1_9ExecStateEENS_18PairFirstExtractorIS7_EENS_7PtrHashIS3_EENS_14PairHa
-__ZN7WebCore21JavaScriptDebugServer12sourceParsedEPN3JSC9ExecStateERKNS1_10SourceCodeEiRKNS1_7UStringE
__ZN7WebCoreL6toPageEPN3JSC14JSGlobalObjectE
__ZNK3WTF7HashMapIPN7WebCore4PageEPNS_7HashSetIPNS1_23JavaScriptDebugListenerENS_7PtrHashIS6_EENS_10HashTraitsIS6_EEEENS7_IS3_E
__ZN7WebCoreL22dispatchDidParseSourceERKN3WTF7HashSetIPNS_23JavaScriptDebugListenerENS0_7PtrHashIS3_EENS0_10HashTraitsIS3_EEEEP
@@ -23900,32 +23888,20 @@ __ZN7WebCore21JSInspectorController16addSourceToFrameEPN3JSC9ExecStateERKNS1_7Ar
__ZN7WebCore32jsConsolePrototypeFunctionAssertEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZN7WebCore7Console15assertConditionEbPNS_15ScriptCallStackE
__ZN3WTF6VectorIPN7WebCore23JavaScriptDebugListenerELm0EE6shrinkEm
-__ZN7WebCore21JavaScriptDebugServer9callEventERKN3JSC17DebuggerCallFrameEli
__ZN7WebCore19JavaScriptCallFrameC1ERKN3JSC17DebuggerCallFrameEN3WTF10PassRefPtrIS0_EEli
__ZN7WebCore19JavaScriptCallFrameC2ERKN3JSC17DebuggerCallFrameEN3WTF10PassRefPtrIS0_EEli
-__ZN7WebCore21JavaScriptDebugServer13pauseIfNeededEPNS_4PageE
-__ZNK7WebCore21JavaScriptDebugServer13hasBreakpointElj
__ZNK3WTF7HashMapIlPNS_7HashSetIjNS_7IntHashIjEENS_10HashTraitsIjEEEENS2_ImEENS4_IlEENS4_IS7_EEE3getERKl
-__ZN7WebCore21JavaScriptDebugServer11atStatementERKN3JSC17DebuggerCallFrameEli
-__ZN7WebCore21JavaScriptDebugServer11returnEventERKN3JSC17DebuggerCallFrameEli
__ZN7WebCore19JavaScriptCallFrame6callerEv
__ZN3WTF10RefCountedIN7WebCore19JavaScriptCallFrameEE5derefEv
-__ZN7WebCore21JavaScriptDebugServer18willExecuteProgramERKN3JSC17DebuggerCallFrameEli
-__ZN7WebCore21JavaScriptDebugServer17didExecuteProgramERKN3JSC17DebuggerCallFrameEli
__ZN7WebCore46jsInspectorControllerPrototypeFunctionProfilesEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZN7WebCore21JSInspectorController8profilesEPN3JSC9ExecStateERKNS1_7ArgListE
__ZN7WebCore52jsInspectorControllerPrototypeFunctionEnableProfilerEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZNK7WebCore32JSHTMLOptionsCollectionPrototype9classInfoEv
-__ZN7WebCore21JavaScriptDebugServer15continueProgramEv
-__ZN7WebCore21JavaScriptDebugServer9exceptionERKN3JSC17DebuggerCallFrameEli
__ZN7WebCore52jsInspectorControllerPrototypeFunctionStartProfilingEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZN7WebCore51jsInspectorControllerPrototypeFunctionStopProfilingEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
__ZN7WebCore19InspectorController26stopUserInitiatedProfilingEv
__ZN7WebCore19InspectorController15disableDebuggerEv
-__ZN7WebCore21JavaScriptDebugServer14removeListenerEPNS_23JavaScriptDebugListenerEPNS_4PageE
__ZN3WTF9HashTableIPN7WebCore4PageESt4pairIS3_PNS_7HashSetIPNS1_23JavaScriptDebugListenerENS_7PtrHashIS7_EENS_10HashTraitsIS7_E
-__ZN7WebCore21JavaScriptDebugServer17didRemoveListenerEPNS_4PageE
-__ZN7WebCore21JavaScriptDebugServer21didRemoveLastListenerEv
__ZN7WebCore5Frame17setIsDisconnectedEb
__ZN7WebCore19InspectorController11closeWindowEv
__ZN7WebCoreL19getUniqueIdCallbackEPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS3_
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 4cb4794..2e8e47e 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1374,7 +1374,6 @@ HEADERS += \
inspector/InspectorResource.h \
inspector/InspectorTimelineAgent.h \
inspector/JavaScriptCallFrame.h \
- inspector/JavaScriptDebugServer.h \
inspector/TimelineRecordFactory.h \
loader/appcache/ApplicationCacheGroup.h \
loader/appcache/ApplicationCacheHost.h \
@@ -2630,7 +2629,6 @@ contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=1) {
SOURCES += \
bindings/js/JSJavaScriptCallFrameCustom.cpp \
inspector/JavaScriptCallFrame.cpp \
- inspector/JavaScriptDebugServer.cpp \
}
contains(DEFINES, ENABLE_OFFLINE_WEB_APPLICATIONS=1) {
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index c77c4a5..204ce55 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -42689,15 +42689,7 @@
>
</File>
<File
- RelativePath="..\inspector\JavaScriptDebugListener.h"
- >
- </File>
- <File
- RelativePath="..\inspector\JavaScriptDebugServer.cpp"
- >
- </File>
- <File
- RelativePath="..\inspector\JavaScriptDebugServer.h"
+ RelativePath="..\inspector\ScriptBreakpoint.h"
>
</File>
<File
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 3daac1f..3027f8f 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -533,9 +533,6 @@
1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81B9580E97330800266E07 /* InspectorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
1C81BA090E97348300266E07 /* JavaScriptCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C81BA030E97348300266E07 /* JavaScriptCallFrame.cpp */; };
1C81BA0A0E97348300266E07 /* JavaScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81BA040E97348300266E07 /* JavaScriptCallFrame.h */; };
- 1C81BA0C0E97348300266E07 /* JavaScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81BA060E97348300266E07 /* JavaScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1C81BA0D0E97348300266E07 /* JavaScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C81BA070E97348300266E07 /* JavaScriptDebugServer.cpp */; };
- 1C81BA0E0E97348300266E07 /* JavaScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81BA080E97348300266E07 /* JavaScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CA19E030DC255950065A994 /* EventLoopMac.mm */; };
1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA19E150DC255CA0065A994 /* EventLoop.h */; };
1CAF34810A6C405200ABE06E /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1298,6 +1295,7 @@
7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; };
7AED3E050FBB1EAA00D2B03C /* InspectorFrontend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AED3E030FBB1EAA00D2B03C /* InspectorFrontend.cpp */; };
7AED3E060FBB1EAA00D2B03C /* InspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */; };
+ 7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
84224183107E77F400766A87 /* JSSVGFEMorphologyElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84224181107E77F400766A87 /* JSSVGFEMorphologyElement.cpp */; };
84224184107E77F400766A87 /* JSSVGFEMorphologyElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 84224182107E77F400766A87 /* JSSVGFEMorphologyElement.h */; };
8422418C107E786F00766A87 /* DOMSVGFEMorphologyElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 84224189107E786F00766A87 /* DOMSVGFEMorphologyElement.h */; };
@@ -5855,9 +5853,6 @@
1C81BA030E97348300266E07 /* JavaScriptCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptCallFrame.cpp; sourceTree = "<group>"; };
1C81BA040E97348300266E07 /* JavaScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCallFrame.h; sourceTree = "<group>"; };
1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = JavaScriptCallFrame.idl; sourceTree = "<group>"; };
- 1C81BA060E97348300266E07 /* JavaScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptDebugListener.h; sourceTree = "<group>"; };
- 1C81BA070E97348300266E07 /* JavaScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptDebugServer.cpp; sourceTree = "<group>"; };
- 1C81BA080E97348300266E07 /* JavaScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptDebugServer.h; sourceTree = "<group>"; };
1C904DF90BA9D2C80081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
1CA19E030DC255950065A994 /* EventLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventLoopMac.mm; sourceTree = "<group>"; };
1CA19E150DC255CA0065A994 /* EventLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventLoop.h; sourceTree = "<group>"; };
@@ -6720,6 +6715,7 @@
7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; };
7AED3E030FBB1EAA00D2B03C /* InspectorFrontend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontend.cpp; sourceTree = "<group>"; };
7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontend.h; sourceTree = "<group>"; };
+ 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; };
84224181107E77F400766A87 /* JSSVGFEMorphologyElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGFEMorphologyElement.cpp; sourceTree = "<group>"; };
84224182107E77F400766A87 /* JSSVGFEMorphologyElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGFEMorphologyElement.h; sourceTree = "<group>"; };
84224189107E786F00766A87 /* DOMSVGFEMorphologyElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGFEMorphologyElement.h; sourceTree = "<group>"; };
@@ -10645,9 +10641,7 @@
1C81BA030E97348300266E07 /* JavaScriptCallFrame.cpp */,
1C81BA040E97348300266E07 /* JavaScriptCallFrame.h */,
1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
- 1C81BA060E97348300266E07 /* JavaScriptDebugListener.h */,
- 1C81BA070E97348300266E07 /* JavaScriptDebugServer.cpp */,
- 1C81BA080E97348300266E07 /* JavaScriptDebugServer.h */,
+ 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */,
BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */,
7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */,
@@ -17310,8 +17304,6 @@
59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */,
59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */,
1C81BA0A0E97348300266E07 /* JavaScriptCallFrame.h in Headers */,
- 1C81BA0C0E97348300266E07 /* JavaScriptDebugListener.h in Headers */,
- 1C81BA0E0E97348300266E07 /* JavaScriptDebugServer.h in Headers */,
59BC393F11054A1300FD85DB /* JavaStringJSC.h in Headers */,
1A569D040D7E2B82007C3983 /* jni_jsobject.h in Headers */,
5913953B110758450083EC55 /* JNIBridge.h in Headers */,
@@ -18540,6 +18532,7 @@
931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */,
9F2A322C1125A0A2003C3056 /* JavaScriptProfile.h in Headers */,
9F2A322E1125A0A2003C3056 /* JavaScriptProfileNode.h in Headers */,
+ 7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -19504,7 +19497,6 @@
59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */,
59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */,
1C81BA090E97348300266E07 /* JavaScriptCallFrame.cpp in Sources */,
- 1C81BA0D0E97348300266E07 /* JavaScriptDebugServer.cpp in Sources */,
1A569D030D7E2B82007C3983 /* jni_jsobject.mm in Sources */,
1A569D050D7E2B82007C3983 /* jni_objc.mm in Sources */,
5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */,
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 3db894d..947674a 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -67,8 +67,8 @@
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include "JavaScriptCallFrame.h"
-#include "JavaScriptDebugServer.h"
#include "JSJavaScriptCallFrame.h"
+#include "ScriptDebugServer.h"
#endif
using namespace JSC;
@@ -118,10 +118,9 @@ JSValue JSInjectedScriptHost::databaseForId(ExecState* exec, const ArgList& args
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
-
JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&)
{
- JavaScriptCallFrame* callFrame = impl()->currentCallFrame();
+ JavaScriptCallFrame* callFrame = ScriptDebugServer::shared().currentCallFrame();
if (!callFrame || !callFrame->isValid())
return jsUndefined();
@@ -134,7 +133,6 @@ JSValue JSInjectedScriptHost::isActivation(ExecState*, const ArgList& args)
JSObject* object = args.at(0).getObject();
return jsBoolean(object && object->isActivationObject());
}
-
#endif
JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args)
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
index 9869775..b280d52 100644
--- a/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -1,47 +1,584 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
+#include "ScriptDebugServer.h"
#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include "ScriptDebugServer.h"
+#include "DOMWindow.h"
+#include "EventLoop.h"
+#include "Frame.h"
+#include "FrameTree.h"
+#include "FrameView.h"
+#include "JSDOMWindowCustom.h"
+#include "JavaScriptCallFrame.h"
+#include "Page.h"
+#include "PageGroup.h"
+#include "PluginView.h"
+#include "ScriptBreakpoint.h"
+#include "ScriptController.h"
+#include "ScrollView.h"
+#include "Widget.h"
+#include <debugger/DebuggerCallFrame.h>
+#include <parser/SourceCode.h>
+#include <runtime/JSLock.h>
+#include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/UnusedParam.h>
-#include "JavaScriptDebugServer.h"
+using namespace JSC;
namespace WebCore {
-void ScriptDebugServer::recompileAllJSFunctions()
+ScriptDebugServer& ScriptDebugServer::shared()
+{
+ DEFINE_STATIC_LOCAL(ScriptDebugServer, server, ());
+ return server;
+}
+
+ScriptDebugServer::ScriptDebugServer()
+ : m_callingListeners(false)
+ , m_pauseOnExceptionsState(DontPauseOnExceptions)
+ , m_pauseOnNextStatement(false)
+ , m_paused(false)
+ , m_doneProcessingDebuggerEvents(true)
+ , m_pauseOnCallFrame(0)
+ , m_recompileTimer(this, &ScriptDebugServer::recompileAllJSFunctions)
+{
+}
+
+ScriptDebugServer::~ScriptDebugServer()
+{
+ deleteAllValues(m_pageListenersMap);
+}
+
+void ScriptDebugServer::addListener(Listener* listener, Page* page)
+{
+ ASSERT_ARG(listener, listener);
+ ASSERT_ARG(page, page);
+
+ pair<PageListenersMap::iterator, bool> result = m_pageListenersMap.add(page, 0);
+ if (result.second)
+ result.first->second = new ListenerSet;
+
+ ListenerSet* listeners = result.first->second;
+ listeners->add(listener);
+
+ didAddListener(page);
+}
+
+void ScriptDebugServer::removeListener(Listener* listener, Page* page)
+{
+ ASSERT_ARG(listener, listener);
+ ASSERT_ARG(page, page);
+
+ PageListenersMap::iterator it = m_pageListenersMap.find(page);
+ if (it == m_pageListenersMap.end())
+ return;
+
+ ListenerSet* listeners = it->second;
+ listeners->remove(listener);
+ if (listeners->isEmpty()) {
+ m_pageListenersMap.remove(it);
+ delete listeners;
+ }
+
+ didRemoveListener(page);
+ if (!hasListeners())
+ didRemoveLastListener();
+}
+
+void ScriptDebugServer::pageCreated(Page* page)
+{
+ ASSERT_ARG(page, page);
+
+ if (!hasListenersInterestedInPage(page))
+ return;
+ page->setDebugger(this);
+}
+
+bool ScriptDebugServer::hasListenersInterestedInPage(Page* page)
+{
+ ASSERT_ARG(page, page);
+
+ if (hasGlobalListeners())
+ return true;
+
+ return m_pageListenersMap.contains(page);
+}
+
+void ScriptDebugServer::setBreakpoint(const String& sourceID, unsigned lineNumber, ScriptBreakpoint breakpoint)
+{
+ intptr_t sourceIDValue = sourceID.toIntPtr();
+ BreakpointsMap::iterator it = m_breakpoints.find(sourceIDValue);
+ if (it == m_breakpoints.end())
+ it = m_breakpoints.set(sourceIDValue, SourceBreakpoints()).first;
+ it->second.set(lineNumber, breakpoint);
+}
+
+void ScriptDebugServer::removeBreakpoint(const String& sourceID, unsigned lineNumber)
+{
+ intptr_t sourceIDValue = sourceID.toIntPtr();
+ BreakpointsMap::iterator it = m_breakpoints.find(sourceIDValue);
+ if (it != m_breakpoints.end())
+ it->second.remove(lineNumber);
+}
+
+bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const
+{
+ BreakpointsMap::const_iterator it = m_breakpoints.find(sourceID);
+ if (it == m_breakpoints.end())
+ return false;
+ SourceBreakpoints::const_iterator breakIt = it->second.find(lineNumber);
+ if (breakIt == it->second.end() || !breakIt->second.enabled)
+ return false;
+
+ // An empty condition counts as no condition which is equivalent to "true".
+ if (breakIt->second.condition.isEmpty())
+ return true;
+
+ JSValue exception;
+ JSValue result = m_currentCallFrame->evaluate(breakIt->second.condition, exception);
+ if (exception) {
+ // An erroneous condition counts as "false".
+ return false;
+ }
+ return result.toBoolean(m_currentCallFrame->scopeChain()->globalObject->globalExec());
+}
+
+void ScriptDebugServer::clearBreakpoints()
+{
+ m_breakpoints.clear();
+}
+
+void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pause)
+{
+ m_pauseOnExceptionsState = pause;
+}
+
+void ScriptDebugServer::pauseProgram()
{
- JavaScriptDebugServer::shared().recompileAllJSFunctions();
+ m_pauseOnNextStatement = true;
+}
+
+void ScriptDebugServer::continueProgram()
+{
+ if (!m_paused)
+ return;
+
+ m_pauseOnNextStatement = false;
+ m_doneProcessingDebuggerEvents = true;
+}
+
+void ScriptDebugServer::stepIntoStatement()
+{
+ if (!m_paused)
+ return;
+
+ m_pauseOnNextStatement = true;
+ m_doneProcessingDebuggerEvents = true;
+}
+
+void ScriptDebugServer::stepOverStatement()
+{
+ if (!m_paused)
+ return;
+
+ m_pauseOnCallFrame = m_currentCallFrame.get();
+ m_doneProcessingDebuggerEvents = true;
+}
+
+void ScriptDebugServer::stepOutOfFunction()
+{
+ if (!m_paused)
+ return;
+
+ m_pauseOnCallFrame = m_currentCallFrame ? m_currentCallFrame->caller() : 0;
+ m_doneProcessingDebuggerEvents = true;
+}
+
+JavaScriptCallFrame* ScriptDebugServer::currentCallFrame()
+{
+ if (!m_paused)
+ return 0;
+ return m_currentCallFrame.get();
+}
+
+ScriptState* ScriptDebugServer::currentCallFrameState()
+{
+ if (!m_paused)
+ return 0;
+ return m_currentCallFrame->scopeChain()->globalObject->globalExec();
+}
+
+void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source)
+{
+ String sourceID = JSC::UString(JSC::UString::from(source.provider()->asID()));
+ String url = source.provider()->url();
+ String data = JSC::UString(source.data(), source.length());
+ int firstLine = source.firstLine();
+
+ Vector<Listener*> copy;
+ copyToVector(listeners, copy);
+ for (size_t i = 0; i < copy.size(); ++i)
+ copy[i]->didParseSource(sourceID, url, data, firstLine);
+}
+
+void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, const SourceCode& source, int errorLine, const String& errorMessage)
+{
+ String url = source.provider()->url();
+ String data = JSC::UString(source.data(), source.length());
+ int firstLine = source.firstLine();
+
+ Vector<Listener*> copy;
+ copyToVector(listeners, copy);
+ for (size_t i = 0; i < copy.size(); ++i)
+ copy[i]->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
+}
+
+static Page* toPage(JSGlobalObject* globalObject)
+{
+ ASSERT_ARG(globalObject, globalObject);
+
+ JSDOMWindow* window = asJSDOMWindow(globalObject);
+ Frame* frame = window->impl()->frame();
+ return frame ? frame->page() : 0;
+}
+
+void ScriptDebugServer::detach(JSGlobalObject* globalObject)
+{
+ // If we're detaching from the currently executing global object, manually tear down our
+ // stack, since we won't get further debugger callbacks to do so. Also, resume execution,
+ // since there's no point in staying paused once a window closes.
+ if (m_currentCallFrame && m_currentCallFrame->dynamicGlobalObject() == globalObject) {
+ m_currentCallFrame = 0;
+ m_pauseOnCallFrame = 0;
+ continueProgram();
+ }
+ Debugger::detach(globalObject);
+}
+
+void ScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, int errorLine, const UString& errorMessage)
+{
+ if (m_callingListeners)
+ return;
+
+ Page* page = toPage(exec->dynamicGlobalObject());
+ if (!page)
+ return;
+
+ m_callingListeners = true;
+
+ bool isError = errorLine != -1;
+
+ if (hasGlobalListeners()) {
+ if (isError)
+ dispatchFailedToParseSource(m_listeners, source, errorLine, errorMessage);
+ else
+ dispatchDidParseSource(m_listeners, source);
+ }
+
+ if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
+ ASSERT(!pageListeners->isEmpty());
+ if (isError)
+ dispatchFailedToParseSource(*pageListeners, source, errorLine, errorMessage);
+ else
+ dispatchDidParseSource(*pageListeners, source);
+ }
+
+ m_callingListeners = false;
+}
+
+void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback)
+{
+ Vector<Listener*> copy;
+ copyToVector(listeners, copy);
+ for (size_t i = 0; i < copy.size(); ++i)
+ (copy[i]->*callback)();
+}
+
+void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback, Page* page)
+{
+ if (m_callingListeners)
+ return;
+
+ m_callingListeners = true;
+
+ ASSERT(hasListeners());
+
+ dispatchFunctionToListeners(m_listeners, callback);
+
+ if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
+ ASSERT(!pageListeners->isEmpty());
+ dispatchFunctionToListeners(*pageListeners, callback);
+ }
+
+ m_callingListeners = false;
+}
+
+void ScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool paused)
+{
+ setMainThreadCallbacksPaused(paused);
+
+ const HashSet<Page*>& pages = pageGroup.pages();
+
+ HashSet<Page*>::const_iterator end = pages.end();
+ for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it)
+ setJavaScriptPaused(*it, paused);
+}
+
+void ScriptDebugServer::setJavaScriptPaused(Page* page, bool paused)
+{
+ ASSERT_ARG(page, page);
+
+ page->setDefersLoading(paused);
+
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ setJavaScriptPaused(frame, paused);
+}
+
+void ScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)
+{
+ ASSERT_ARG(frame, frame);
+
+ if (!frame->script()->canExecuteScripts())
+ return;
+
+ frame->script()->setPaused(paused);
+
+ Document* document = frame->document();
+ if (paused)
+ document->suspendActiveDOMObjects();
+ else
+ document->resumeActiveDOMObjects();
+
+ setJavaScriptPaused(frame->view(), paused);
+}
+
+#if PLATFORM(MAC)
+
+void ScriptDebugServer::setJavaScriptPaused(FrameView*, bool)
+{
+}
+
+#else
+
+void ScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused)
+{
+ if (!view)
+ return;
+
+ const HashSet<RefPtr<Widget> >* children = view->children();
+ ASSERT(children);
+
+ HashSet<RefPtr<Widget> >::const_iterator end = children->end();
+ for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
+ Widget* widget = (*it).get();
+ if (!widget->isPluginView())
+ continue;
+ static_cast<PluginView*>(widget)->setJavaScriptPaused(paused);
+ }
+}
+
+#endif
+
+void ScriptDebugServer::pauseIfNeeded(Page* page)
+{
+ if (m_paused)
+ return;
+
+ if (!page || !hasListenersInterestedInPage(page))
+ return;
+
+ bool pauseNow = m_pauseOnNextStatement;
+ pauseNow |= (m_pauseOnCallFrame == m_currentCallFrame);
+ pauseNow |= (m_currentCallFrame->line() > 0 && hasBreakpoint(m_currentCallFrame->sourceID(), m_currentCallFrame->line()));
+ if (!pauseNow)
+ return;
+
+ m_pauseOnCallFrame = 0;
+ m_pauseOnNextStatement = false;
+ m_paused = true;
+
+ dispatchFunctionToListeners(&Listener::didPause, page);
+
+ setJavaScriptPaused(page->group(), true);
+
+ TimerBase::fireTimersInNestedEventLoop();
+
+ EventLoop loop;
+ m_doneProcessingDebuggerEvents = false;
+ while (!m_doneProcessingDebuggerEvents && !loop.ended())
+ loop.cycle();
+
+ setJavaScriptPaused(page->group(), false);
+
+ m_paused = false;
+
+ dispatchFunctionToListeners(&Listener::didContinue, page);
+}
+
+void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+{
+ if (m_paused)
+ return;
+
+ m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+}
+
+void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+{
+ if (m_paused)
+ return;
+
+ ASSERT(m_currentCallFrame);
+ if (!m_currentCallFrame)
+ return;
+
+ m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+}
+
+void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+{
+ if (m_paused)
+ return;
+
+ ASSERT(m_currentCallFrame);
+ if (!m_currentCallFrame)
+ return;
+
+ m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+
+ // Treat stepping over a return statement like stepping out.
+ if (m_currentCallFrame == m_pauseOnCallFrame)
+ m_pauseOnCallFrame = m_currentCallFrame->caller();
+ m_currentCallFrame = m_currentCallFrame->caller();
+}
+
+void ScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, bool hasHandler)
+{
+ if (m_paused)
+ return;
+
+ ASSERT(m_currentCallFrame);
+ if (!m_currentCallFrame)
+ return;
+
+ if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler))
+ m_pauseOnNextStatement = true;
+
+ m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+}
+
+void ScriptDebugServer::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+{
+ if (m_paused)
+ return;
+
+ m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+}
+
+void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+{
+ if (m_paused)
+ return;
+
+ ASSERT(m_currentCallFrame);
+ if (!m_currentCallFrame)
+ return;
+
+ m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+
+ // Treat stepping over the end of a program like stepping out.
+ if (m_currentCallFrame == m_pauseOnCallFrame)
+ m_pauseOnCallFrame = m_currentCallFrame->caller();
+ m_currentCallFrame = m_currentCallFrame->caller();
+}
+
+void ScriptDebugServer::didReachBreakpoint(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+{
+ if (m_paused)
+ return;
+
+ ASSERT(m_currentCallFrame);
+ if (!m_currentCallFrame)
+ return;
+
+ m_pauseOnNextStatement = true;
+ m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
+ pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
}
void ScriptDebugServer::recompileAllJSFunctionsSoon()
{
- JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ m_recompileTimer.startOneShot(0);
+}
+
+void ScriptDebugServer::recompileAllJSFunctions(Timer<ScriptDebugServer>*)
+{
+ JSLock lock(SilenceAssertionsOnly);
+ Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData());
+}
+
+void ScriptDebugServer::didAddListener(Page* page)
+{
+ recompileAllJSFunctionsSoon();
+
+ if (page)
+ page->setDebugger(this);
+ else
+ Page::setDebuggerForAllPages(this);
+}
+
+void ScriptDebugServer::didRemoveListener(Page* page)
+{
+ if (hasGlobalListeners() || (page && hasListenersInterestedInPage(page)))
+ return;
+
+ recompileAllJSFunctionsSoon();
+
+ if (page)
+ page->setDebugger(0);
+ else
+ Page::setDebuggerForAllPages(0);
+}
+
+void ScriptDebugServer::didRemoveLastListener()
+{
+ m_doneProcessingDebuggerEvents = true;
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h
index 027ffa5..475c0c7 100644
--- a/WebCore/bindings/js/ScriptDebugServer.h
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -1,27 +1,30 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptDebugServer_h
@@ -29,14 +32,129 @@
#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include <wtf/Noncopyable.h>
+#include "PlatformString.h"
+#include "ScriptBreakpoint.h"
+#include "ScriptState.h"
+#include "Timer.h"
+
+#include <debugger/Debugger.h>
+#include <runtime/UString.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/RefPtr.h>
+namespace JSC {
+class DebuggerCallFrame;
+class JSGlobalObject;
+}
namespace WebCore {
-class ScriptDebugServer : public Noncopyable {
+class Frame;
+class FrameView;
+class Page;
+class PageGroup;
+class JavaScriptCallFrame;
+
+class Frame;
+class Page;
+class String;
+
+class ScriptDebugServer : JSC::Debugger, public Noncopyable {
public:
- static void recompileAllJSFunctions();
- static void recompileAllJSFunctionsSoon();
+ class Listener {
+ public:
+ virtual ~Listener() { }
+
+ virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine) = 0;
+ virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0;
+ virtual void didPause() = 0;
+ virtual void didContinue() = 0;
+ };
+
+ static ScriptDebugServer& shared();
+
+ void addListener(Listener*, Page*);
+ void removeListener(Listener*, Page*);
+
+ void setBreakpoint(const String& sourceID, unsigned lineNumber, ScriptBreakpoint breakpoint);
+ void removeBreakpoint(const String& sourceID, unsigned lineNumber);
+ void clearBreakpoints();
+
+ enum PauseOnExceptionsState {
+ DontPauseOnExceptions,
+ PauseOnAllExceptions,
+ PauseOnUncaughtExceptions
+ };
+ PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; }
+ void setPauseOnExceptionsState(PauseOnExceptionsState);
+
+ void pauseProgram();
+ void continueProgram();
+ void stepIntoStatement();
+ void stepOverStatement();
+ void stepOutOfFunction();
+
+ void recompileAllJSFunctionsSoon();
+ void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0);
+
+ JavaScriptCallFrame* currentCallFrame();
+ ScriptState* currentCallFrameState();
+
+ void pageCreated(Page*);
+
+private:
+ typedef HashSet<Listener*> ListenerSet;
+ typedef void (Listener::*JavaScriptExecutionCallback)();
+
+ ScriptDebugServer();
+ ~ScriptDebugServer();
+
+ bool hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const;
+ bool hasListeners() const { return !m_listeners.isEmpty() || !m_pageListenersMap.isEmpty(); }
+ bool hasGlobalListeners() const { return !m_listeners.isEmpty(); }
+ bool hasListenersInterestedInPage(Page*);
+
+ void setJavaScriptPaused(const PageGroup&, bool paused);
+ void setJavaScriptPaused(Page*, bool paused);
+ void setJavaScriptPaused(Frame*, bool paused);
+ void setJavaScriptPaused(FrameView*, bool paused);
+
+ void dispatchFunctionToListeners(JavaScriptExecutionCallback, Page*);
+ void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback);
+ void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source);
+ void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage);
+
+ void pauseIfNeeded(Page*);
+
+ virtual void detach(JSC::JSGlobalObject*);
+
+ virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int errorLine, const JSC::UString& errorMsg);
+ virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
+ virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int firstLine);
+ virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
+ virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler);
+ virtual void willExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
+ virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
+ virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
+
+ void didAddListener(Page*);
+ void didRemoveListener(Page*);
+ void didRemoveLastListener();
+
+ typedef HashMap<Page*, ListenerSet*> PageListenersMap;
+ typedef HashMap<intptr_t, SourceBreakpoints> BreakpointsMap;
+
+ PageListenersMap m_pageListenersMap;
+ ListenerSet m_listeners;
+ bool m_callingListeners;
+ PauseOnExceptionsState m_pauseOnExceptionsState;
+ bool m_pauseOnNextStatement;
+ bool m_paused;
+ bool m_doneProcessingDebuggerEvents;
+ JavaScriptCallFrame* m_pauseOnCallFrame;
+ RefPtr<JavaScriptCallFrame> m_currentCallFrame;
+ BreakpointsMap m_breakpoints;
+ Timer<ScriptDebugServer> m_recompileTimer;
};
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index 3fe8c34..724b474 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -29,17 +29,20 @@
*/
#include "config.h"
-
#include "ScriptDebugServer.h"
-namespace WebCore {
+#if ENABLE(JAVASCRIPT_DEBUGGER)
-void ScriptDebugServer::recompileAllJSFunctions()
-{
-}
+#include <wtf/StdLibExtras.h>
-void ScriptDebugServer::recompileAllJSFunctionsSoon()
+namespace WebCore {
+
+ScriptDebugServer& ScriptDebugServer::shared()
{
+ DEFINE_STATIC_LOCAL(ScriptDebugServer, server, ());
+ return server;
}
} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
index b37af2f..1e66011 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.h
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -31,16 +31,66 @@
#ifndef ScriptDebugServer_h
#define ScriptDebugServer_h
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "PlatformString.h"
+#include "ScriptBreakpoint.h"
+#include "ScriptState.h"
+#include "Timer.h"
+
#include <wtf/Noncopyable.h>
namespace WebCore {
class ScriptDebugServer : public Noncopyable {
public:
- static void recompileAllJSFunctions();
- static void recompileAllJSFunctionsSoon();
+ class Listener {
+ public:
+ virtual ~Listener() { }
+
+ virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine) = 0;
+ virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0;
+ virtual void didPause() = 0;
+ virtual void didContinue() = 0;
+ };
+
+ static ScriptDebugServer& shared();
+
+ void addListener(Listener*, Page*) { }
+ void removeListener(Listener*, Page*) { }
+
+ void setBreakpoint(const String& sourceID, unsigned lineNumber, ScriptBreakpoint breakpoint) { }
+ void removeBreakpoint(const String& sourceID, unsigned lineNumber) { }
+ void clearBreakpoints() { }
+
+ enum PauseOnExceptionsState {
+ DontPauseOnExceptions,
+ PauseOnAllExceptions,
+ PauseOnUncaughtExceptions
+ };
+ PauseOnExceptionsState pauseOnExceptionsState() const { return DontPauseOnExceptions; }
+ void setPauseOnExceptionsState(PauseOnExceptionsState) { }
+
+ void pauseProgram() { }
+ void continueProgram() { }
+ void stepIntoStatement() { }
+ void stepOverStatement() { }
+ void stepOutOfFunction() { }
+
+ void recompileAllJSFunctionsSoon() { }
+ void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { }
+
+ ScriptState* currentCallFrameState() { return 0; }
+
+ void pageCreated(Page*) { }
+
+private:
+ ScriptDebugServer() { }
+ ~ScriptDebugServer() { }
};
} // namespace WebCore
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+
#endif // ScriptDebugServer_h
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 054f9ba..f588169 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -151,6 +151,20 @@ v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const
return v8::Undefined();
}
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+v8::Handle<v8::Value> V8InjectedScriptHost::currentCallFrameCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.currentCallFrame()");
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8InjectedScriptHost::isActivationCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.isActivation()");
+ return v8::Undefined();
+}
+#endif
+
#if ENABLE(DATABASE)
v8::Handle<v8::Value> V8InjectedScriptHost::databaseForIdCallback(const v8::Arguments& args)
{
diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp
index 62db4b4..6dbbdfd 100644
--- a/WebCore/inspector/InjectedScriptHost.cpp
+++ b/WebCore/inspector/InjectedScriptHost.cpp
@@ -46,10 +46,8 @@
#include "InspectorResource.h"
#include "Pasteboard.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-#include "JavaScriptCallFrame.h"
-#include "JavaScriptDebugServer.h"
-using namespace JSC;
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "ScriptDebugServer.h"
#endif
#if ENABLE(DATABASE)
@@ -130,13 +128,6 @@ long InjectedScriptHost::pushNodeByPathToFrontend(const String& path)
return domAgent->pushNodePathToFrontend(node);
}
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-JavaScriptCallFrame* InjectedScriptHost::currentCallFrame() const
-{
- return JavaScriptDebugServer::shared().currentCallFrame();
-}
-#endif
-
#if ENABLE(DATABASE)
Database* InjectedScriptHost::databaseForId(long databaseId)
{
diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h
index fb56115..112d556 100644
--- a/WebCore/inspector/InjectedScriptHost.h
+++ b/WebCore/inspector/InjectedScriptHost.h
@@ -73,9 +73,6 @@ public:
void addNodesToSearchResult(const String& nodeIds);
long pushNodeByPathToFrontend(const String& path);
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
- JavaScriptCallFrame* currentCallFrame() const;
-#endif
#if ENABLE(DATABASE)
Database* databaseForId(long databaseId);
void selectDatabase(Database* database);
diff --git a/WebCore/inspector/InjectedScriptHost.idl b/WebCore/inspector/InjectedScriptHost.idl
index bb57c3a..73a36fd 100644
--- a/WebCore/inspector/InjectedScriptHost.idl
+++ b/WebCore/inspector/InjectedScriptHost.idl
@@ -41,7 +41,7 @@ module core {
void addNodesToSearchResult(in DOMString nodeIds);
long pushNodeByPathToFrontend(in DOMString path);
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING)
+#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
[Custom] DOMObject currentCallFrame();
[Custom] boolean isActivation(in DOMObject object);
#endif
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index c43be63..14743c0 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -49,16 +49,15 @@
#include "InspectorResource.h"
#include "Pasteboard.h"
#include "ScriptArray.h"
+#include "ScriptBreakpoint.h"
#include "SerializedScriptValue.h"
#if ENABLE(DOM_STORAGE)
#include "Storage.h"
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-#include "JavaScriptCallFrame.h"
-#include "JavaScriptDebugServer.h"
-using namespace JSC;
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "ScriptDebugServer.h"
#endif
#include "markup.h"
@@ -148,7 +147,7 @@ void InspectorBackend::stopTimelineProfiler()
m_inspectorController->stopTimelineProfiler();
}
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
bool InspectorBackend::debuggerEnabled() const
{
if (m_inspectorController)
@@ -168,27 +167,21 @@ void InspectorBackend::disableDebugger(bool always)
m_inspectorController->disableDebugger(always);
}
-void InspectorBackend::addBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition)
-{
- intptr_t sourceIDValue = sourceID.toIntPtr();
- JavaScriptDebugServer::shared().addBreakpoint(sourceIDValue, lineNumber, condition);
-}
-
-void InspectorBackend::updateBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition)
+void InspectorBackend::setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition)
{
- intptr_t sourceIDValue = sourceID.toIntPtr();
- JavaScriptDebugServer::shared().updateBreakpoint(sourceIDValue, lineNumber, condition);
+ if (m_inspectorController)
+ m_inspectorController->setBreakpoint(sourceID, lineNumber, enabled, condition);
}
void InspectorBackend::removeBreakpoint(const String& sourceID, unsigned lineNumber)
{
- intptr_t sourceIDValue = sourceID.toIntPtr();
- JavaScriptDebugServer::shared().removeBreakpoint(sourceIDValue, lineNumber);
+ if (m_inspectorController)
+ m_inspectorController->removeBreakpoint(sourceID, lineNumber);
}
void InspectorBackend::pauseInDebugger()
{
- JavaScriptDebugServer::shared().pauseProgram();
+ ScriptDebugServer::shared().pauseProgram();
}
void InspectorBackend::resumeDebugger()
@@ -199,33 +192,29 @@ void InspectorBackend::resumeDebugger()
void InspectorBackend::stepOverStatementInDebugger()
{
- JavaScriptDebugServer::shared().stepOverStatement();
+ ScriptDebugServer::shared().stepOverStatement();
}
void InspectorBackend::stepIntoStatementInDebugger()
{
- JavaScriptDebugServer::shared().stepIntoStatement();
+ ScriptDebugServer::shared().stepIntoStatement();
}
void InspectorBackend::stepOutOfFunctionInDebugger()
{
- JavaScriptDebugServer::shared().stepOutOfFunction();
+ ScriptDebugServer::shared().stepOutOfFunction();
}
long InspectorBackend::pauseOnExceptionsState()
{
- return JavaScriptDebugServer::shared().pauseOnExceptionsState();
+ return ScriptDebugServer::shared().pauseOnExceptionsState();
}
void InspectorBackend::setPauseOnExceptionsState(long pauseState)
{
- JavaScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<JavaScriptDebugServer::PauseOnExceptionsState>(pauseState));
+ ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
}
-JavaScriptCallFrame* InspectorBackend::currentCallFrame() const
-{
- return JavaScriptDebugServer::shared().currentCallFrame();
-}
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index 0df13f5..d31a181 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -41,7 +41,6 @@ class CachedResource;
class Database;
class InspectorDOMAgent;
class InspectorFrontend;
-class JavaScriptCallFrame;
class Node;
class Storage;
@@ -73,13 +72,12 @@ public:
void startTimelineProfiler();
void stopTimelineProfiler();
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
bool debuggerEnabled() const;
void enableDebugger(bool always);
void disableDebugger(bool always);
- void addBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition);
- void updateBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition);
+ void setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition);
void removeBreakpoint(const String& sourceID, unsigned lineNumber);
void pauseInDebugger();
@@ -92,9 +90,6 @@ public:
void stepIntoStatementInDebugger();
void stepOutOfFunctionInDebugger();
- JavaScriptCallFrame* currentCallFrame() const;
-#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
bool profilerEnabled();
void enableProfiler(bool always);
void disableProfiler(bool always);
diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl
index 9faae76..1cd4bf2 100644
--- a/WebCore/inspector/InspectorBackend.idl
+++ b/WebCore/inspector/InspectorBackend.idl
@@ -47,13 +47,12 @@ module core {
void startTimelineProfiler();
void stopTimelineProfiler();
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING)
+#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
boolean debuggerEnabled();
void enableDebugger(in boolean always);
void disableDebugger(in boolean always);
- void addBreakpoint(in DOMString sourceID, in unsigned long lineNumber, in DOMString condition);
- void updateBreakpoint(in DOMString sourceID, in unsigned long lineNumber, in DOMString condition);
+ void setBreakpoint(in DOMString sourceID, in unsigned long lineNumber, in boolean enabled, in DOMString condition);
void removeBreakpoint(in DOMString sourceID, in unsigned long lineNumber);
void pauseInDebugger();
@@ -65,8 +64,7 @@ module core {
long pauseOnExceptionsState();
void setPauseOnExceptionsState(in long pauseOnExceptionsState);
-#endif
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
+
boolean profilerEnabled();
void enableProfiler(in boolean always);
void disableProfiler(in boolean always);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index b487ad8..46f0be3 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -70,8 +70,8 @@
#include "RenderInline.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
+#include "ScriptBreakpoint.h"
#include "ScriptCallStack.h"
-#include "ScriptDebugServer.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
#include "ScriptProfile.h"
@@ -96,17 +96,17 @@
#include "StorageArea.h"
#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "ScriptDebugServer.h"
+#endif
+
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-#include "JSJavaScriptCallFrame.h"
-#include "JavaScriptCallFrame.h"
-#include "JavaScriptDebugServer.h"
#include "JavaScriptProfile.h"
#include <runtime/JSLock.h>
#include <runtime/UString.h>
-
-using namespace JSC;
#endif
+
using namespace std;
namespace WebCore {
@@ -144,7 +144,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
, m_inspectorBackend(InspectorBackend::create(this))
, m_inspectorFrontendHost(InspectorFrontendHost::create(this, client))
, m_injectedScriptHost(InjectedScriptHost::create(this))
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
, m_debuggerEnabled(false)
, m_attachDebuggerWhenShown(false)
#endif
@@ -305,13 +305,13 @@ void InspectorController::setWindowVisible(bool visible, bool attached)
if (m_nodeToFocus)
focusNode();
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
if (m_attachDebuggerWhenShown)
enableDebugger();
#endif
showPanel(m_showAfterVisible);
} else {
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
// If the window is being closed with the debugger enabled,
// remember this state to re-enable debugger on the next window
// opening.
@@ -527,7 +527,7 @@ void InspectorController::scriptObjectReady()
return;
setFrontendProxyObject(m_frontendScriptState, webInspectorObj);
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
String debuggerEnabled = setting(debuggerEnabledSettingName);
if (debuggerEnabled == "true")
enableDebugger();
@@ -596,7 +596,7 @@ void InspectorController::close()
if (!enabled())
return;
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
stopUserInitiatedProfiling();
disableDebugger();
#endif
@@ -747,6 +747,9 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
m_times.clear();
m_counts.clear();
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_sourceIDToURL.clear();
+#endif
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
m_profiles.clear();
m_currentUserInitiatedProfileNumber = 1;
@@ -1357,7 +1360,7 @@ void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsig
if (m_frontend) {
#if USE(JSC)
- JSLock lock(SilenceAssertionsOnly);
+ JSC::JSLock lock(JSC::SilenceAssertionsOnly);
#endif
m_frontend->addProfileHeader(createProfileHeader(*profile));
}
@@ -1431,7 +1434,7 @@ void InspectorController::startUserInitiatedProfiling(Timer<InspectorController>
if (!profilerEnabled()) {
enableProfiler(false, true);
- ScriptDebugServer::recompileAllJSFunctions();
+ ScriptDebugServer::shared().recompileAllJSFunctions();
}
m_recordingUserInitiatedProfile = true;
@@ -1439,7 +1442,7 @@ void InspectorController::startUserInitiatedProfiling(Timer<InspectorController>
String title = getCurrentUserInitiatedProfileName(true);
#if USE(JSC)
- ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
+ JSC::ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
#else
ScriptState* scriptState = 0;
#endif
@@ -1460,7 +1463,7 @@ void InspectorController::stopUserInitiatedProfiling()
String title = getCurrentUserInitiatedProfileName();
#if USE(JSC)
- ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
+ JSC::ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
#else
ScriptState* scriptState = 0;
#endif
@@ -1489,7 +1492,7 @@ void InspectorController::enableProfiler(bool always, bool skipRecompile)
m_profilerEnabled = true;
if (!skipRecompile)
- ScriptDebugServer::recompileAllJSFunctionsSoon();
+ ScriptDebugServer::shared().recompileAllJSFunctionsSoon();
if (m_frontend)
m_frontend->profilerWasEnabled();
@@ -1505,14 +1508,14 @@ void InspectorController::disableProfiler(bool always)
m_profilerEnabled = false;
- ScriptDebugServer::recompileAllJSFunctionsSoon();
+ ScriptDebugServer::shared().recompileAllJSFunctionsSoon();
if (m_frontend)
m_frontend->profilerWasDisabled();
}
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorController::enableDebuggerFromFrontend(bool always)
{
if (always)
@@ -1520,8 +1523,8 @@ void InspectorController::enableDebuggerFromFrontend(bool always)
ASSERT(m_inspectedPage);
- JavaScriptDebugServer::shared().addListener(this, m_inspectedPage);
- JavaScriptDebugServer::shared().clearBreakpoints();
+ ScriptDebugServer::shared().addListener(this, m_inspectedPage);
+ ScriptDebugServer::shared().clearBreakpoints();
m_debuggerEnabled = true;
m_frontend->debuggerWasEnabled();
@@ -1553,7 +1556,7 @@ void InspectorController::disableDebugger(bool always)
ASSERT(m_inspectedPage);
- JavaScriptDebugServer::shared().removeListener(this, m_inspectedPage);
+ ScriptDebugServer::shared().removeListener(this, m_inspectedPage);
m_debuggerEnabled = false;
m_attachDebuggerWhenShown = false;
@@ -1566,25 +1569,66 @@ void InspectorController::resumeDebugger()
{
if (!m_debuggerEnabled)
return;
- JavaScriptDebugServer::shared().continueProgram();
+ ScriptDebugServer::shared().continueProgram();
+}
+
+void InspectorController::setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition)
+{
+ ScriptBreakpoint breakpoint(enabled, condition);
+ ScriptDebugServer::shared().setBreakpoint(sourceID, lineNumber, breakpoint);
+ String url = m_sourceIDToURL.get(sourceID);
+ if (url.isEmpty())
+ return;
+
+ HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(url);
+ if (it == m_stickyBreakpoints.end())
+ it = m_stickyBreakpoints.set(url, SourceBreakpoints()).first;
+ it->second.set(lineNumber, breakpoint);
+}
+
+void InspectorController::removeBreakpoint(const String& sourceID, unsigned lineNumber)
+{
+ ScriptDebugServer::shared().removeBreakpoint(sourceID, lineNumber);
+
+ String url = m_sourceIDToURL.get(sourceID);
+ if (url.isEmpty())
+ return;
+
+ HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(url);
+ if (it != m_stickyBreakpoints.end())
+ it->second.remove(lineNumber);
}
// JavaScriptDebugListener functions
-void InspectorController::didParseSource(ExecState*, const SourceCode& source)
+void InspectorController::didParseSource(const String& sourceID, const String& url, const String& data, int firstLine)
{
- m_frontend->parsedScriptSource(source);
+ m_frontend->parsedScriptSource(sourceID, url, data, firstLine);
+
+ if (url.isEmpty())
+ return;
+
+ HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(url);
+ if (it != m_stickyBreakpoints.end()) {
+ for (SourceBreakpoints::iterator breakpointIt = it->second.begin(); breakpointIt != it->second.end(); ++breakpointIt) {
+ if (firstLine <= breakpointIt->first) {
+ ScriptDebugServer::shared().setBreakpoint(sourceID, breakpointIt->first, breakpointIt->second);
+ m_frontend->restoredBreakpoint(sourceID, url, breakpointIt->first, breakpointIt->second.enabled, breakpointIt->second.condition);
+ }
+ }
+ }
+
+ m_sourceIDToURL.set(sourceID, url);
}
-void InspectorController::failedToParseSource(ExecState*, const SourceCode& source, int errorLine, const UString& errorMessage)
+void InspectorController::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage)
{
- m_frontend->failedToParseScriptSource(source, errorLine, errorMessage);
+ m_frontend->failedToParseScriptSource(url, data, firstLine, errorLine, errorMessage);
}
void InspectorController::didPause()
{
- JavaScriptCallFrame* callFrame = m_injectedScriptHost->currentCallFrame();
- ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec();
+ ScriptState* scriptState = ScriptDebugServer::shared().currentCallFrameState();
ASSERT(scriptState);
InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState);
RefPtr<SerializedScriptValue> callFrames = injectedScript.callFrames();
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 2f25eec..169c42b 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -47,12 +47,8 @@
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-#include "JavaScriptDebugListener.h"
-
-namespace JSC {
-class UString;
-}
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "ScriptDebugServer.h"
#endif
namespace WebCore {
@@ -90,8 +86,8 @@ class InspectorDOMStorageResource;
class InspectorResource;
class InspectorController
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
- : JavaScriptDebugListener, public Noncopyable
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ : ScriptDebugServer::Listener, public Noncopyable
#else
: public Noncopyable
#endif
@@ -236,15 +232,15 @@ public:
bool profilerEnabled() const { return enabled() && m_profilerEnabled; }
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void enableDebugger();
void disableDebugger(bool always = false);
bool debuggerEnabled() const { return m_debuggerEnabled; }
void resumeDebugger();
- virtual void didParseSource(JSC::ExecState*, const JSC::SourceCode&);
- virtual void failedToParseSource(JSC::ExecState*, const JSC::SourceCode&, int errorLine, const JSC::UString& errorMessage);
+ virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine);
+ virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage);
virtual void didPause();
virtual void didContinue();
#endif
@@ -271,6 +267,9 @@ private:
void deleteCookie(const String& cookieName, const String& domain);
#if ENABLE(JAVASCRIPT_DEBUGGER)
+ void setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition);
+ void removeBreakpoint(const String& sourceID, unsigned lineNumber);
+
typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
void startUserInitiatedProfilingSoon();
@@ -348,11 +347,12 @@ private:
mutable Settings m_settings;
Vector<pair<long, String> > m_pendingEvaluateTestCommands;
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
bool m_debuggerEnabled;
bool m_attachDebuggerWhenShown;
-#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+ HashMap<String, String> m_sourceIDToURL;
+ HashMap<String, SourceBreakpoints> m_stickyBreakpoints;
+
bool m_profilerEnabled;
bool m_recordingUserInitiatedProfile;
int m_currentUserInitiatedProfileNumber;
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index 90b60f4..b33ea6a 100755
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -46,12 +46,6 @@
#include "SerializedScriptValue.h"
#include <wtf/OwnPtr.h>
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-#include <parser/SourceCode.h>
-#include <runtime/JSValue.h>
-#include <runtime/UString.h>
-#endif
-
namespace WebCore {
InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector)
@@ -250,7 +244,7 @@ void InspectorFrontend::addRecordToTimeline(const ScriptObject& record)
function.call();
}
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorFrontend::attachDebuggerWhenShown()
{
callSimpleFunction("attachDebuggerWhenShown");
@@ -266,24 +260,36 @@ void InspectorFrontend::debuggerWasDisabled()
callSimpleFunction("debuggerWasDisabled");
}
-void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source)
+void InspectorFrontend::parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine)
{
ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("parsedScriptSource");
- function.appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID())));
- function.appendArgument(source.provider()->url());
- function.appendArgument(JSC::UString(source.data(), source.length()));
- function.appendArgument(source.firstLine());
+ function.appendArgument(sourceID);
+ function.appendArgument(url);
+ function.appendArgument(data);
+ function.appendArgument(firstLine);
+ function.call();
+}
+
+void InspectorFrontend::restoredBreakpoint(const String& sourceID, const String& url, int line, bool enabled, const String& condition)
+{
+ ScriptFunctionCall function(m_webInspector, "dispatch");
+ function.appendArgument("restoredBreakpoint");
+ function.appendArgument(sourceID);
+ function.appendArgument(url);
+ function.appendArgument(line);
+ function.appendArgument(enabled);
+ function.appendArgument(condition);
function.call();
}
-void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage)
+void InspectorFrontend::failedToParseScriptSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage)
{
ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("failedToParseScriptSource");
- function.appendArgument(source.provider()->url());
- function.appendArgument(JSC::UString(source.data(), source.length()));
- function.appendArgument(source.firstLine());
+ function.appendArgument(url);
+ function.appendArgument(data);
+ function.appendArgument(firstLine);
function.appendArgument(errorLine);
function.appendArgument(errorMessage);
function.call();
@@ -302,9 +308,7 @@ void InspectorFrontend::resumedScript()
{
callSimpleFunction("resumedScript");
}
-#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorFrontend::profilerWasEnabled()
{
callSimpleFunction("profilerWasEnabled");
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index 1a37256..fa09eba 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -35,14 +35,6 @@
#include "ScriptState.h"
#include <wtf/PassOwnPtr.h>
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-namespace JSC {
- class JSValue;
- class SourceCode;
- class UString;
-}
-#endif
-
namespace WebCore {
class ConsoleMessage;
class Database;
@@ -84,16 +76,17 @@ namespace WebCore {
void resourceTrackingWasEnabled();
void resourceTrackingWasDisabled();
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void attachDebuggerWhenShown();
void debuggerWasEnabled();
void debuggerWasDisabled();
- void parsedScriptSource(const JSC::SourceCode&);
- void failedToParseScriptSource(const JSC::SourceCode&, int errorLine, const JSC::UString& errorMessage);
+
+ void parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine);
+ void restoredBreakpoint(const String& sourceID, const String& url, int line, bool enabled, const String& condition);
+ void failedToParseScriptSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage);
void pausedScript(SerializedScriptValue* callFrames);
void resumedScript();
-#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+
void profilerWasEnabled();
void profilerWasDisabled();
void addProfileHeader(const ScriptValue& profile);
diff --git a/WebCore/inspector/JavaScriptDebugListener.h b/WebCore/inspector/JavaScriptDebugListener.h
deleted file mode 100644
index 6570065..0000000
--- a/WebCore/inspector/JavaScriptDebugListener.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef JavaScriptDebugListener_h
-#define JavaScriptDebugListener_h
-
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-
-namespace JSC {
- class ExecState;
- class SourceCode;
- class UString;
-}
-
-namespace WebCore {
-
- class Frame;
- class Page;
-
- class JavaScriptDebugListener {
- public:
- virtual ~JavaScriptDebugListener() { }
-
- virtual void didParseSource(JSC::ExecState*, const JSC::SourceCode& source) = 0;
- virtual void failedToParseSource(JSC::ExecState*, const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage) = 0;
- virtual void didPause() = 0;
- virtual void didContinue() = 0;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
-
-#endif // JavaScriptDebugListener_h
diff --git a/WebCore/inspector/JavaScriptDebugServer.cpp b/WebCore/inspector/JavaScriptDebugServer.cpp
deleted file mode 100644
index 03c3577..0000000
--- a/WebCore/inspector/JavaScriptDebugServer.cpp
+++ /dev/null
@@ -1,641 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JavaScriptDebugServer.h"
-
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-
-#include "DOMWindow.h"
-#include "EventLoop.h"
-#include "Frame.h"
-#include "FrameTree.h"
-#include "FrameView.h"
-#include "JSDOMWindowCustom.h"
-#include "JavaScriptCallFrame.h"
-#include "JavaScriptDebugListener.h"
-#include "Page.h"
-#include "PageGroup.h"
-#include "PluginView.h"
-#include "ScrollView.h"
-#include "Widget.h"
-#include "ScriptController.h"
-#include <debugger/DebuggerCallFrame.h>
-#include <runtime/JSLock.h>
-#include <wtf/MainThread.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/UnusedParam.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-typedef JavaScriptDebugServer::ListenerSet ListenerSet;
-
-inline const UString& JavaScriptDebugServer::BreakpointInfo::condition() const
-{
- return m_condition;
-}
-
-void JavaScriptDebugServer::BreakpointInfo::setCondition(const UString& condition)
-{
- m_condition = condition;
-}
-
-JavaScriptDebugServer& JavaScriptDebugServer::shared()
-{
- DEFINE_STATIC_LOCAL(JavaScriptDebugServer, server, ());
- return server;
-}
-
-JavaScriptDebugServer::JavaScriptDebugServer()
- : m_callingListeners(false)
- , m_pauseOnExceptionsState(DontPauseOnExceptions)
- , m_pauseOnNextStatement(false)
- , m_paused(false)
- , m_doneProcessingDebuggerEvents(true)
- , m_pauseOnCallFrame(0)
- , m_recompileTimer(this, &JavaScriptDebugServer::recompileAllJSFunctions)
-{
-}
-
-JavaScriptDebugServer::~JavaScriptDebugServer()
-{
- deleteAllValues(m_pageListenersMap);
- deleteAllValues(m_breakpoints);
-}
-
-void JavaScriptDebugServer::addListener(JavaScriptDebugListener* listener)
-{
- ASSERT_ARG(listener, listener);
-
- m_listeners.add(listener);
-
- didAddListener(0);
-}
-
-void JavaScriptDebugServer::removeListener(JavaScriptDebugListener* listener)
-{
- ASSERT_ARG(listener, listener);
-
- m_listeners.remove(listener);
-
- didRemoveListener(0);
- if (!hasListeners())
- didRemoveLastListener();
-}
-
-void JavaScriptDebugServer::addListener(JavaScriptDebugListener* listener, Page* page)
-{
- ASSERT_ARG(listener, listener);
- ASSERT_ARG(page, page);
-
- pair<PageListenersMap::iterator, bool> result = m_pageListenersMap.add(page, 0);
- if (result.second)
- result.first->second = new ListenerSet;
-
- ListenerSet* listeners = result.first->second;
- listeners->add(listener);
-
- didAddListener(page);
-}
-
-void JavaScriptDebugServer::removeListener(JavaScriptDebugListener* listener, Page* page)
-{
- ASSERT_ARG(listener, listener);
- ASSERT_ARG(page, page);
-
- PageListenersMap::iterator it = m_pageListenersMap.find(page);
- if (it == m_pageListenersMap.end())
- return;
-
- ListenerSet* listeners = it->second;
- listeners->remove(listener);
- if (listeners->isEmpty()) {
- m_pageListenersMap.remove(it);
- delete listeners;
- }
-
- didRemoveListener(page);
- if (!hasListeners())
- didRemoveLastListener();
-}
-
-void JavaScriptDebugServer::pageCreated(Page* page)
-{
- ASSERT_ARG(page, page);
-
- if (!hasListenersInterestedInPage(page))
- return;
- page->setDebugger(this);
-}
-
-bool JavaScriptDebugServer::hasListenersInterestedInPage(Page* page)
-{
- ASSERT_ARG(page, page);
-
- if (hasGlobalListeners())
- return true;
-
- return m_pageListenersMap.contains(page);
-}
-
-void JavaScriptDebugServer::addBreakpoint(intptr_t sourceID, unsigned lineNumber, const UString& condition)
-{
- LineToBreakpointInfoMap* sourceBreakpoints = m_breakpoints.get(sourceID);
- if (!sourceBreakpoints) {
- sourceBreakpoints = new LineToBreakpointInfoMap;
- m_breakpoints.set(sourceID, sourceBreakpoints);
- }
- BreakpointInfo* info = sourceBreakpoints->get(lineNumber);
- if (!info)
- sourceBreakpoints->set(lineNumber, new BreakpointInfo(condition));
- else
- updateBreakpointInfo(info, condition);
-}
-
-JavaScriptDebugServer::BreakpointInfo* JavaScriptDebugServer::breakpointInfo(intptr_t sourceID, unsigned lineNumber) const
-{
- LineToBreakpointInfoMap* sourceBreakpoints = m_breakpoints.get(sourceID);
- if (!sourceBreakpoints)
- return 0;
- return sourceBreakpoints->get(lineNumber);
-}
-
-void JavaScriptDebugServer::updateBreakpoint(intptr_t sourceID, unsigned lineNumber, const UString& condition)
-{
- BreakpointInfo* info = breakpointInfo(sourceID, lineNumber);
- if (!info)
- return;
- updateBreakpointInfo(info, condition);
-}
-
-void JavaScriptDebugServer::updateBreakpointInfo(BreakpointInfo* info, const UString& condition)
-{
- info->setCondition(condition);
-}
-
-void JavaScriptDebugServer::removeBreakpoint(intptr_t sourceID, unsigned lineNumber)
-{
- LineToBreakpointInfoMap* sourceBreakpoints = m_breakpoints.get(sourceID);
- if (!sourceBreakpoints)
- return;
-
- BreakpointInfo* info = sourceBreakpoints->get(lineNumber);
- if (!info)
- return;
-
- sourceBreakpoints->remove(lineNumber);
- delete info;
-
- if (sourceBreakpoints->isEmpty()) {
- m_breakpoints.remove(sourceID);
- delete sourceBreakpoints;
- }
-}
-
-bool JavaScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const
-{
- BreakpointInfo* info = breakpointInfo(sourceID, lineNumber);
- if (!info)
- return false;
-
- // An empty condition counts as no condition which is equivalent to "true".
- if (info->condition().isEmpty())
- return true;
-
- JSValue exception;
- JSValue result = m_currentCallFrame->evaluate(info->condition(), exception);
- if (exception) {
- // An erroneous condition counts as "false".
- return false;
- }
- return result.toBoolean(m_currentCallFrame->scopeChain()->globalObject->globalExec());
-}
-
-void JavaScriptDebugServer::clearBreakpoints()
-{
- BreakpointsMap::iterator end = m_breakpoints.end();
- for (BreakpointsMap::iterator it = m_breakpoints.begin(); it != end; ++it) {
- deleteAllValues(*(it->second));
- it->second->clear();
- }
- deleteAllValues(m_breakpoints);
- m_breakpoints.clear();
-}
-
-void JavaScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pause)
-{
- m_pauseOnExceptionsState = pause;
-}
-
-void JavaScriptDebugServer::pauseProgram()
-{
- m_pauseOnNextStatement = true;
-}
-
-void JavaScriptDebugServer::continueProgram()
-{
- if (!m_paused)
- return;
-
- m_pauseOnNextStatement = false;
- m_doneProcessingDebuggerEvents = true;
-}
-
-void JavaScriptDebugServer::stepIntoStatement()
-{
- if (!m_paused)
- return;
-
- m_pauseOnNextStatement = true;
- m_doneProcessingDebuggerEvents = true;
-}
-
-void JavaScriptDebugServer::stepOverStatement()
-{
- if (!m_paused)
- return;
-
- m_pauseOnCallFrame = m_currentCallFrame.get();
- m_doneProcessingDebuggerEvents = true;
-}
-
-void JavaScriptDebugServer::stepOutOfFunction()
-{
- if (!m_paused)
- return;
-
- m_pauseOnCallFrame = m_currentCallFrame ? m_currentCallFrame->caller() : 0;
- m_doneProcessingDebuggerEvents = true;
-}
-
-JavaScriptCallFrame* JavaScriptDebugServer::currentCallFrame()
-{
- if (!m_paused)
- return 0;
- return m_currentCallFrame.get();
-}
-
-static void dispatchDidParseSource(const ListenerSet& listeners, ExecState* exec, const JSC::SourceCode& source)
-{
- Vector<JavaScriptDebugListener*> copy;
- copyToVector(listeners, copy);
- for (size_t i = 0; i < copy.size(); ++i)
- copy[i]->didParseSource(exec, source);
-}
-
-static void dispatchFailedToParseSource(const ListenerSet& listeners, ExecState* exec, const SourceCode& source, int errorLine, const String& errorMessage)
-{
- Vector<JavaScriptDebugListener*> copy;
- copyToVector(listeners, copy);
- for (size_t i = 0; i < copy.size(); ++i)
- copy[i]->failedToParseSource(exec, source, errorLine, errorMessage);
-}
-
-static Page* toPage(JSGlobalObject* globalObject)
-{
- ASSERT_ARG(globalObject, globalObject);
-
- JSDOMWindow* window = asJSDOMWindow(globalObject);
- Frame* frame = window->impl()->frame();
- return frame ? frame->page() : 0;
-}
-
-void JavaScriptDebugServer::detach(JSGlobalObject* globalObject)
-{
- // If we're detaching from the currently executing global object, manually tear down our
- // stack, since we won't get further debugger callbacks to do so. Also, resume execution,
- // since there's no point in staying paused once a window closes.
- if (m_currentCallFrame && m_currentCallFrame->dynamicGlobalObject() == globalObject) {
- m_currentCallFrame = 0;
- m_pauseOnCallFrame = 0;
- continueProgram();
- }
- Debugger::detach(globalObject);
-}
-
-void JavaScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, int errorLine, const UString& errorMessage)
-{
- if (m_callingListeners)
- return;
-
- Page* page = toPage(exec->dynamicGlobalObject());
- if (!page)
- return;
-
- m_callingListeners = true;
-
- bool isError = errorLine != -1;
-
- if (hasGlobalListeners()) {
- if (isError)
- dispatchFailedToParseSource(m_listeners, exec, source, errorLine, errorMessage);
- else
- dispatchDidParseSource(m_listeners, exec, source);
- }
-
- if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
- ASSERT(!pageListeners->isEmpty());
- if (isError)
- dispatchFailedToParseSource(*pageListeners, exec, source, errorLine, errorMessage);
- else
- dispatchDidParseSource(*pageListeners, exec, source);
- }
-
- m_callingListeners = false;
-}
-
-static void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptDebugServer::JavaScriptExecutionCallback callback)
-{
- Vector<JavaScriptDebugListener*> copy;
- copyToVector(listeners, copy);
- for (size_t i = 0; i < copy.size(); ++i)
- (copy[i]->*callback)();
-}
-
-void JavaScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback, Page* page)
-{
- if (m_callingListeners)
- return;
-
- m_callingListeners = true;
-
- ASSERT(hasListeners());
-
- WebCore::dispatchFunctionToListeners(m_listeners, callback);
-
- if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
- ASSERT(!pageListeners->isEmpty());
- WebCore::dispatchFunctionToListeners(*pageListeners, callback);
- }
-
- m_callingListeners = false;
-}
-
-void JavaScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool paused)
-{
- setMainThreadCallbacksPaused(paused);
-
- const HashSet<Page*>& pages = pageGroup.pages();
-
- HashSet<Page*>::const_iterator end = pages.end();
- for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it)
- setJavaScriptPaused(*it, paused);
-}
-
-void JavaScriptDebugServer::setJavaScriptPaused(Page* page, bool paused)
-{
- ASSERT_ARG(page, page);
-
- page->setDefersLoading(paused);
-
- for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
- setJavaScriptPaused(frame, paused);
-}
-
-void JavaScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)
-{
- ASSERT_ARG(frame, frame);
-
- if (!frame->script()->canExecuteScripts())
- return;
-
- frame->script()->setPaused(paused);
-
- Document* document = frame->document();
- if (paused)
- document->suspendActiveDOMObjects();
- else
- document->resumeActiveDOMObjects();
-
- setJavaScriptPaused(frame->view(), paused);
-}
-
-#if PLATFORM(MAC)
-
-void JavaScriptDebugServer::setJavaScriptPaused(FrameView*, bool)
-{
-}
-
-#else
-
-void JavaScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused)
-{
- if (!view)
- return;
-
- const HashSet<RefPtr<Widget> >* children = view->children();
- ASSERT(children);
-
- HashSet<RefPtr<Widget> >::const_iterator end = children->end();
- for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
- Widget* widget = (*it).get();
- if (!widget->isPluginView())
- continue;
- static_cast<PluginView*>(widget)->setJavaScriptPaused(paused);
- }
-}
-
-#endif
-
-void JavaScriptDebugServer::pauseIfNeeded(Page* page)
-{
- if (m_paused)
- return;
-
- if (!page || !hasListenersInterestedInPage(page))
- return;
-
- bool pauseNow = m_pauseOnNextStatement;
- pauseNow |= (m_pauseOnCallFrame == m_currentCallFrame);
- pauseNow |= (m_currentCallFrame->line() > 0 && hasBreakpoint(m_currentCallFrame->sourceID(), m_currentCallFrame->line()));
- if (!pauseNow)
- return;
-
- m_pauseOnCallFrame = 0;
- m_pauseOnNextStatement = false;
- m_paused = true;
-
- dispatchFunctionToListeners(&JavaScriptDebugListener::didPause, page);
-
- setJavaScriptPaused(page->group(), true);
-
- TimerBase::fireTimersInNestedEventLoop();
-
- EventLoop loop;
- m_doneProcessingDebuggerEvents = false;
- while (!m_doneProcessingDebuggerEvents && !loop.ended())
- loop.cycle();
-
- setJavaScriptPaused(page->group(), false);
-
- m_paused = false;
-
- dispatchFunctionToListeners(&JavaScriptDebugListener::didContinue, page);
-}
-
-void JavaScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
-{
- if (m_paused)
- return;
-
- m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-}
-
-void JavaScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
-{
- if (m_paused)
- return;
-
- ASSERT(m_currentCallFrame);
- if (!m_currentCallFrame)
- return;
-
- m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-}
-
-void JavaScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
-{
- if (m_paused)
- return;
-
- ASSERT(m_currentCallFrame);
- if (!m_currentCallFrame)
- return;
-
- m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-
- // Treat stepping over a return statement like stepping out.
- if (m_currentCallFrame == m_pauseOnCallFrame)
- m_pauseOnCallFrame = m_currentCallFrame->caller();
- m_currentCallFrame = m_currentCallFrame->caller();
-}
-
-void JavaScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, bool hasHandler)
-{
- if (m_paused)
- return;
-
- ASSERT(m_currentCallFrame);
- if (!m_currentCallFrame)
- return;
-
- if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler))
- m_pauseOnNextStatement = true;
-
- m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-}
-
-void JavaScriptDebugServer::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
-{
- if (m_paused)
- return;
-
- m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-}
-
-void JavaScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
-{
- if (m_paused)
- return;
-
- ASSERT(m_currentCallFrame);
- if (!m_currentCallFrame)
- return;
-
- m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-
- // Treat stepping over the end of a program like stepping out.
- if (m_currentCallFrame == m_pauseOnCallFrame)
- m_pauseOnCallFrame = m_currentCallFrame->caller();
- m_currentCallFrame = m_currentCallFrame->caller();
-}
-
-void JavaScriptDebugServer::didReachBreakpoint(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
-{
- if (m_paused)
- return;
-
- ASSERT(m_currentCallFrame);
- if (!m_currentCallFrame)
- return;
-
- m_pauseOnNextStatement = true;
- m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
-}
-
-void JavaScriptDebugServer::recompileAllJSFunctionsSoon()
-{
- m_recompileTimer.startOneShot(0);
-}
-
-void JavaScriptDebugServer::recompileAllJSFunctions(Timer<JavaScriptDebugServer>*)
-{
- JSLock lock(SilenceAssertionsOnly);
- Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData());
-}
-
-void JavaScriptDebugServer::didAddListener(Page* page)
-{
- recompileAllJSFunctionsSoon();
-
- if (page)
- page->setDebugger(this);
- else
- Page::setDebuggerForAllPages(this);
-}
-
-void JavaScriptDebugServer::didRemoveListener(Page* page)
-{
- if (hasGlobalListeners() || (page && hasListenersInterestedInPage(page)))
- return;
-
- recompileAllJSFunctionsSoon();
-
- if (page)
- page->setDebugger(0);
- else
- Page::setDebuggerForAllPages(0);
-}
-
-void JavaScriptDebugServer::didRemoveLastListener()
-{
- m_doneProcessingDebuggerEvents = true;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/inspector/JavaScriptDebugServer.h b/WebCore/inspector/JavaScriptDebugServer.h
deleted file mode 100644
index d7c23bc..0000000
--- a/WebCore/inspector/JavaScriptDebugServer.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef JavaScriptDebugServer_h
-#define JavaScriptDebugServer_h
-
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-
-#include "Timer.h"
-#include <debugger/Debugger.h>
-#include <runtime/UString.h>
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/RefPtr.h>
-
-namespace JSC {
- class DebuggerCallFrame;
- class JSGlobalObject;
-}
-
-namespace WebCore {
-
- class Frame;
- class FrameView;
- class Page;
- class PageGroup;
- class JavaScriptCallFrame;
- class JavaScriptDebugListener;
-
- class JavaScriptDebugServer : JSC::Debugger, public Noncopyable {
- public:
- static JavaScriptDebugServer& shared();
-
- void addListener(JavaScriptDebugListener*);
- void removeListener(JavaScriptDebugListener*);
-
- void addListener(JavaScriptDebugListener*, Page*);
- void removeListener(JavaScriptDebugListener*, Page*);
-
- void addBreakpoint(intptr_t sourceID, unsigned lineNumber, const JSC::UString& condition);
- void updateBreakpoint(intptr_t sourceID, unsigned lineNumber, const JSC::UString& condition);
- void removeBreakpoint(intptr_t sourceID, unsigned lineNumber);
- bool hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const;
- void clearBreakpoints();
-
- enum PauseOnExceptionsState {
- DontPauseOnExceptions,
- PauseOnAllExceptions,
- PauseOnUncaughtExceptions
- };
- PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; }
- void setPauseOnExceptionsState(PauseOnExceptionsState);
-
- void pauseProgram();
- void continueProgram();
- void stepIntoStatement();
- void stepOverStatement();
- void stepOutOfFunction();
-
- void recompileAllJSFunctionsSoon();
- void recompileAllJSFunctions(Timer<JavaScriptDebugServer>* = 0);
-
- JavaScriptCallFrame* currentCallFrame();
-
- void pageCreated(Page*);
-
- typedef HashSet<JavaScriptDebugListener*> ListenerSet;
- typedef void (JavaScriptDebugListener::*JavaScriptExecutionCallback)();
-
- private:
- class BreakpointInfo {
- public:
- BreakpointInfo(const JSC::UString& condition) : m_condition(condition) {}
- const JSC::UString& condition() const;
- void setCondition(const JSC::UString& condition);
- private:
- JSC::UString m_condition;
- };
-
- JavaScriptDebugServer();
- ~JavaScriptDebugServer();
-
- bool hasListeners() const { return !m_listeners.isEmpty() || !m_pageListenersMap.isEmpty(); }
- bool hasGlobalListeners() const { return !m_listeners.isEmpty(); }
- bool hasListenersInterestedInPage(Page*);
-
- void setJavaScriptPaused(const PageGroup&, bool paused);
- void setJavaScriptPaused(Page*, bool paused);
- void setJavaScriptPaused(Frame*, bool paused);
- void setJavaScriptPaused(FrameView*, bool paused);
-
- void dispatchFunctionToListeners(JavaScriptExecutionCallback, Page*);
- void pauseIfNeeded(Page*);
- BreakpointInfo* breakpointInfo(intptr_t sourceID, unsigned lineNumber) const;
- void updateBreakpointInfo(BreakpointInfo* info, const JSC::UString& condition);
-
- virtual void detach(JSC::JSGlobalObject*);
-
- virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int errorLine, const JSC::UString& errorMsg);
- virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
- virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int firstLine);
- virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
- virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler);
- virtual void willExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
- virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
- virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
-
- void didAddListener(Page*);
- void didRemoveListener(Page*);
- void didRemoveLastListener();
-
- typedef HashMap<Page*, ListenerSet*> PageListenersMap;
- typedef HashMap<unsigned, BreakpointInfo*> LineToBreakpointInfoMap;
- typedef HashMap<intptr_t, LineToBreakpointInfoMap*> BreakpointsMap;
-
- PageListenersMap m_pageListenersMap;
- ListenerSet m_listeners;
- bool m_callingListeners;
- PauseOnExceptionsState m_pauseOnExceptionsState;
- bool m_pauseOnNextStatement;
- bool m_paused;
- bool m_doneProcessingDebuggerEvents;
- JavaScriptCallFrame* m_pauseOnCallFrame;
- RefPtr<JavaScriptCallFrame> m_currentCallFrame;
- BreakpointsMap m_breakpoints;
- Timer<JavaScriptDebugServer> m_recompileTimer;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
-
-#endif // JavaScriptDebugServer_h
diff --git a/WebCore/inspector/ScriptBreakpoint.h b/WebCore/inspector/ScriptBreakpoint.h
new file mode 100644
index 0000000..8775901
--- /dev/null
+++ b/WebCore/inspector/ScriptBreakpoint.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptBreakpoint_h
+#define ScriptBreakpoint_h
+
+#include "PlatformString.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+struct ScriptBreakpoint {
+ ScriptBreakpoint(bool enabled, const String& condition)
+ : enabled(enabled)
+ , condition(condition)
+ {
+ }
+
+ ScriptBreakpoint()
+ {
+ }
+
+ bool enabled;
+ String condition;
+};
+
+typedef HashMap<int, ScriptBreakpoint> SourceBreakpoints;
+
+} // namespace WebCore
+
+#endif // !defined(ScriptBreakpoint_h)
diff --git a/WebCore/inspector/front-end/Breakpoint.js b/WebCore/inspector/front-end/Breakpoint.js
index 5d46cc9..7f3ef17 100644
--- a/WebCore/inspector/front-end/Breakpoint.js
+++ b/WebCore/inspector/front-end/Breakpoint.js
@@ -89,7 +89,7 @@ WebInspector.Breakpoint.prototype = {
this.dispatchEventToListeners("condition-changed");
if (this.enabled)
- InspectorBackend.updateBreakpoint(this.sourceID, this.line, c);
+ InspectorBackend.setBreakpoint(this.sourceID, this.line, this.enabled, this.condition);
}
}
diff --git a/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index 8865f0b..0bca05b 100644
--- a/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -40,6 +40,16 @@ WebInspector.BreakpointsSidebarPane = function()
}
WebInspector.BreakpointsSidebarPane.prototype = {
+ reset: function()
+ {
+ this.breakpoints = {};
+ this.listElement.removeChildren();
+ if (this.listElement.parentElement) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ },
+
addBreakpoint: function(breakpoint)
{
if (this.breakpoints[breakpoint.id])
@@ -62,7 +72,7 @@ WebInspector.BreakpointsSidebarPane.prototype = {
return;
if (breakpoint.enabled)
- InspectorBackend.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition);
+ InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
},
_appendBreakpointElement: function(breakpoint)
@@ -151,10 +161,7 @@ WebInspector.BreakpointsSidebarPane.prototype = {
if (!InspectorBackend.debuggerEnabled() || !breakpoint.sourceID)
return;
- if (breakpoint.enabled)
- InspectorBackend.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition);
- else
- InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);
+ InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
},
_breakpointTextChanged: function(event)
diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js
index ed03f73..410ad97 100644
--- a/WebCore/inspector/front-end/InspectorBackendStub.js
+++ b/WebCore/inspector/front-end/InspectorBackendStub.js
@@ -158,7 +158,7 @@ WebInspector.InspectorBackendStub.prototype = {
this._debuggerEnabled = false;
},
- addBreakpoint: function(sourceID, line, condition)
+ setBreakpoint: function(sourceID, line, enabled, condition)
{
},
@@ -166,10 +166,6 @@ WebInspector.InspectorBackendStub.prototype = {
{
},
- updateBreakpoint: function(sourceID, line, condition)
- {
- },
-
pauseInDebugger: function()
{
},
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index ed1ad6e..8b17533 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -157,8 +157,6 @@ WebInspector.ScriptsPanel = function()
this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false);
- this._breakpointsURLMap = {};
-
this._shortcuts = {};
var handler, shortcut;
var platformSpecificModifier = WebInspector.isMac() ? WebInspector.KeyboardShortcut.Modifiers.Meta : WebInspector.KeyboardShortcut.Modifiers.Ctrl;
@@ -194,7 +192,7 @@ WebInspector.ScriptsPanel = function()
this.reset();
}
-// Keep these in sync with WebCore::JavaScriptDebugServer
+// Keep these in sync with WebCore::ScriptDebugServer
WebInspector.ScriptsPanel.PauseOnExceptionsState = {
DontPauseOnExceptions : 0,
PauseOnAllExceptions : 1,
@@ -289,25 +287,6 @@ WebInspector.ScriptsPanel.prototype = {
if (sourceID)
this._sourceIDMap[sourceID] = (resource || script);
-
- if (sourceURL in this._breakpointsURLMap && sourceID) {
- var breakpoints = this._breakpointsURLMap[sourceURL];
- var breakpointsLength = breakpoints.length;
- for (var i = 0; i < breakpointsLength; ++i) {
- var breakpoint = breakpoints[i];
-
- if (startingLine <= breakpoint.line) {
- // remove and add the breakpoint, to clean up things like the sidebar
- this.removeBreakpoint(breakpoint);
- breakpoint.sourceID = sourceID;
- this.addBreakpoint(breakpoint);
-
- if (breakpoint.enabled)
- InspectorBackend.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition);
- }
- }
- }
-
this._addScriptToFilesMenu(script);
},
@@ -327,10 +306,6 @@ WebInspector.ScriptsPanel.prototype = {
var sourceFrame;
if (breakpoint.url) {
- if (!(breakpoint.url in this._breakpointsURLMap))
- this._breakpointsURLMap[breakpoint.url] = [];
- this._breakpointsURLMap[breakpoint.url].unshift(breakpoint);
-
if (breakpoint.url in WebInspector.resourceURLMap) {
var resource = WebInspector.resourceURLMap[breakpoint.url];
sourceFrame = this._sourceFrameForScriptOrResource(resource);
@@ -351,16 +326,9 @@ WebInspector.ScriptsPanel.prototype = {
this.sidebarPanes.breakpoints.removeBreakpoint(breakpoint);
var sourceFrame;
- if (breakpoint.url && breakpoint.url in this._breakpointsURLMap) {
- var breakpoints = this._breakpointsURLMap[breakpoint.url];
- breakpoints.remove(breakpoint);
- if (!breakpoints.length)
- delete this._breakpointsURLMap[breakpoint.url];
-
- if (breakpoint.url in WebInspector.resourceURLMap) {
- var resource = WebInspector.resourceURLMap[breakpoint.url];
- sourceFrame = this._sourceFrameForScriptOrResource(resource);
- }
+ if (breakpoint.url && breakpoint.url in WebInspector.resourceURLMap) {
+ var resource = WebInspector.resourceURLMap[breakpoint.url];
+ sourceFrame = this._sourceFrameForScriptOrResource(resource);
}
if (breakpoint.sourceID && !sourceFrame) {
@@ -487,6 +455,7 @@ WebInspector.ScriptsPanel.prototype = {
this._sourceIDMap = {};
this.sidebarPanes.watchExpressions.refreshExpressions();
+ this.sidebarPanes.breakpoints.reset();
},
get visibleView()
@@ -616,15 +585,13 @@ WebInspector.ScriptsPanel.prototype = {
if (!WebInspector.panels.resources)
return null;
view = WebInspector.panels.resources.resourceViewForResource(scriptOrResource);
- view.headersVisible = false;
-
- if (scriptOrResource.url in this._breakpointsURLMap) {
- var sourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource);
- if (sourceFrame && !sourceFrame.breakpoints.length) {
- var breakpoints = this._breakpointsURLMap[scriptOrResource.url];
- var breakpointsLength = breakpoints.length;
- for (var i = 0; i < breakpointsLength; ++i)
- sourceFrame.addBreakpoint(breakpoints[i]);
+ view.headersVisible = false;
+ var breakpoints = this.sidebarPanes.breakpoints.breakpoints;
+ for (var breakpointId in breakpoints) {
+ var breakpoint = breakpoints[breakpointId];
+ if (breakpoint.url === scriptOrResource.url) {
+ var sourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource);
+ sourceFrame.addBreakpoint(breakpoint);
}
}
} else if (scriptOrResource instanceof WebInspector.Script)
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 8bcdf63..8195833 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1212,6 +1212,13 @@ WebInspector.parsedScriptSource = function(sourceID, sourceURL, source, starting
this.panels.scripts.addScript(sourceID, sourceURL, source, startingLine);
}
+WebInspector.restoredBreakpoint = function(sourceID, sourceURL, line, enabled, condition)
+{
+ var breakpoint = new WebInspector.Breakpoint(sourceURL, line, sourceID, condition);
+ breakpoint.enabled = enabled;
+ this.panels.scripts.addBreakpoint(breakpoint);
+}
+
WebInspector.failedToParseScriptSource = function(sourceURL, source, startingLine, errorLine, errorMessage)
{
this.panels.scripts.addScript(null, sourceURL, source, startingLine, errorLine, errorMessage);
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 3ecbb5d..d2ad046 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -70,8 +70,8 @@
#include "StorageNamespace.h"
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
-#include "JavaScriptDebugServer.h"
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "ScriptDebugServer.h"
#endif
#if ENABLE(WML)
@@ -174,8 +174,8 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
}
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
- JavaScriptDebugServer::shared().pageCreated(this);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ ScriptDebugServer::shared().pageCreated(this);
#endif
#ifndef NDEBUG
diff --git a/WebCore/platform/android/TemporaryLinkStubs.cpp b/WebCore/platform/android/TemporaryLinkStubs.cpp
index 9698ead..7cf8324 100644
--- a/WebCore/platform/android/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/android/TemporaryLinkStubs.cpp
@@ -84,8 +84,8 @@
#include "API/JSClassRef.h"
#include "JNIUtilityPrivate.h"
#include "JavaScriptCallFrame.h"
-#include "JavaScriptDebugServer.h"
#include "JavaScriptProfile.h"
+#include "ScriptDebugServer.h"
#endif
using namespace WebCore;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index d8d89a2..b10af7b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-21 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Chromium DevTools: kepp debugger API in sync with inspector.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28799
+
+ * src/js/DebuggerAgent.js:
+ * src/js/InspectorControllerImpl.js:
+ (devtools.InspectorBackendImpl.prototype.setBreakpoint):
+
2010-02-19 Maciej Stachowiak <mjs at apple.com>
Reviewed by David Levin.
diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js
index bb655c7..e9ca035 100644
--- a/WebKit/chromium/src/js/DebuggerAgent.js
+++ b/WebKit/chromium/src/js/DebuggerAgent.js
@@ -309,6 +309,8 @@ devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line)
var breakpointInfo;
if (script.getUrl()) {
var breakpoints = this.urlToBreakpoints_[script.getUrl()];
+ if (!breakpoints)
+ return;
breakpointInfo = breakpoints[line];
delete breakpoints[line];
} else {
@@ -334,38 +336,6 @@ devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line)
/**
- * @param {number} sourceId Id of the script for the breakpoint.
- * @param {number} line Number of the line for the breakpoint.
- * @param {?string} condition New breakpoint condition.
- */
-devtools.DebuggerAgent.prototype.updateBreakpoint = function(sourceId, line, condition)
-{
- var script = this.parsedScripts_[sourceId];
- if (!script)
- return;
-
- line = devtools.DebuggerAgent.webkitToV8LineNumber_(line);
-
- var breakpointInfo;
- if (script.getUrl()) {
- var breakpoints = this.urlToBreakpoints_[script.getUrl()];
- breakpointInfo = breakpoints[line];
- } else
- breakpointInfo = script.getBreakpointInfo(line);
-
- var id = breakpointInfo.getV8Id();
-
- // If we don't know id of this breakpoint in the v8 debugger we cannot send
- // the "changebreakpoint" request.
- if (id !== -1) {
- // TODO(apavlov): make use of the real values for "enabled" and
- // "ignoreCount" when appropriate.
- this.requestChangeBreakpoint_(id, true, condition, null);
- }
-};
-
-
-/**
* Tells the v8 debugger to step into the next statement.
*/
devtools.DebuggerAgent.prototype.stepIntoStatement = function()
@@ -663,25 +633,6 @@ devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId
/**
- * Changes breakpoint parameters in the v8 debugger.
- * @param {number} breakpointId Id of the breakpoint in the v8 debugger.
- * @param {boolean} enabled Whether to enable the breakpoint.
- * @param {?string} condition New breakpoint condition.
- * @param {number} ignoreCount New ignore count for the breakpoint.
- */
-devtools.DebuggerAgent.prototype.requestChangeBreakpoint_ = function(breakpointId, enabled, condition, ignoreCount)
-{
- var cmd = new devtools.DebugCommand("changebreakpoint", {
- "breakpoint": breakpointId,
- "enabled": enabled,
- "condition": condition,
- "ignoreCount": ignoreCount
- });
- devtools.DebuggerAgent.sendCommand_(cmd);
-};
-
-
-/**
* Sends "backtrace" request to v8.
*/
devtools.DebuggerAgent.prototype.requestBacktrace_ = function()
diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js
index c92a94c..b51ced7 100644
--- a/WebKit/chromium/src/js/InspectorControllerImpl.js
+++ b/WebKit/chromium/src/js/InspectorControllerImpl.js
@@ -102,9 +102,11 @@ devtools.InspectorBackendImpl.prototype.profilerEnabled = function()
};
-devtools.InspectorBackendImpl.prototype.addBreakpoint = function(sourceID, line, condition)
+devtools.InspectorBackendImpl.prototype.setBreakpoint = function(sourceID, line, enabled, condition)
{
- devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition);
+ this.removeBreakpoint(sourceID, line);
+ if (enabled)
+ devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition);
};
@@ -113,10 +115,6 @@ devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, li
devtools.tools.getDebuggerAgent().removeBreakpoint(sourceID, line);
};
-devtools.InspectorBackendImpl.prototype.updateBreakpoint = function(sourceID, line, condition)
-{
- devtools.tools.getDebuggerAgent().updateBreakpoint(sourceID, line, condition);
-};
devtools.InspectorBackendImpl.prototype.pauseInDebugger = function()
{
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list