Web Inspector: Move InspectorDebuggerAgent into JavaScriptCore
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Jan 2014 08:39:12 +0000 (08:39 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Jan 2014 08:39:12 +0000 (08:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127629

Rubber-stamped by Sam Weinig.

Source/JavaScriptCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
- Add new files to the build.
- Also, since non REMOTE_INSPECTOR ports cannot yet connect to a
  JSGlobalObject for inspection remove those files as they don't
  need to be built.

* inspector/EventLoop.cpp: Added.
(Inspector::EventLoop::cycle):
* inspector/EventLoop.h: Added.
(Inspector::EventLoop::EventLoop):
(Inspector::EventLoop::ended):
Add a JavaScriptCore version of EventLoop. This is currently only
used by the Mac port for JSGlobalObject remote inspection. Keep
the WebCore/platform version alive because for the Mac port it does
slightly different things involving AppKit.

* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
Create DebuggerAgent and hook up ScriptDebugServer where needed.

* inspector/JSGlobalObjectScriptDebugServer.cpp: Added.
(Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer):
(Inspector::JSGlobalObjectScriptDebugServer::addListener):
(Inspector::JSGlobalObjectScriptDebugServer::removeListener):
(Inspector::JSGlobalObjectScriptDebugServer::recompileAllJSFunctions):
(Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused):
* inspector/JSGlobalObjectScriptDebugServer.h: Added.
Simple implementation of ScriptDebugServer with a JSGlobalObject.

* inspector/agents/InspectorDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDebuggerAgent.cpp.
* inspector/agents/InspectorDebuggerAgent.h: Renamed from Source/WebCore/inspector/InspectorDebuggerAgent.h.
Copied from WebCore. A few methods need to be made virtual so that Web implementations
can override and extend the funcitonality. E.g. sourceMapURLForScript and enable/disable.

* inspector/agents/JSGlobalObjectDebuggerAgent.cpp: Added.
* inspector/agents/JSGlobalObjectDebuggerAgent.h: Added.
(Inspector::JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent):
(Inspector::JSGlobalObjectDebuggerAgent::startListeningScriptDebugServer):
(Inspector::JSGlobalObjectDebuggerAgent::stopListeningScriptDebugServer):
(Inspector::JSGlobalObjectDebuggerAgent::injectedScriptForEval):
Simple implementation of DebuggerAGent with a JSGlobalObject.

Source/WebCore:

Test: inspector-protocol/debugger/pause-on-assert.html

* CMakeLists.txt:
* ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Added.
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorAllInOne.cpp:
- Remove InspectorDebuggerAgent.
- Add WebDebuggerAgent (shared between Page and Worker).

* inspector/WebDebuggerAgent.h: Added.
(WebCore::WebDebuggerAgent::~WebDebuggerAgent):
* inspector/WebDebuggerAgent.cpp: Added.
(WebCore::WebDebuggerAgent::WebDebuggerAgent):
(WebCore::WebDebuggerAgent::enable):
(WebCore::WebDebuggerAgent::disable):
Shared code for Page and Worker debugger agents.
Instrumenting agents is a concept in WebCore only,
and the Debugger agent is only in the instrumenting
agents list when it is enabled and removed when disabled.

* inspector/InstrumentingAgents.h:
(WebCore::InstrumentingAgents::inspectorDebuggerAgent):
(WebCore::InstrumentingAgents::setInspectorDebuggerAgent):
* inspector/InspectorDOMDebuggerAgent.cpp:
* inspector/InspectorDOMDebuggerAgent.h:
Update namespace for debugger agent.

* inspector/InspectorInstrumentation.cpp:
(WebCore::isConsoleAssertMessage):
(WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
DebuggerAgent in JavaScriptCore does not yet know about console
types. So temporarily handle it here. We need to give JavaScriptCore
some concept of Console messages and types.

* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::PageDebuggerAgent):
(WebCore::PageDebuggerAgent::enable):
(WebCore::PageDebuggerAgent::disable):
(WebCore::PageDebuggerAgent::sourceMapURLForScript):
(WebCore::PageDebuggerAgent::injectedScriptForEval):
* inspector/PageDebuggerAgent.h:
* inspector/WorkerDebuggerAgent.cpp:
(WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
(WebCore::WorkerDebuggerAgent::injectedScriptForEval):
* inspector/WorkerDebuggerAgent.h:
Modernize the Page and Worker debugger agents.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorController.h:
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
New constructors for the debugger agents.

LayoutTests:

Add a test that we pause in the debugger for console.assert failures
when the DebuggerAgent is enabled.

* inspector-protocol/debugger/pause-on-assert-expected.txt: Added.
* inspector-protocol/debugger/pause-on-assert.html: Added.
* inspector-protocol/debugger/resources/assert.js: Added.
(assertTrue):
(assertFalse):
(assertCondition):
(assertConditionWithMessage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162799 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector-protocol/debugger/pause-on-assert-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/pause-on-assert.html [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/resources/assert.js [new file with mode: 0644]
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.list.am
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/inspector/EventLoop.cpp [new file with mode: 0644]
Source/JavaScriptCore/inspector/EventLoop.h [new file with mode: 0644]
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp [new file with mode: 0644]
Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h [new file with mode: 0644]
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp [moved from Source/WebCore/inspector/InspectorDebuggerAgent.cpp with 80% similarity]
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h [moved from Source/WebCore/inspector/InspectorDebuggerAgent.h with 67% similarity]
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp [new file with mode: 0644]
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h [new file with mode: 0644]
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/InspectorAllInOne.cpp
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDOMDebuggerAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InstrumentingAgents.h
Source/WebCore/inspector/PageDebuggerAgent.cpp
Source/WebCore/inspector/PageDebuggerAgent.h
Source/WebCore/inspector/WebDebuggerAgent.cpp [new file with mode: 0644]
Source/WebCore/inspector/WebDebuggerAgent.h [new file with mode: 0644]
Source/WebCore/inspector/WorkerDebuggerAgent.cpp
Source/WebCore/inspector/WorkerDebuggerAgent.h
Source/WebCore/inspector/WorkerInspectorController.cpp

index bc339f1..6f4ba50 100644 (file)
@@ -1,3 +1,21 @@
+2014-01-26  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Move InspectorDebuggerAgent into JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=127629
+
+        Rubber-stamped by Sam Weinig.
+
+        Add a test that we pause in the debugger for console.assert failures
+        when the DebuggerAgent is enabled.
+
+        * inspector-protocol/debugger/pause-on-assert-expected.txt: Added.
+        * inspector-protocol/debugger/pause-on-assert.html: Added.
+        * inspector-protocol/debugger/resources/assert.js: Added.
+        (assertTrue):
+        (assertFalse):
+        (assertCondition):
+        (assertConditionWithMessage):
+
 2014-01-25  Timothy Hatcher  <timothy@apple.com>
 
         Remove dead code from the JSC profiler.
diff --git a/LayoutTests/inspector-protocol/debugger/pause-on-assert-expected.txt b/LayoutTests/inspector-protocol/debugger/pause-on-assert-expected.txt
new file mode 100644 (file)
index 0000000..89a9bf9
--- /dev/null
@@ -0,0 +1,20 @@
+CONSOLE MESSAGE: line 10: Should always fail.
+CONSOLE MESSAGE: line 22: ASSERT message
+Test that a failing console.assert will pause in the debugger with an optional message.
+
+Should not pause on passing assert.
+inside assertOkay
+Should pause on failing assert.
+inside assertFalse
+PASS: Paused!
+Should not pause on passing assert.
+inside assertCondition, and condition is true
+Should pause on failing assert.
+inside assertCondition, and condition is false
+PASS: Paused!
+Should not pause on passing assert.
+inside assertConditionWithMessage, and condition is true
+Should pause on failing assert and include a message.
+inside assertConditionWithMessage, and condition is false
+PASS: Paused!
+
diff --git a/LayoutTests/inspector-protocol/debugger/pause-on-assert.html b/LayoutTests/inspector-protocol/debugger/pause-on-assert.html
new file mode 100644 (file)
index 0000000..36c4ae8
--- /dev/null
@@ -0,0 +1,80 @@
+<html>
+<head>
+<script src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script src="resources/assert.js"></script>
+<script>
+function test()
+{
+    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
+
+    var step = null;
+    var steps = [
+        {
+            message: "Should not pause on passing assert.",
+            evaluate: "assertTrue()",
+            pause: false,
+        },
+        {
+            message: "Should pause on failing assert.",
+            evaluate: "assertFalse()",
+            pause: true,
+        },
+        {
+            message: "Should not pause on passing assert.",
+            evaluate: "assertCondition(window)",
+            pause: false,
+        },
+        {
+            message: "Should pause on failing assert.",
+            evaluate: "assertCondition(window === null)",
+            pause: true,
+        },
+        {
+            message: "Should not pause on passing assert.",
+            evaluate: "assertConditionWithMessage(window, 'Should not happen')",
+            pause: false,
+        },
+        {
+            message: "Should pause on failing assert and include a message.",
+            evaluate: "assertConditionWithMessage(window === null, 'ASSERT message')",
+            pause: true,
+        },
+    ];
+
+    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    {
+        if (step.pause)
+            InspectorTest.log("PASS: Paused!");
+        else
+            InspectorTest.log("FAIL: Paused when unexpected");
+
+        InspectorTest.sendCommand("Debugger.resume", {}, runNextStep);
+    }
+
+    function runNextStep() {
+        step = steps.shift();
+        if (!step) {
+            InspectorTest.completeTest();
+            return;
+        }
+
+        // Evalute the command inside a setTimeout so that we can hit exceptions and break.
+        // Otherwise, evaluating through RuntimeAgent will not trigger a pause.
+        // Likewise, if no pause is expected wait for a bit before continuing.
+        InspectorTest.log(step.message);
+        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function(){" + step.evaluate + "}, 0)"}, function(responseObject) {
+            InspectorTest.checkForError(responseObject);
+            if (!step.pause)
+                setTimeout(runNextStep, 20);
+        });
+    }
+
+    runNextStep();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test that a failing console.assert will pause in the debugger with an optional message.</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector-protocol/debugger/resources/assert.js b/LayoutTests/inspector-protocol/debugger/resources/assert.js
new file mode 100644 (file)
index 0000000..20734e6
--- /dev/null
@@ -0,0 +1,23 @@
+function assertTrue()
+{
+    log("inside assertOkay");
+    console.assert(true, "Should never happen.");
+}
+
+function assertFalse()
+{
+    log("inside assertFalse");
+    console.assert(false, "Should always fail.");
+}
+
+function assertCondition(condition)
+{
+    log("inside assertCondition, and condition is " + !!condition);
+    console.assert(condition);
+}
+
+function assertConditionWithMessage(condition, message)
+{
+    log("inside assertConditionWithMessage, and condition is " + !!condition);
+    console.assert(condition, message);
+}
index 1b4367a..d7e9e63 100644 (file)
@@ -242,8 +242,8 @@ set(JavaScriptCore_SOURCES
     inspector/JavaScriptCallFrame.cpp
     inspector/ScriptDebugServer.cpp
     inspector/agents/InspectorAgent.cpp
+    inspector/agents/InspectorDebuggerAgent.cpp
     inspector/agents/InspectorRuntimeAgent.cpp
-    inspector/agents/JSGlobalObjectRuntimeAgent.cpp
 
     interpreter/AbstractPC.cpp
     interpreter/CallFrame.cpp
index 8ba331b..8535fc6 100644 (file)
@@ -1,3 +1,56 @@
+2014-01-26  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Move InspectorDebuggerAgent into JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=127629
+
+        Rubber-stamped by Sam Weinig.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        - Add new files to the build.
+        - Also, since non REMOTE_INSPECTOR ports cannot yet connect to a
+          JSGlobalObject for inspection remove those files as they don't
+          need to be built.
+
+        * inspector/EventLoop.cpp: Added.
+        (Inspector::EventLoop::cycle):
+        * inspector/EventLoop.h: Added.
+        (Inspector::EventLoop::EventLoop):
+        (Inspector::EventLoop::ended):
+        Add a JavaScriptCore version of EventLoop. This is currently only
+        used by the Mac port for JSGlobalObject remote inspection. Keep
+        the WebCore/platform version alive because for the Mac port it does
+        slightly different things involving AppKit.
+
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        Create DebuggerAgent and hook up ScriptDebugServer where needed.
+
+        * inspector/JSGlobalObjectScriptDebugServer.cpp: Added.
+        (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer):
+        (Inspector::JSGlobalObjectScriptDebugServer::addListener):
+        (Inspector::JSGlobalObjectScriptDebugServer::removeListener):
+        (Inspector::JSGlobalObjectScriptDebugServer::recompileAllJSFunctions):
+        (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused):
+        * inspector/JSGlobalObjectScriptDebugServer.h: Added.
+        Simple implementation of ScriptDebugServer with a JSGlobalObject.
+
+        * inspector/agents/InspectorDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDebuggerAgent.cpp.
+        * inspector/agents/InspectorDebuggerAgent.h: Renamed from Source/WebCore/inspector/InspectorDebuggerAgent.h.
+        Copied from WebCore. A few methods need to be made virtual so that Web implementations
+        can override and extend the funcitonality. E.g. sourceMapURLForScript and enable/disable.
+        
+        * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: Added.
+        * inspector/agents/JSGlobalObjectDebuggerAgent.h: Added.
+        (Inspector::JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent):
+        (Inspector::JSGlobalObjectDebuggerAgent::startListeningScriptDebugServer):
+        (Inspector::JSGlobalObjectDebuggerAgent::stopListeningScriptDebugServer):
+        (Inspector::JSGlobalObjectDebuggerAgent::injectedScriptForEval):
+        Simple implementation of DebuggerAGent with a JSGlobalObject.
+
 2014-01-25  Mark Lam  <mark.lam@apple.com>
 
         Gardening: fix build breakage from previous commit.
index 4d1635e..d0fdd3a 100644 (file)
@@ -665,10 +665,10 @@ javascriptcore_sources += \
        Source/JavaScriptCore/inspector/ScriptDebugServer.h \
        Source/JavaScriptCore/inspector/agents/InspectorAgent.h \
        Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp \
+       Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h \
+       Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp \
        Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h \
        Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp \
-       Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h \
-       Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp \
        Source/JavaScriptCore/interpreter/AbstractPC.cpp \
        Source/JavaScriptCore/interpreter/AbstractPC.h \
        Source/JavaScriptCore/interpreter/CachedCall.h \
index 72dca32..82c1a6d 100644 (file)
     <ClCompile Include="..\inspector\JavaScriptCallFrame.cpp" />
     <ClCompile Include="..\inspector\ScriptDebugServer.cpp" />
     <ClCompile Include="..\inspector\agents\InspectorAgent.cpp" />
+    <ClCompile Include="..\inspector\agents\InspectorDebuggerAgent.cpp" />
     <ClCompile Include="..\inspector\agents\InspectorRuntimeAgent.cpp" />
-    <ClCompile Include="..\inspector\agents\JSGlobalObjectRuntimeAgent.cpp" />
     <ClCompile Include="..\interpreter\AbstractPC.cpp" />
     <ClCompile Include="..\interpreter\CallFrame.cpp" />
     <ClCompile Include="..\interpreter\Interpreter.cpp" />
     <ClInclude Include="..\inspector\ScriptDebugListener.h" />
     <ClInclude Include="..\inspector\ScriptDebugServer.h" />
     <ClInclude Include="..\inspector\agents\InspectorAgent.h" />
+    <ClInclude Include="..\inspector\agents\InspectorDebuggerAgent.h" />
     <ClInclude Include="..\inspector\agents\InspectorRuntimeAgent.h" />
-    <ClInclude Include="..\inspector\agents\JSGlobalObjectRuntimeAgent.h" />
     <ClInclude Include="..\interpreter\AbstractPC.h" />
     <ClInclude Include="..\interpreter\CachedCall.h" />
     <ClInclude Include="..\interpreter\CallFrame.h" />
index 6c6c08e..8ec577a 100644 (file)
     <ClCompile Include="..\inspector\agents\InspectorAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
-    <ClCompile Include="..\inspector\agents\InspectorRuntimeAgent.cpp">
+    <ClCompile Include="..\inspector\agents\InspectorDebuggerAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
-    <ClCompile Include="..\inspector\agents\JSGlobalObjectRuntimeAgent.cpp">
+    <ClCompile Include="..\inspector\agents\InspectorRuntimeAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
     <ClCompile Include="..\interpreter\AbstractPC.cpp">
     <ClInclude Include="..\inspector\agents\InspectorAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
-    <ClInclude Include="..\inspector\agents\InspectorRuntimeAgent.h">
+    <ClInclude Include="..\inspector\agents\InspectorDebuggerAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
-    <ClInclude Include="..\inspector\agents\JSGlobalObjectRuntimeAgent.h">
+    <ClInclude Include="..\inspector\agents\InspectorRuntimeAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
     <ClInclude Include="..\interpreter\AbstractPC.h">
index f587370..ad4b845 100644 (file)
                A503FA22188EFF6800110F14 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = A503FA20188EFF6800110F14 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A503FA25188EFFFD00110F14 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A503FA23188EFFFD00110F14 /* ScriptDebugServer.cpp */; };
                A503FA26188EFFFD00110F14 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A503FA24188EFFFD00110F14 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A503FA29188F105900110F14 /* JSGlobalObjectScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A503FA27188F105900110F14 /* JSGlobalObjectScriptDebugServer.cpp */; };
+               A503FA2A188F105900110F14 /* JSGlobalObjectScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A503FA28188F105900110F14 /* JSGlobalObjectScriptDebugServer.h */; };
                A50E4B6118809DD50068A46D /* InspectorRuntimeAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A50E4B5D18809DD50068A46D /* InspectorRuntimeAgent.cpp */; };
                A50E4B6218809DD50068A46D /* InspectorRuntimeAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A50E4B5E18809DD50068A46D /* InspectorRuntimeAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A50E4B6318809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A50E4B5F18809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp */; };
                A532439318569709002ED692 /* CodeGeneratorInspectorStrings.py in Headers */ = {isa = PBXBuildFile; fileRef = A5324390185696E6002ED692 /* CodeGeneratorInspectorStrings.py */; settings = {ATTRIBUTES = (Private, ); }; };
                A532439418569709002ED692 /* generate-combined-inspector-json.py in Headers */ = {isa = PBXBuildFile; fileRef = A5324391185696E6002ED692 /* generate-combined-inspector-json.py */; settings = {ATTRIBUTES = (Private, ); }; };
                A53243981856A489002ED692 /* InspectorJS.json in Headers */ = {isa = PBXBuildFile; fileRef = A53243951856A475002ED692 /* InspectorJS.json */; settings = {ATTRIBUTES = (Private, ); }; };
+               A54982031891D0B00081E5B8 /* EventLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54982011891D0B00081E5B8 /* EventLoop.cpp */; };
+               A54982041891D0B00081E5B8 /* EventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = A54982021891D0B00081E5B8 /* EventLoop.h */; };
                A54CF2F5184EAB2400237F19 /* ScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54CF2F2184EAB2400237F19 /* ScriptValue.cpp */; };
                A54CF2F6184EAB2400237F19 /* ScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A54CF2F3184EAB2400237F19 /* ScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A54CF2F9184EAEDA00237F19 /* ScriptObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54CF2F7184EAEDA00237F19 /* ScriptObject.cpp */; };
                A55D93A5185012A800400DED /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A55D93A3185012A800400DED /* ScriptFunctionCall.cpp */; };
                A55D93A6185012A800400DED /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = A55D93A4185012A800400DED /* ScriptFunctionCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A55D93AC18514F7900400DED /* InspectorTypeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A55D93AB18514F7900400DED /* InspectorTypeBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A57D23E51890CEBF0031C7FA /* InspectorDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D23E31890CEBF0031C7FA /* InspectorDebuggerAgent.cpp */; };
+               A57D23E61890CEBF0031C7FA /* InspectorDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A57D23E41890CEBF0031C7FA /* InspectorDebuggerAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A57D23E91891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D23E71891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp */; };
+               A57D23EA1891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A57D23E81891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h */; };
                A57D23ED1891B5540031C7FA /* RegularExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D23EB1891B5540031C7FA /* RegularExpression.cpp */; };
                A57D23EE1891B5540031C7FA /* RegularExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = A57D23EC1891B5540031C7FA /* RegularExpression.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A57D23F11891B5B40031C7FA /* ContentSearchUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D23EF1891B5B40031C7FA /* ContentSearchUtilities.cpp */; };
                A503FA20188EFF6800110F14 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; };
                A503FA23188EFFFD00110F14 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; };
                A503FA24188EFFFD00110F14 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; };
+               A503FA27188F105900110F14 /* JSGlobalObjectScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectScriptDebugServer.cpp; sourceTree = "<group>"; };
+               A503FA28188F105900110F14 /* JSGlobalObjectScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectScriptDebugServer.h; sourceTree = "<group>"; };
                A50E4B5D18809DD50068A46D /* InspectorRuntimeAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorRuntimeAgent.cpp; sourceTree = "<group>"; };
                A50E4B5E18809DD50068A46D /* InspectorRuntimeAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorRuntimeAgent.h; sourceTree = "<group>"; };
                A50E4B5F18809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectRuntimeAgent.cpp; sourceTree = "<group>"; };
                A5324391185696E6002ED692 /* generate-combined-inspector-json.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-combined-inspector-json.py"; sourceTree = "<group>"; };
                A53243951856A475002ED692 /* InspectorJS.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = InspectorJS.json; sourceTree = "<group>"; };
                A53243961856A475002ED692 /* InspectorJSBackendCommands.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InspectorJSBackendCommands.js; sourceTree = "<group>"; };
+               A54982011891D0B00081E5B8 /* EventLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventLoop.cpp; sourceTree = "<group>"; };
+               A54982021891D0B00081E5B8 /* EventLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventLoop.h; sourceTree = "<group>"; };
                A54CF2F2184EAB2400237F19 /* ScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptValue.cpp; sourceTree = "<group>"; };
                A54CF2F3184EAB2400237F19 /* ScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptValue.h; sourceTree = "<group>"; };
                A54CF2F7184EAEDA00237F19 /* ScriptObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptObject.cpp; sourceTree = "<group>"; };
                A55D93A3185012A800400DED /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; };
                A55D93A4185012A800400DED /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; };
                A55D93AB18514F7900400DED /* InspectorTypeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTypeBuilder.h; sourceTree = "<group>"; };
+               A57D23E31890CEBF0031C7FA /* InspectorDebuggerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDebuggerAgent.cpp; sourceTree = "<group>"; };
+               A57D23E41890CEBF0031C7FA /* InspectorDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDebuggerAgent.h; sourceTree = "<group>"; };
+               A57D23E71891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectDebuggerAgent.cpp; sourceTree = "<group>"; };
+               A57D23E81891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectDebuggerAgent.h; sourceTree = "<group>"; };
                A57D23EB1891B5540031C7FA /* RegularExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegularExpression.cpp; path = yarr/RegularExpression.cpp; sourceTree = "<group>"; };
                A57D23EC1891B5540031C7FA /* RegularExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegularExpression.h; path = yarr/RegularExpression.h; sourceTree = "<group>"; };
                A57D23EF1891B5B40031C7FA /* ContentSearchUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSearchUtilities.cpp; sourceTree = "<group>"; };
                        children = (
                                A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */,
                                A5CEEE13187F3BAD00E55C99 /* InspectorAgent.h */,
+                               A57D23E31890CEBF0031C7FA /* InspectorDebuggerAgent.cpp */,
+                               A57D23E41890CEBF0031C7FA /* InspectorDebuggerAgent.h */,
                                A50E4B5D18809DD50068A46D /* InspectorRuntimeAgent.cpp */,
                                A50E4B5E18809DD50068A46D /* InspectorRuntimeAgent.h */,
+                               A57D23E71891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp */,
+                               A57D23E81891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h */,
                                A50E4B5F18809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp */,
                                A50E4B6018809DD50068A46D /* JSGlobalObjectRuntimeAgent.h */,
                        );
                                A532438E185696CE002ED692 /* scripts */,
                                A57D23EF1891B5B40031C7FA /* ContentSearchUtilities.cpp */,
                                A57D23F01891B5B40031C7FA /* ContentSearchUtilities.h */,
+                               A54982011891D0B00081E5B8 /* EventLoop.cpp */,
+                               A54982021891D0B00081E5B8 /* EventLoop.h */,
                                A513E5B5185B8BD3007E95AD /* InjectedScript.cpp */,
                                A513E5B6185B8BD3007E95AD /* InjectedScript.h */,
                                A514B2C0185A684400F3C7CB /* InjectedScriptBase.cpp */,
                                A593CF811840377100BFCE27 /* InspectorValues.h */,
                                A51007BE187CC3C600B38879 /* JSGlobalObjectInspectorController.cpp */,
                                A51007BF187CC3C600B38879 /* JSGlobalObjectInspectorController.h */,
+                               A503FA27188F105900110F14 /* JSGlobalObjectScriptDebugServer.cpp */,
+                               A503FA28188F105900110F14 /* JSGlobalObjectScriptDebugServer.h */,
                                A513E5BA185BFACC007E95AD /* JSInjectedScriptHost.cpp */,
                                A513E5BB185BFACC007E95AD /* JSInjectedScriptHost.h */,
                                A513E5BC185BFACC007E95AD /* JSInjectedScriptHostPrototype.cpp */,
                                BC1166020E1997B4008066DD /* DateInstance.h in Headers */,
                                14A1563210966365006FA260 /* DateInstanceCache.h in Headers */,
                                BCD2034C0E17135E002C7E82 /* DatePrototype.h in Headers */,
+                               A503FA2A188F105900110F14 /* JSGlobalObjectScriptDebugServer.h in Headers */,
                                BCD203E80E1718F4002C7E82 /* DatePrototype.lut.h in Headers */,
                                BC18C3FA0E16F5CD00B34460 /* Debugger.h in Headers */,
                                BC3135640F302FA3003DFD3A /* DebuggerActivation.h in Headers */,
                                A7D89CFA17A0B8CC00773AD8 /* DFGFlushLivenessAnalysisPhase.h in Headers */,
                                86EC9DC61328DF82002B2AD7 /* DFGGenerationInfo.h in Headers */,
                                86EC9DC81328DF82002B2AD7 /* DFGGraph.h in Headers */,
+                               A57D23E61890CEBF0031C7FA /* InspectorDebuggerAgent.h in Headers */,
                                0FB14E211812570B009B6B4D /* DFGInlineCacheWrapper.h in Headers */,
                                0FB14E2318130955009B6B4D /* DFGInlineCacheWrapperInlines.h in Headers */,
                                A704D90617A0BAA8006BA554 /* DFGInPlaceAbstractState.h in Headers */,
                                0FBE0F7716C1DB120082C5E8 /* DFGUnificationPhase.h in Headers */,
                                0F34B14A16D42013001CDA5A /* DFGUseKind.h in Headers */,
                                0F3B3A2C15475002003ED0FF /* DFGValidate.h in Headers */,
+                               A57D23EA1891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h in Headers */,
                                0F2BDC471522802500CD8910 /* DFGValueRecoveryOverride.h in Headers */,
                                0F2BDC481522802900CD8910 /* DFGValueSource.h in Headers */,
                                0F620174143FCD330068B77C /* DFGVariableAccessData.h in Headers */,
                                860BD801148EA6F200112B2F /* Intrinsic.h in Headers */,
                                BC18C4130E16F5CD00B34460 /* JavaScript.h in Headers */,
                                BC18C4140E16F5CD00B34460 /* JavaScriptCore.h in Headers */,
+                               A54982041891D0B00081E5B8 /* EventLoop.h in Headers */,
                                BC18C4150E16F5CD00B34460 /* JavaScriptCorePrefix.h in Headers */,
                                1429D9300ED22D7000B89619 /* JIT.h in Headers */,
                                86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */,
                                0F34B14916D42010001CDA5A /* DFGUseKind.cpp in Sources */,
                                0F3B3A2B15475000003ED0FF /* DFGValidate.cpp in Sources */,
                                A55D93A5185012A800400DED /* ScriptFunctionCall.cpp in Sources */,
+                               A503FA29188F105900110F14 /* JSGlobalObjectScriptDebugServer.cpp in Sources */,
                                0F2BDC4F15228BF300CD8910 /* DFGValueSource.cpp in Sources */,
                                0FDDBFB51666EED800C55FEF /* DFGVariableAccessDataDump.cpp in Sources */,
                                0F2BDC5115228FFD00CD8910 /* DFGVariableEvent.cpp in Sources */,
                                0F235BD817178E1C00690C7F /* FTLExitThunkGenerator.cpp in Sources */,
                                0F235BDA17178E1C00690C7F /* FTLExitValue.cpp in Sources */,
                                A7F2996B17A0BB670010417A /* FTLFail.cpp in Sources */,
+                               A57D23E51890CEBF0031C7FA /* InspectorDebuggerAgent.cpp in Sources */,
                                0FD8A31917D51F2200CA2C40 /* FTLForOSREntryJITCode.cpp in Sources */,
                                0F25F1AF181635F300522F39 /* FTLInlineCacheSize.cpp in Sources */,
                                0FEA0A281709623B00BB722C /* FTLIntrinsicRepository.cpp in Sources */,
                                0FB14E1E18124ACE009B6B4D /* JITInlineCacheGenerator.cpp in Sources */,
                                BCDD51EB0FB8DF74004A8BDC /* JITOpcodes.cpp in Sources */,
                                A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */,
+                               A54982031891D0B00081E5B8 /* EventLoop.cpp in Sources */,
                                2A4EC90B1860D6C20094F782 /* WriteBarrierBuffer.cpp in Sources */,
                                0F24E54C17EE274900ABB217 /* JITOperations.cpp in Sources */,
                                86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */,
                                A503FA1B188E0FB000110F14 /* JSJavaScriptCallFrame.cpp in Sources */,
                                86E3C618167BABEE006D760A /* JSWrapperMap.mm in Sources */,
                                14280870107EC1340013E7B2 /* JSWrapperObject.cpp in Sources */,
+                               A57D23E91891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp in Sources */,
                                BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */,
                                0FB5467914F5C46B002C2989 /* LazyOperandValueProfile.cpp in Sources */,
                                95AB83420DA4322500BC83F3 /* LegacyProfiler.cpp in Sources */,
diff --git a/Source/JavaScriptCore/inspector/EventLoop.cpp b/Source/JavaScriptCore/inspector/EventLoop.cpp
new file mode 100644 (file)
index 0000000..9d76b1e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "config.h"
+#include "EventLoop.h"
+
+#if OS(WINDOWS)
+#include <windows.h>
+#elif USE(CF)
+#include <CoreFoundation/CFRunLoop.h>
+#elif PLATFORM(EFL)
+#include <Ecore.h>
+#elif PLATFORM(GTK)
+#include <glib.h>
+#endif
+
+namespace Inspector {
+
+void EventLoop::cycle()
+{
+#if OS(WINDOWS)
+    MSG msg;
+    if (!GetMessage(&msg, 0, 0, 0)) {
+        m_ended = true;
+        return;
+    }
+    TranslateMessage(&msg);
+    DispatchMessage(&msg);
+#elif USE(CF)
+    CFTimeInterval timeInterval = 0.05;
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeInterval, true);
+#elif PLATFORM(EFL)
+    ecore_main_loop_iterate();
+#elif PLATFORM(GTK)
+    g_main_context_iteration(NULL, FALSE);
+#endif
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/EventLoop.h b/Source/JavaScriptCore/inspector/EventLoop.h
new file mode 100644 (file)
index 0000000..a03272c
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#ifndef EventLoop_h
+#define EventLoop_h
+
+#include <wtf/Noncopyable.h>
+
+namespace Inspector {
+
+class EventLoop {
+    WTF_MAKE_NONCOPYABLE(EventLoop);
+public:
+    EventLoop()
+        : m_ended(false)
+    {
+    }
+
+    void cycle();
+    bool ended() const { return m_ended; }
+
+private:
+    bool m_ended;
+};
+
+} // namespace Inspector
+
+#endif // EventLoop_h
index af5eebf..424a87f 100644 (file)
@@ -35,6 +35,7 @@
 #include "InspectorBackendDispatcher.h"
 #include "InspectorFrontendChannel.h"
 #include "JSGlobalObject.h"
+#include "JSGlobalObjectDebuggerAgent.h"
 #include "JSGlobalObjectRuntimeAgent.h"
 
 using namespace JSC;
@@ -47,7 +48,16 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
     , m_inspectorFrontendChannel(nullptr)
 {
     m_agents.append(std::make_unique<InspectorAgent>());
-    m_agents.append(std::make_unique<JSGlobalObjectRuntimeAgent>(m_injectedScriptManager.get(), m_globalObject));
+
+    auto runtimeAgentPtr = std::make_unique<JSGlobalObjectRuntimeAgent>(m_injectedScriptManager.get(), m_globalObject);
+    InspectorRuntimeAgent* runtimeAgent = runtimeAgentPtr.get();
+    m_agents.append(std::move(runtimeAgentPtr));
+
+    auto debuggerAgentPtr = std::make_unique<JSGlobalObjectDebuggerAgent>(m_injectedScriptManager.get(), m_globalObject);
+    InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get();
+    m_agents.append(std::move(debuggerAgentPtr));
+
+    runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
 }
 
 JSGlobalObjectInspectorController::~JSGlobalObjectInspectorController()
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp
new file mode 100644 (file)
index 0000000..254a2c7
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2014 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectScriptDebugServer.h"
+
+#if ENABLE(INSPECTOR)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "EventLoop.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer(JSGlobalObject& globalObject)
+    : ScriptDebugServer(false)
+    , m_globalObject(globalObject)
+{
+}
+
+void JSGlobalObjectScriptDebugServer::addListener(ScriptDebugListener* listener)
+{
+    if (!listener)
+        return;
+
+    bool wasEmpty = m_listeners.isEmpty();
+    m_listeners.add(listener);
+
+    // First listener. Attach the debugger to the JSGlobalObject.
+    if (wasEmpty) {
+        attach(&m_globalObject);
+        recompileAllJSFunctions();
+    }
+}
+
+void JSGlobalObjectScriptDebugServer::removeListener(ScriptDebugListener* listener, bool isBeingDestroyed)
+{
+    if (!listener)
+        return;
+
+    m_listeners.remove(listener);
+
+    // Last listener. Detach the debugger from the JSGlobalObject.
+    if (m_listeners.isEmpty()) {
+        detach(&m_globalObject, isBeingDestroyed ? Debugger::GlobalObjectIsDestructing : Debugger::TerminatingDebuggingSession);
+        if (!isBeingDestroyed)
+            recompileAllJSFunctions();
+    }
+}
+
+void JSGlobalObjectScriptDebugServer::recompileAllJSFunctions()
+{
+    JSC::Debugger::recompileAllJSFunctions(&m_globalObject.vm());
+}
+
+void JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused()
+{
+    EventLoop loop;
+    while (!m_doneProcessingDebuggerEvents && !loop.ended())
+        loop.cycle();
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h
new file mode 100644 (file)
index 0000000..2f51aa0
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#ifndef JSGlobalObjectScriptDebugServer_h
+#define JSGlobalObjectScriptDebugServer_h
+
+#if ENABLE(INSPECTOR)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "ScriptDebugServer.h"
+#include <wtf/Forward.h>
+
+namespace Inspector {
+
+class JSGlobalObjectScriptDebugServer final : public ScriptDebugServer {
+    WTF_MAKE_NONCOPYABLE(JSGlobalObjectScriptDebugServer);
+public:
+    JSGlobalObjectScriptDebugServer(JSC::JSGlobalObject&);
+    virtual ~JSGlobalObjectScriptDebugServer() { }
+
+    void addListener(ScriptDebugListener*);
+    void removeListener(ScriptDebugListener*, bool isBeingDestroyed);
+
+    JSC::JSGlobalObject& globalObject() const { return m_globalObject; }
+
+    virtual void recompileAllJSFunctions() override;
+
+private:
+    virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) override { return &m_listeners; }
+    virtual void didPause(JSC::JSGlobalObject*) override { }
+    virtual void didContinue(JSC::JSGlobalObject*) override { }
+    virtual void runEventLoopWhilePaused() override;
+    virtual bool isContentScript(JSC::ExecState*) const override { return false; }
+
+    // FIXME: JavaScript inspection has no Console yet.
+    virtual void reportException(JSC::ExecState*, JSC::JSValue) const override { }
+
+    ListenerSet m_listeners;
+    JSC::JSGlobalObject& m_globalObject;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+#endif // ENABLE(INSPECTOR)
+
+#endif // JSGlobalObjectScriptDebugServer_h
 #include "config.h"
 #include "InspectorDebuggerAgent.h"
 
-#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
-
-#include "CachedResource.h"
-#include "InspectorPageAgent.h"
-#include "InstrumentingAgents.h"
-#include "ScriptArguments.h"
-#include "Sound.h"
-#include <bindings/ScriptObject.h>
-#include <bindings/ScriptValue.h>
-#include <inspector/ContentSearchUtilities.h>
-#include <inspector/InjectedScript.h>
-#include <inspector/InjectedScriptManager.h>
-#include <inspector/InspectorValues.h>
-#include <inspector/ScriptDebugServer.h>
+#if ENABLE(INSPECTOR)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "ContentSearchUtilities.h"
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "InspectorValues.h"
+#include "RegularExpression.h"
+#include "ScriptDebugServer.h"
+#include "ScriptObject.h"
+#include "ScriptValue.h"
 #include <wtf/text/WTFString.h>
-#include <yarr/RegularExpression.h>
 
-using Inspector::TypeBuilder::Array;
-using Inspector::TypeBuilder::Debugger::FunctionDetails;
-using Inspector::TypeBuilder::Debugger::ScriptId;
-using Inspector::TypeBuilder::Runtime::RemoteObject;
-
-using namespace Inspector;
-
-namespace WebCore {
+namespace Inspector {
 
 const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace";
 
@@ -64,14 +53,14 @@ static String objectGroupForBreakpointAction(int identifier)
     return makeString(objectGroup, String::number(identifier));
 }
 
-InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InjectedScriptManager* injectedScriptManager)
-    : InspectorAgentBase(ASCIILiteral("Debugger"), instrumentingAgents)
+InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedScriptManager)
+    : InspectorAgentBase(ASCIILiteral("Debugger"))
     , m_injectedScriptManager(injectedScriptManager)
+    , m_listener(nullptr)
     , m_pausedScriptState(nullptr)
     , m_continueToLocationBreakpointID(JSC::noBreakpointID)
     , m_enabled(false)
     , m_javaScriptPauseScheduled(false)
-    , m_listener(nullptr)
     , m_nextProbeSampleId(1)
     , m_nextBreakpointActionIdentifier(1)
 {
@@ -81,12 +70,27 @@ InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentin
 
 InspectorDebuggerAgent::~InspectorDebuggerAgent()
 {
-    ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent());
+}
+
+void InspectorDebuggerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
+{
+    m_frontendDispatcher = std::make_unique<InspectorDebuggerFrontendDispatcher>(frontendChannel);
+    m_backendDispatcher = InspectorDebuggerBackendDispatcher::create(backendDispatcher, this);
+}
+
+void InspectorDebuggerAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason reason)
+{
+    m_frontendDispatcher = nullptr;
+    m_backendDispatcher.clear();
+
+    bool skipRecompile = reason == InspectorDisconnectReason::InspectedTargetDestroyed;
+    disable(skipRecompile);
 }
 
 void InspectorDebuggerAgent::enable()
 {
-    m_instrumentingAgents->setInspectorDebuggerAgent(this);
+    if (m_enabled)
+        return;
 
     scriptDebugServer().setBreakpointsActivated(true);
     startListeningScriptDebugServer();
@@ -99,8 +103,10 @@ void InspectorDebuggerAgent::enable()
 
 void InspectorDebuggerAgent::disable(bool isBeingDestroyed)
 {
+    if (!m_enabled)
+        return;
+
     m_javaScriptBreakpoints.clear();
-    m_instrumentingAgents->setInspectorDebuggerAgent(nullptr);
 
     stopListeningScriptDebugServer(isBeingDestroyed);
     clearResolvedBreakpointState();
@@ -113,36 +119,12 @@ void InspectorDebuggerAgent::disable(bool isBeingDestroyed)
 
 void InspectorDebuggerAgent::enable(ErrorString*)
 {
-    if (m_enabled)
-        return;
-
     enable();
-
-    ASSERT(m_frontendDispatcher);
 }
 
 void InspectorDebuggerAgent::disable(ErrorString*)
 {
-    if (!m_enabled)
-        return;
-
-    bool skipRecompile = false;
-    disable(skipRecompile);
-}
-
-void InspectorDebuggerAgent::didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
-{
-    m_frontendDispatcher = std::make_unique<InspectorDebuggerFrontendDispatcher>(frontendChannel);
-    m_backendDispatcher = InspectorDebuggerBackendDispatcher::create(backendDispatcher, this);
-}
-
-void InspectorDebuggerAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason reason)
-{
-    m_frontendDispatcher = nullptr;
-    m_backendDispatcher.clear();
-
-    bool skipRecompile = reason == InspectorDisconnectReason::InspectedTargetDestroyed;
-    disable(skipRecompile);
+    disable(false);
 }
 
 void InspectorDebuggerAgent::setBreakpointsActive(ErrorString*, bool active)
@@ -158,23 +140,24 @@ bool InspectorDebuggerAgent::isPaused()
     return scriptDebugServer().isPaused();
 }
 
-void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageType type)
+void InspectorDebuggerAgent::handleConsoleAssert()
 {
-    if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions && source == ConsoleAPIMessageSource && type == AssertMessageType)
+    if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
         breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Assert, nullptr);
 }
 
 static PassRefPtr<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, RefPtr<InspectorArray>& actions, bool isRegex, bool autoContinue)
 {
     RefPtr<InspectorObject> breakpointObject = InspectorObject::create();
-    breakpointObject->setString("url", url);
-    breakpointObject->setNumber("lineNumber", lineNumber);
-    breakpointObject->setNumber("columnNumber", columnNumber);
-    breakpointObject->setString("condition", condition);
-    breakpointObject->setBoolean("isRegex", isRegex);
-    breakpointObject->setBoolean("autoContinue", autoContinue);
+    breakpointObject->setString(ASCIILiteral("url"), url);
+    breakpointObject->setNumber(ASCIILiteral("lineNumber"), lineNumber);
+    breakpointObject->setNumber(ASCIILiteral("columnNumber"), columnNumber);
+    breakpointObject->setString(ASCIILiteral("condition"), condition);
+    breakpointObject->setBoolean(ASCIILiteral("isRegex"), isRegex);
+    breakpointObject->setBoolean(ASCIILiteral("autoContinue"), autoContinue);
+
     if (actions)
-        breakpointObject->setArray("actions", actions);
+        breakpointObject->setArray(ASCIILiteral("actions"), actions);
 
     return breakpointObject;
 }
@@ -224,24 +207,24 @@ bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString* errorStr
         RefPtr<InspectorValue> value = actions->get(i);
         RefPtr<InspectorObject> object;
         if (!value->asObject(&object)) {
-            *errorString = "BreakpointAction of incorrect type, expected object";
+            *errorString = ASCIILiteral("BreakpointAction of incorrect type, expected object");
             return false;
         }
 
         String typeString;
-        if (!object->getString("type", &typeString)) {
-            *errorString = "BreakpointAction had type missing";
+        if (!object->getString(ASCIILiteral("type"), &typeString)) {
+            *errorString = ASCIILiteral("BreakpointAction had type missing");
             return false;
         }
 
         ScriptBreakpointActionType type;
         if (!breakpointActionTypeForString(typeString, &type)) {
-            *errorString = "BreakpointAction had unknown type";
+            *errorString = ASCIILiteral("BreakpointAction had unknown type");
             return false;
         }
 
         String data;
-        object->getString("data", &data);
+        object->getString(ASCIILiteral("data"), &data);
 
         result->append(ScriptBreakpointAction(type, m_nextBreakpointActionIdentifier++, data));
     }
@@ -251,9 +234,9 @@ bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString* errorStr
 
 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers)
 {
-    locations = Array<Inspector::TypeBuilder::Debugger::Location>::create();
+    locations = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>::create();
     if (!optionalURL == !optionalURLRegex) {
-        *errorString = "Either url or urlRegex must be specified.";
+        *errorString = ASCIILiteral("Either url or urlRegex must be specified.");
         return;
     }
 
@@ -263,7 +246,7 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li
 
     String breakpointIdentifier = (isRegex ? "/" + url + "/" : url) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber);
     if (m_javaScriptBreakpoints.contains(breakpointIdentifier)) {
-        *errorString = "Breakpoint at specified location already exists.";
+        *errorString = ASCIILiteral("Breakpoint at specified location already exists.");
         return;
     }
 
@@ -271,9 +254,9 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li
     bool autoContinue = false;
     RefPtr<InspectorArray> actions;
     if (options) {
-        (*options)->getString("condition", &condition);
-        (*options)->getBoolean("autoContinue", &autoContinue);
-        actions = (*options)->getArray("actions");
+        (*options)->getString(ASCIILiteral("condition"), &condition);
+        (*options)->getBoolean(ASCIILiteral("autoContinue"), &autoContinue);
+        actions = (*options)->getArray(ASCIILiteral("actions"));
     }
 
     Vector<ScriptBreakpointAction> breakpointActions;
@@ -302,15 +285,15 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li
 static bool parseLocation(ErrorString* errorString, InspectorObject* location, JSC::SourceID* sourceID, unsigned* lineNumber, unsigned* columnNumber)
 {
     String scriptIDStr;
-    if (!location->getString("scriptId", &scriptIDStr) || !location->getNumber("lineNumber", lineNumber)) {
-        // FIXME: replace with input validation.
+    if (!location->getString(ASCIILiteral("scriptId"), &scriptIDStr) || !location->getNumber(ASCIILiteral("lineNumber"), lineNumber)) {
         *sourceID = JSC::noSourceID;
-        *errorString = "scriptId and lineNumber are required.";
+        *errorString = ASCIILiteral("scriptId and lineNumber are required.");
         return false;
     }
+
     *sourceID = scriptIDStr.toIntPtr();
     *columnNumber = 0;
-    location->getNumber("columnNumber", columnNumber);
+    location->getNumber(ASCIILiteral("columnNumber"), columnNumber);
     return true;
 }
 
@@ -319,7 +302,6 @@ void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPt
     JSC::SourceID sourceID;
     unsigned lineNumber;
     unsigned columnNumber;
-
     if (!parseLocation(errorString, location.get(), &sourceID, &lineNumber, &columnNumber))
         return;
 
@@ -327,31 +309,33 @@ void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPt
     bool autoContinue = false;
     RefPtr<InspectorArray> actions;
     if (options) {
-        (*options)->getString("condition", &condition);
-        (*options)->getBoolean("autoContinue", &autoContinue);
-        actions = (*options)->getArray("actions");
+        (*options)->getString(ASCIILiteral("condition"), &condition);
+        (*options)->getBoolean(ASCIILiteral("autoContinue"), &autoContinue);
+        actions = (*options)->getArray(ASCIILiteral("actions"));
     }
 
     Vector<ScriptBreakpointAction> breakpointActions;
     if (!breakpointActionsFromProtocol(errorString, actions, &breakpointActions))
         return;
-    
+
     breakpointActionIdentifiers = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>::create();
     for (ScriptBreakpointAction& action : breakpointActions)
         breakpointActionIdentifiers->addItem(action.identifier);
 
     String breakpointIdentifier = String::number(sourceID) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber);
     if (m_breakpointIdentifierToDebugServerBreakpointIDs.find(breakpointIdentifier) != m_breakpointIdentifierToDebugServerBreakpointIDs.end()) {
-        *errorString = "Breakpoint at specified location already exists.";
+        *errorString = ASCIILiteral("Breakpoint at specified location already exists.");
         return;
     }
 
     ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, breakpointActions, autoContinue);
     actualLocation = resolveBreakpoint(breakpointIdentifier, sourceID, breakpoint);
-    if (actualLocation)
-        *outBreakpointIdentifier = breakpointIdentifier;
-    else
-        *errorString = "Could not resolve breakpoint";
+    if (!actualLocation) {
+        *errorString = ASCIILiteral("Could not resolve breakpoint");
+        return;
+    }
+
+    *outBreakpointIdentifier = breakpointIdentifier;
 }
 
 void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakpointIdentifier)
@@ -378,7 +362,6 @@ void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const
     JSC::SourceID sourceID;
     unsigned lineNumber;
     unsigned columnNumber;
-
     if (!parseLocation(errorString, location.get(), &sourceID, &lineNumber, &columnNumber))
         return;
 
@@ -414,7 +397,7 @@ PassRefPtr<Inspector::TypeBuilder::Debugger::Location> InspectorDebuggerAgent::r
     return location;
 }
 
-void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptIDStr, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>>& results)
+void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptIDStr, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>>& results)
 {
     bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
@@ -441,9 +424,10 @@ void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId);
     if (injectedScript.hasNoValue()) {
-        *errorString = "Function object id is obsolete";
+        *errorString = ASCIILiteral("Function object id is obsolete");
         return;
     }
+
     injectedScript.getFunctionDetails(errorString, functionId, &details);
 }
 
@@ -451,6 +435,7 @@ void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorDebuggerFront
 {
     if (m_javaScriptPauseScheduled)
         return;
+
     m_breakReason = breakReason;
     m_breakAuxData = data;
     scriptDebugServer().setPauseOnNextStatement(true);
@@ -460,6 +445,7 @@ void InspectorDebuggerAgent::cancelPauseOnNextStatement()
 {
     if (m_javaScriptPauseScheduled)
         return;
+
     clearBreakDetails();
     scriptDebugServer().setPauseOnNextStatement(false);
 }
@@ -468,6 +454,7 @@ void InspectorDebuggerAgent::pause(ErrorString*)
 {
     if (m_javaScriptPauseScheduled)
         return;
+
     clearBreakDetails();
     scriptDebugServer().setPauseOnNextStatement(true);
     m_javaScriptPauseScheduled = true;
@@ -477,6 +464,7 @@ void InspectorDebuggerAgent::resume(ErrorString* errorString)
 {
     if (!assertPaused(errorString))
         return;
+
     m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
     scriptDebugServer().continueProgram();
 }
@@ -485,6 +473,7 @@ void InspectorDebuggerAgent::stepOver(ErrorString* errorString)
 {
     if (!assertPaused(errorString))
         return;
+
     m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
     scriptDebugServer().stepOverStatement();
 }
@@ -493,6 +482,7 @@ void InspectorDebuggerAgent::stepInto(ErrorString* errorString)
 {
     if (!assertPaused(errorString))
         return;
+
     m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
     scriptDebugServer().stepIntoStatement();
     m_listener->stepInto();
@@ -502,41 +492,42 @@ void InspectorDebuggerAgent::stepOut(ErrorString* errorString)
 {
     if (!assertPaused(errorString))
         return;
+
     m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
     scriptDebugServer().stepOutOfFunction();
 }
 
 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, const String& stringPauseState)
 {
-    ScriptDebugServer::PauseOnExceptionsState pauseState;
+    JSC::Debugger::PauseOnExceptionsState pauseState;
     if (stringPauseState == "none")
-        pauseState = ScriptDebugServer::DontPauseOnExceptions;
+        pauseState = JSC::Debugger::DontPauseOnExceptions;
     else if (stringPauseState == "all")
-        pauseState = ScriptDebugServer::PauseOnAllExceptions;
+        pauseState = JSC::Debugger::PauseOnAllExceptions;
     else if (stringPauseState == "uncaught")
-        pauseState = ScriptDebugServer::PauseOnUncaughtExceptions;
+        pauseState = JSC::Debugger::PauseOnUncaughtExceptions;
     else {
         *errorString = "Unknown pause on exceptions mode: " + stringPauseState;
         return;
     }
 
-    scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
+    scriptDebugServer().setPauseOnExceptionsState(static_cast<JSC::Debugger::PauseOnExceptionsState>(pauseState));
     if (scriptDebugServer().pauseOnExceptionsState() != pauseState)
-        *errorString = "Internal error. Could not change pause on exceptions state";
+        *errorString = ASCIILiteral("Internal error. Could not change pause on exceptions state");
 }
 
 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
     if (injectedScript.hasNoValue()) {
-        *errorString = "Inspected frame has gone";
+        *errorString = ASCIILiteral("Inspected frame has gone");
         return;
     }
 
-    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState();
+    JSC::Debugger::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState();
     if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
-        if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptions)
-            scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions);
+        if (previousPauseOnExceptionsState != JSC::Debugger::DontPauseOnExceptions)
+            scriptDebugServer().setPauseOnExceptionsState(JSC::Debugger::DontPauseOnExceptions);
         muteConsole();
     }
 
@@ -555,54 +546,37 @@ void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*)
 
 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText)
 {
-    if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions) {
+    if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) {
         RefPtr<InspectorObject> directive = InspectorObject::create();
-        directive->setString("directiveText", directiveText);
+        directive->setString(ASCIILiteral("directiveText"), directiveText);
         breakProgram(InspectorDebuggerFrontendDispatcher::Reason::CSPViolation, directive.release());
     }
 }
 
-PassRefPtr<Array<Inspector::TypeBuilder::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames()
+PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames()
 {
     if (!m_pausedScriptState)
-        return Array<Inspector::TypeBuilder::Debugger::CallFrame>::create();
+        return Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>::create();
+
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState);
     if (injectedScript.hasNoValue()) {
         ASSERT_NOT_REACHED();
-        return Array<Inspector::TypeBuilder::Debugger::CallFrame>::create();
+        return Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>::create();
     }
+
     return injectedScript.wrapCallFrames(m_currentCallStack);
 }
 
 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
 {
-    DEFINE_STATIC_LOCAL(String, sourceMapHTTPHeader, (ASCIILiteral("SourceMap")));
-    DEFINE_STATIC_LOCAL(String, sourceMapHTTPHeaderDeprecated, (ASCIILiteral("X-SourceMap")));
-
-    if (!script.url.isEmpty()) {
-        if (InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent()) {
-            CachedResource* resource = pageAgent->cachedResource(pageAgent->mainFrame(), URL(ParsedURLString, script.url));
-            if (resource) {
-                String sourceMapHeader = resource->response().httpHeaderField(sourceMapHTTPHeader);
-                if (!sourceMapHeader.isEmpty())
-                    return sourceMapHeader;
-
-                sourceMapHeader = resource->response().httpHeaderField(sourceMapHTTPHeaderDeprecated);
-                if (!sourceMapHeader.isEmpty())
-                    return sourceMapHeader;
-            }
-        }
-    }
-
     return ContentSearchUtilities::findScriptSourceMapURL(script.source);
 }
 
-// JavaScriptDebugListener functions
-
 void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script& inScript)
 {
     Script script = inScript;
-    if (!script.startLine && !script.startColumn)
+    // FIXME: Why does -[JSContext evaluateScript] have a -1 startLine?
+    if (script.startLine <= 0 && !script.startColumn)
         script.sourceURL = ContentSearchUtilities::findScriptSourceURL(script.source);
     script.sourceMappingURL = sourceMapURLForScript(script);
 
@@ -622,18 +596,18 @@ void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script
     for (auto it = m_javaScriptBreakpoints.begin(), end = m_javaScriptBreakpoints.end(); it != end; ++it) {
         RefPtr<InspectorObject> breakpointObject = it->value->asObject();
         bool isRegex;
-        breakpointObject->getBoolean("isRegex", &isRegex);
+        breakpointObject->getBoolean(ASCIILiteral("isRegex"), &isRegex);
         String url;
-        breakpointObject->getString("url", &url);
+        breakpointObject->getString(ASCIILiteral("url"), &url);
         if (!matches(scriptURL, url, isRegex))
             continue;
         ScriptBreakpoint breakpoint;
-        breakpointObject->getNumber("lineNumber", &breakpoint.lineNumber);
-        breakpointObject->getNumber("columnNumber", &breakpoint.columnNumber);
-        breakpointObject->getString("condition", &breakpoint.condition);
-        breakpointObject->getBoolean("autoContinue", &breakpoint.autoContinue);
+        breakpointObject->getNumber(ASCIILiteral("lineNumber"), &breakpoint.lineNumber);
+        breakpointObject->getNumber(ASCIILiteral("columnNumber"), &breakpoint.columnNumber);
+        breakpointObject->getString(ASCIILiteral("condition"), &breakpoint.condition);
+        breakpointObject->getBoolean(ASCIILiteral("autoContinue"), &breakpoint.autoContinue);
         ErrorString errorString;
-        RefPtr<InspectorArray> actions = breakpointObject->getArray("actions");
+        RefPtr<InspectorArray> actions = breakpointObject->getArray(ASCIILiteral("actions"));
         if (!breakpointActionsFromProtocol(&errorString, actions, &breakpoint.actions)) {
             ASSERT_NOT_REACHED();
             continue;
@@ -660,7 +634,7 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Depreca
         InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
         if (!injectedScript.hasNoValue()) {
             m_breakReason = InspectorDebuggerFrontendDispatcher::Reason::Exception;
-            m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->openAccessors();
+            m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors();
             // m_breakAuxData might be null after this.
         }
     }
@@ -672,6 +646,7 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Depreca
         scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointID);
         m_continueToLocationBreakpointID = JSC::noBreakpointID;
     }
+
     if (m_listener)
         m_listener->didPause();
 }
@@ -695,7 +670,6 @@ void InspectorDebuggerAgent::didSampleProbe(JSC::ExecState* scriptState, int pro
 void InspectorDebuggerAgent::breakpointActionSound()
 {
     // FIXME: We should send a message to the frontend to make the frontend beep.
-    systemBeep();
 }
 
 void InspectorDebuggerAgent::didContinue()
@@ -703,6 +677,7 @@ void InspectorDebuggerAgent::didContinue()
     m_pausedScriptState = nullptr;
     m_currentCallStack = Deprecated::ScriptValue();
     clearBreakDetails();
+
     m_frontendDispatcher->resumed();
 }
 
@@ -736,9 +711,10 @@ void InspectorDebuggerAgent::clearResolvedBreakpointState()
 bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString)
 {
     if (!m_pausedScriptState) {
-        *errorString = "Can only perform operation while paused.";
+        *errorString = ASCIILiteral("Can only perform operation while paused.");
         return false;
     }
+
     return true;
 }
 
@@ -756,6 +732,7 @@ void InspectorDebuggerAgent::didClearGlobalObject()
     clearResolvedBreakpointState();
 }
 
-} // namespace WebCore
+} // namespace Inspector
 
-#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+#endif // ENABLE(INSPECTOR)
 #ifndef InspectorDebuggerAgent_h
 #define InspectorDebuggerAgent_h
 
-#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
-
-#include "ConsoleAPITypes.h"
-#include "ConsoleTypes.h"
-#include "InspectorWebAgentBase.h"
-#include <bindings/ScriptValue.h>
-#include <debugger/Debugger.h>
-#include <inspector/InspectorJSBackendDispatchers.h>
-#include <inspector/InspectorJSFrontendDispatchers.h>
-#include <inspector/ScriptBreakpoint.h>
-#include <inspector/ScriptDebugListener.h>
+#if ENABLE(INSPECTOR)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "InspectorJSBackendDispatchers.h"
+#include "InspectorJSFrontendDispatchers.h"
+#include "bindings/ScriptValue.h"
+#include "debugger/Debugger.h"
+#include "inspector/InspectorAgentBase.h"
+#include "inspector/ScriptBreakpoint.h"
+#include "inspector/ScriptDebugListener.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
 
 namespace Inspector {
+
 class InjectedScript;
 class InjectedScriptManager;
 class InspectorArray;
 class InspectorObject;
 class InspectorValue;
 class ScriptDebugServer;
-}
-
-namespace WebCore {
-
-class InstrumentingAgents;
-
 typedef String ErrorString;
 
-class InspectorDebuggerAgent : public InspectorAgentBase, public Inspector::ScriptDebugListener, public Inspector::InspectorDebuggerBackendDispatcherHandler {
-    WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
+class JS_EXPORT_PRIVATE InspectorDebuggerAgent : public InspectorAgentBase, public ScriptDebugListener, public InspectorDebuggerBackendDispatcherHandler {
+    WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent);
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     static const char* backtraceObjectGroup;
 
     virtual ~InspectorDebuggerAgent();
 
-    virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
-    virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
+    virtual void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*) override;
+    virtual void willDestroyFrontendAndBackend(InspectorDisconnectReason) override;
 
-    bool isPaused();
-    void addMessageToConsole(MessageSource, MessageType);
-
-    // Part of the protocol.
     virtual void enable(ErrorString*) override;
     virtual void disable(ErrorString*) override;
     virtual void setBreakpointsActive(ErrorString*, bool active) override;
-
     virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) override;
     virtual void setBreakpoint(ErrorString*, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) override;
     virtual void removeBreakpoint(ErrorString*, const String& breakpointIdentifier) override;
-    virtual void continueToLocation(ErrorString*, const RefPtr<Inspector::InspectorObject>& location) override;
-
+    virtual void continueToLocation(ErrorString*, const RefPtr<InspectorObject>& location) override;
     virtual void searchInContent(ErrorString*, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>>&) override;
     virtual void getScriptSource(ErrorString*, const String& scriptID, String* scriptSource) override;
     virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<Inspector::TypeBuilder::Debugger::FunctionDetails>&) override;
@@ -95,21 +85,16 @@ public:
     virtual void stepInto(ErrorString*) override;
     virtual void stepOut(ErrorString*) override;
     virtual void setPauseOnExceptions(ErrorString*, const String& pauseState) override;
-    virtual void evaluateOnCallFrame(ErrorString*,
-                             const String& callFrameId,
-                             const String& expression,
-                             const String* objectGroup,
-                             const bool* includeCommandLineAPI,
-                             const bool* doNotPauseOnExceptionsAndMuteConsole,
-                             const bool* returnByValue,
-                             const bool* generatePreview,
-                             RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result,
-                             Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override;
+    virtual void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override;
     virtual void setOverlayMessage(ErrorString*, const String*) override;
 
-    void schedulePauseOnNextStatement(Inspector::InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<Inspector::InspectorObject> data);
+    bool isPaused();
+    
+    void handleConsoleAssert();
+
+    void schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<InspectorObject> data);
     void cancelPauseOnNextStatement();
-    void breakProgram(Inspector::InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<Inspector::InspectorObject> data);
+    void breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<InspectorObject> data);
     void scriptExecutionBlockedByCSP(const String& directiveText);
 
     class Listener {
@@ -122,22 +107,26 @@ public:
     };
     void setListener(Listener* listener) { m_listener = listener; }
 
-    virtual Inspector::ScriptDebugServer& scriptDebugServer() = 0;
+    virtual ScriptDebugServer& scriptDebugServer() = 0;
 
 protected:
-    InspectorDebuggerAgent(InstrumentingAgents*, Inspector::InjectedScriptManager*);
+    InspectorDebuggerAgent(InjectedScriptManager*);
+
+    InjectedScriptManager* injectedScriptManager() const { return m_injectedScriptManager; }
+    virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0;
 
     virtual void startListeningScriptDebugServer() = 0;
-    virtual void stopListeningScriptDebugServer(bool isBeingDestroyed) = 0;
+    virtual void stopListeningScriptDebugServer(bool skipRecompile) = 0;
     virtual void muteConsole() = 0;
     virtual void unmuteConsole() = 0;
-    Inspector::InjectedScriptManager* injectedScriptManager() const { return m_injectedScriptManager; }
-    virtual Inspector::InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0;
 
     virtual void enable();
-    virtual void disable(bool isBeingDestroyed);
+    virtual void disable(bool skipRecompile);
     virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception) override;
     virtual void didContinue() override;
+
+    virtual String sourceMapURLForScript(const Script&);
+
     void didClearGlobalObject();
 
 private:
@@ -146,41 +135,41 @@ private:
     virtual void didParseSource(JSC::SourceID, const Script&) override final;
     virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) override final;
     virtual void didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& sample) override final;
-    virtual void breakpointActionSound() override final;
 
-    PassRefPtr<Inspector::TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const Inspector::ScriptBreakpoint&);
+    virtual void breakpointActionSound() override;
+
+    PassRefPtr<Inspector::TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&);
     bool assertPaused(ErrorString*);
     void clearResolvedBreakpointState();
     void clearBreakDetails();
 
-    bool breakpointActionsFromProtocol(ErrorString*, RefPtr<Inspector::InspectorArray>& actions, Vector<Inspector::ScriptBreakpointAction>* result);
-
-    String sourceMapURLForScript(const Script&);
+    bool breakpointActionsFromProtocol(ErrorString*, RefPtr<InspectorArray>& actions, Vector<ScriptBreakpointAction>* result);
 
     typedef HashMap<JSC::SourceID, Script> ScriptsMap;
     typedef HashMap<String, Vector<JSC::BreakpointID>> BreakpointIdentifierToDebugServerBreakpointIDsMap;
-    typedef HashMap<String, RefPtr<Inspector::InspectorObject>> BreakpointIdentifierToBreakpointMap;
+    typedef HashMap<String, RefPtr<InspectorObject>> BreakpointIdentifierToBreakpointMap;
 
-    Inspector::InjectedScriptManager* m_injectedScriptManager;
-    std::unique_ptr<Inspector::InspectorDebuggerFrontendDispatcher> m_frontendDispatcher;
-    RefPtr<Inspector::InspectorDebuggerBackendDispatcher> m_backendDispatcher;
+    InjectedScriptManager* m_injectedScriptManager;
+    std::unique_ptr<InspectorDebuggerFrontendDispatcher> m_frontendDispatcher;
+    RefPtr<InspectorDebuggerBackendDispatcher> m_backendDispatcher;
+    Listener* m_listener;
     JSC::ExecState* m_pausedScriptState;
     Deprecated::ScriptValue m_currentCallStack;
     ScriptsMap m_scripts;
     BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs;
     BreakpointIdentifierToBreakpointMap m_javaScriptBreakpoints;
     JSC::BreakpointID m_continueToLocationBreakpointID;
-    Inspector::InspectorDebuggerFrontendDispatcher::Reason::Enum m_breakReason;
-    RefPtr<Inspector::InspectorObject> m_breakAuxData;
+    InspectorDebuggerFrontendDispatcher::Reason::Enum m_breakReason;
+    RefPtr<InspectorObject> m_breakAuxData;
     bool m_enabled;
     bool m_javaScriptPauseScheduled;
-    Listener* m_listener;
     int m_nextProbeSampleId;
     int m_nextBreakpointActionIdentifier;
 };
 
-} // namespace WebCore
+} // namespace Inspector
 
-#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+#endif // ENABLE(INSPECTOR)
 
 #endif // !defined(InspectorDebuggerAgent_h)
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp
new file mode 100644 (file)
index 0000000..d4c32d7
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2014 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectDebuggerAgent.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "InjectedScriptManager.h"
+#include "JSGlobalObject.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent(InjectedScriptManager* injectedScriptManager, JSC::JSGlobalObject& globalObject)
+    : InspectorDebuggerAgent(injectedScriptManager)
+    , m_scriptDebugServer(globalObject)
+{
+}
+
+void JSGlobalObjectDebuggerAgent::startListeningScriptDebugServer()
+{
+    scriptDebugServer().addListener(this);
+}
+
+void JSGlobalObjectDebuggerAgent::stopListeningScriptDebugServer(bool isBeingDestroyed)
+{
+    scriptDebugServer().removeListener(this, isBeingDestroyed);
+}
+
+InjectedScript JSGlobalObjectDebuggerAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId)
+{
+    if (executionContextId) {
+        *error = ASCIILiteral("Execution context id is not supported for JSContext inspection as there is only one execution context.");
+        return InjectedScript();
+    }
+
+    ExecState* exec = m_scriptDebugServer.globalObject().globalExec();
+    return injectedScriptManager()->injectedScriptFor(exec);
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h
new file mode 100644 (file)
index 0000000..a9fd679
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#ifndef JSGlobalObjectDebuggerAgent_h
+#define JSGlobalObjectDebuggerAgent_h
+
+#if ENABLE(INSPECTOR)
+
+#include "InspectorDebuggerAgent.h"
+#include "JSGlobalObjectScriptDebugServer.h"
+
+namespace Inspector {
+
+class JSGlobalObjectDebuggerAgent final : public InspectorDebuggerAgent {
+    WTF_MAKE_NONCOPYABLE(JSGlobalObjectDebuggerAgent);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    JSGlobalObjectDebuggerAgent(InjectedScriptManager*, JSC::JSGlobalObject&);
+    virtual ~JSGlobalObjectDebuggerAgent() { }
+
+    virtual JSGlobalObjectScriptDebugServer& scriptDebugServer() override { return m_scriptDebugServer; }
+
+    virtual void startListeningScriptDebugServer() override;
+    virtual void stopListeningScriptDebugServer(bool isBeingDestroyed) override;
+    virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) override;
+
+    // FIXME: This needs a ConsoleAgent to send a log to.
+    virtual void breakpointActionLog(JSC::ExecState*, const String&) override final { }
+
+    // FIXME: JavaScript inspector does not yet have a console object to mute.
+    virtual void muteConsole() override { }
+    virtual void unmuteConsole() override { }
+
+private:
+    JSGlobalObjectScriptDebugServer m_scriptDebugServer;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+#endif // !defined(JSGlobalObjectDebuggerAgent_h)
index b16ebd0..747df2b 100644 (file)
@@ -1587,7 +1587,6 @@ set(WebCore_SOURCES
     inspector/InspectorDOMStorageAgent.cpp
     inspector/InspectorDatabaseAgent.cpp
     inspector/InspectorDatabaseResource.cpp
-    inspector/InspectorDebuggerAgent.cpp
     inspector/InspectorFrontendClientLocal.cpp
     inspector/InspectorFrontendHost.cpp
     inspector/InspectorHeapProfilerAgent.cpp
@@ -1618,6 +1617,7 @@ set(WebCore_SOURCES
     inspector/ScriptCallFrame.cpp
     inspector/ScriptCallStack.cpp
     inspector/TimelineRecordFactory.cpp
+    inspector/WebDebuggerAgent.cpp
     inspector/WorkerConsoleAgent.cpp
     inspector/WorkerDebuggerAgent.cpp
     inspector/WorkerInspectorController.cpp
index 8be8d19..07e0583 100644 (file)
@@ -1,3 +1,67 @@
+2014-01-26  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Move InspectorDebuggerAgent into JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=127629
+
+        Rubber-stamped by Sam Weinig.
+
+        Test: inspector-protocol/debugger/pause-on-assert.html
+
+        * CMakeLists.txt:
+        * ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Added.
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorAllInOne.cpp:
+        - Remove InspectorDebuggerAgent.
+        - Add WebDebuggerAgent (shared between Page and Worker).
+
+        * inspector/WebDebuggerAgent.h: Added.
+        (WebCore::WebDebuggerAgent::~WebDebuggerAgent):
+        * inspector/WebDebuggerAgent.cpp: Added.
+        (WebCore::WebDebuggerAgent::WebDebuggerAgent):
+        (WebCore::WebDebuggerAgent::enable):
+        (WebCore::WebDebuggerAgent::disable):
+        Shared code for Page and Worker debugger agents.
+        Instrumenting agents is a concept in WebCore only,
+        and the Debugger agent is only in the instrumenting
+        agents list when it is enabled and removed when disabled.
+
+        * inspector/InstrumentingAgents.h:
+        (WebCore::InstrumentingAgents::inspectorDebuggerAgent):
+        (WebCore::InstrumentingAgents::setInspectorDebuggerAgent):
+        * inspector/InspectorDOMDebuggerAgent.cpp:
+        * inspector/InspectorDOMDebuggerAgent.h:
+        Update namespace for debugger agent.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::isConsoleAssertMessage):
+        (WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
+        DebuggerAgent in JavaScriptCore does not yet know about console
+        types. So temporarily handle it here. We need to give JavaScriptCore
+        some concept of Console messages and types.
+
+        * inspector/PageDebuggerAgent.cpp:
+        (WebCore::PageDebuggerAgent::PageDebuggerAgent):
+        (WebCore::PageDebuggerAgent::enable):
+        (WebCore::PageDebuggerAgent::disable):
+        (WebCore::PageDebuggerAgent::sourceMapURLForScript):
+        (WebCore::PageDebuggerAgent::injectedScriptForEval):
+        * inspector/PageDebuggerAgent.h:
+        * inspector/WorkerDebuggerAgent.cpp:
+        (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
+        (WebCore::WorkerDebuggerAgent::injectedScriptForEval):
+        * inspector/WorkerDebuggerAgent.h:
+        Modernize the Page and Worker debugger agents.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        * inspector/InspectorController.h:
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        New constructors for the debugger agents.
+
 2014-01-25  Timothy Hatcher  <timothy@apple.com>
 
         Remove dead code from the JSC profiler.
diff --git a/Source/WebCore/ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h b/Source/WebCore/ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h
new file mode 100644 (file)
index 0000000..7072ebe
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_InspectorDebuggerAgent_h
+#define WebCore_FWD_InspectorDebuggerAgent_h
+#include <JavaScriptCore/InspectorDebuggerAgent.h>
+#endif
index 7d7f9c1..5ef87dd 100644 (file)
@@ -3785,8 +3785,6 @@ webcore_sources += \
        Source/WebCore/inspector/InspectorDatabaseInstrumentation.h \
        Source/WebCore/inspector/InspectorDatabaseResource.cpp \
        Source/WebCore/inspector/InspectorDatabaseResource.h \
-       Source/WebCore/inspector/InspectorDebuggerAgent.cpp \
-       Source/WebCore/inspector/InspectorDebuggerAgent.h \
        Source/WebCore/inspector/InspectorDOMAgent.cpp \
        Source/WebCore/inspector/InspectorDOMAgent.h \
        Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp \
@@ -3857,6 +3855,8 @@ webcore_sources += \
        Source/WebCore/inspector/ScriptCallStack.h \
        Source/WebCore/inspector/TimelineRecordFactory.cpp \
        Source/WebCore/inspector/TimelineRecordFactory.h \
+       Source/WebCore/inspector/WebDebuggerAgent.cpp \
+       Source/WebCore/inspector/WebDebuggerAgent.h \
        Source/WebCore/inspector/WorkerConsoleAgent.cpp \
        Source/WebCore/inspector/WorkerConsoleAgent.h \
        Source/WebCore/inspector/WorkerDebuggerAgent.cpp \
index 2ed1a4b..07a4a9c 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\inspector\InspectorDebuggerAgent.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\inspector\InspectorDOMAgent.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\inspector\WebDebuggerAgent.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\inspector\WorkerConsoleAgent.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     <ClInclude Include="..\inspector\InspectorDatabaseAgent.h" />
     <ClInclude Include="..\inspector\InspectorDatabaseInstrumentation.h" />
     <ClInclude Include="..\inspector\InspectorDatabaseResource.h" />
-    <ClInclude Include="..\inspector\InspectorDebuggerAgent.h" />
     <ClInclude Include="..\inspector\InspectorDOMAgent.h" />
     <ClInclude Include="..\inspector\InspectorDOMDebuggerAgent.h" />
     <ClInclude Include="..\inspector\InspectorDOMStorageAgent.h" />
     <ClInclude Include="..\inspector\ScriptCallFrame.h" />
     <ClInclude Include="..\inspector\ScriptCallStack.h" />
     <ClInclude Include="..\inspector\TimelineRecordFactory.h" />
+    <ClInclude Include="..\inspector\WebDebuggerAgent.h" />
     <ClInclude Include="..\inspector\WorkerConsoleAgent.h" />
     <ClInclude Include="..\inspector\WorkerDebuggerAgent.h" />
     <ClInclude Include="..\inspector\WorkerInspectorController.h" />
index 0f653df..3125adf 100644 (file)
     <ClCompile Include="..\inspector\InspectorDatabaseResource.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
-    <ClCompile Include="..\inspector\InspectorDebuggerAgent.cpp">
-      <Filter>inspector</Filter>
-    </ClCompile>
     <ClCompile Include="..\inspector\InspectorDOMAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
     <ClCompile Include="..\inspector\TimelineRecordFactory.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
+    <ClCompile Include="..\inspector\WebDebuggerAgent.cpp">
+      <Filter>inspector</Filter>
+    </ClCompile>
     <ClCompile Include="..\inspector\WorkerConsoleAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
     <ClInclude Include="..\inspector\InspectorDatabaseResource.h">
       <Filter>inspector</Filter>
     </ClInclude>
-    <ClInclude Include="..\inspector\InspectorDebuggerAgent.h">
-      <Filter>inspector</Filter>
-    </ClInclude>
     <ClInclude Include="..\inspector\InspectorDOMAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
     <ClInclude Include="..\inspector\TimelineRecordFactory.h">
       <Filter>inspector</Filter>
     </ClInclude>
+    <ClInclude Include="..\inspector\WebDebuggerAgent.h">
+      <Filter>inspector</Filter>
+    </ClInclude>
     <ClInclude Include="..\inspector\WorkerConsoleAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
index f1c5ed0..c2ba3b9 100644 (file)
                A5C566AB127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C566AA127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5DEBDA316FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */; };
                A5DEBDA416FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEBDA016FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h */; };
+               A5E616731894581F009ADF50 /* WebDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E616711894581F009ADF50 /* WebDebuggerAgent.cpp */; };
+               A5E616741894581F009ADF50 /* WebDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E616721894581F009ADF50 /* WebDebuggerAgent.h */; };
                A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */; };
                A5F9EF701266750D00FCCF52 /* DiskImageCacheIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5F9EF6E1266750D00FCCF52 /* DiskImageCacheIOS.mm */; };
                A5F9EF711266750D00FCCF52 /* DiskImageCacheIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A5F9EF6F1266750D00FCCF52 /* DiskImageCacheIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F3335BF812E07DC300D33011 /* InspectorConsoleAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3335BF612E07DC300D33011 /* InspectorConsoleAgent.cpp */; };
                F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3335BF712E07DC300D33011 /* InspectorConsoleAgent.h */; };
                F33F0282120947F200E5743A /* ScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F0281120947F200E5743A /* ScriptProfile.cpp */; };
-               F33F053D120B0DA500E5743A /* InspectorDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F053B120B0DA500E5743A /* InspectorDebuggerAgent.cpp */; };
-               F33F053E120B0DA500E5743A /* InspectorDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F33F053C120B0DA500E5743A /* InspectorDebuggerAgent.h */; };
                F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C75211294D9D00F26EEE /* InspectorFrontendClientLocal.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F344C75811294FF600F26EEE /* InspectorFrontendClientLocal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F344C75711294FF600F26EEE /* InspectorFrontendClientLocal.cpp */; };
                A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitPlaybackTargetAvailabilityEvent.cpp; sourceTree = "<group>"; };
                A5DEBDA016FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitPlaybackTargetAvailabilityEvent.h; sourceTree = "<group>"; };
                A5DEBDA116FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitPlaybackTargetAvailabilityEvent.idl; sourceTree = "<group>"; };
+               A5E616711894581F009ADF50 /* WebDebuggerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDebuggerAgent.cpp; sourceTree = "<group>"; };
+               A5E616721894581F009ADF50 /* WebDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDebuggerAgent.h; sourceTree = "<group>"; };
                A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Autocapitalize.cpp; sourceTree = "<group>"; };
                A5F9EF6E1266750D00FCCF52 /* DiskImageCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DiskImageCacheIOS.mm; sourceTree = "<group>"; };
                A5F9EF6F1266750D00FCCF52 /* DiskImageCacheIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiskImageCacheIOS.h; sourceTree = "<group>"; };
                F3335BF612E07DC300D33011 /* InspectorConsoleAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorConsoleAgent.cpp; sourceTree = "<group>"; };
                F3335BF712E07DC300D33011 /* InspectorConsoleAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorConsoleAgent.h; sourceTree = "<group>"; };
                F33F0281120947F200E5743A /* ScriptProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfile.cpp; sourceTree = "<group>"; };
-               F33F053B120B0DA500E5743A /* InspectorDebuggerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDebuggerAgent.cpp; sourceTree = "<group>"; };
-               F33F053C120B0DA500E5743A /* InspectorDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDebuggerAgent.h; sourceTree = "<group>"; };
                F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendClient.h; sourceTree = "<group>"; };
                F344C75211294D9D00F26EEE /* InspectorFrontendClientLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendClientLocal.h; sourceTree = "<group>"; };
                F344C75711294FF600F26EEE /* InspectorFrontendClientLocal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontendClientLocal.cpp; sourceTree = "<group>"; };
                                F3F5CF1212ED81B30084C569 /* InspectorDatabaseInstrumentation.h */,
                                41F062130F5F192600A07EAC /* InspectorDatabaseResource.cpp */,
                                41F062120F5F192600A07EAC /* InspectorDatabaseResource.h */,
-                               F33F053B120B0DA500E5743A /* InspectorDebuggerAgent.cpp */,
-                               F33F053C120B0DA500E5743A /* InspectorDebuggerAgent.h */,
                                7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */,
                                7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */,
                                F3D4C47612E07663003DA150 /* InspectorDOMDebuggerAgent.cpp */,
                                9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */,
                                7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */,
                                7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */,
+                               A5E616711894581F009ADF50 /* WebDebuggerAgent.cpp */,
+                               A5E616721894581F009ADF50 /* WebDebuggerAgent.h */,
                                F382088E147D35F90010BC06 /* WorkerConsoleAgent.cpp */,
                                F382088F147D35F90010BC06 /* WorkerConsoleAgent.h */,
                                F34742DE1343631F00531BC2 /* WorkerDebuggerAgent.cpp */,
                                7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */,
                                F3F5CF1312ED81B30084C569 /* InspectorDatabaseInstrumentation.h in Headers */,
                                41F062140F5F192600A07EAC /* InspectorDatabaseResource.h in Headers */,
-                               F33F053E120B0DA500E5743A /* InspectorDebuggerAgent.h in Headers */,
                                7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */,
                                5164ED44183208C700EA8FF1 /* IDBServerConnectionLevelDB.h in Headers */,
                                F3D4C47912E07663003DA150 /* InspectorDOMDebuggerAgent.h in Headers */,
                                14115B5209F84B7100CA4FC1 /* Node.h in Headers */,
                                854FE7310A2297BE0058D7AD /* NodeFilter.h in Headers */,
                                854FE7330A2297BE0058D7AD /* NodeFilterCondition.h in Headers */,
+                               A5E616741894581F009ADF50 /* WebDebuggerAgent.h in Headers */,
                                854FE7350A2297BE0058D7AD /* NodeIterator.h in Headers */,
                                A818721B0977D3C0005826D9 /* NodeList.h in Headers */,
                                63189AE30E83A33300012E41 /* NodeRareData.h in Headers */,
                                078E090B17D14CEE00420AA1 /* RTCPeerConnection.cpp in Sources */,
                                84730D7C1248F0B300D3A9C9 /* FEDisplacementMap.cpp in Sources */,
                                4358E8801360A31700E4748C /* FEDropShadow.cpp in Sources */,
+                               A5E616731894581F009ADF50 /* WebDebuggerAgent.cpp in Sources */,
                                51D719F9181106E00016DC51 /* PageGroupIndexedDatabase.cpp in Sources */,
                                84730D7E1248F0B300D3A9C9 /* FEFlood.cpp in Sources */,
                                84801954108BAFB300CB2B1F /* FEGaussianBlur.cpp in Sources */,
                                4A9CC82016BF9BB400EC645A /* InspectorCSSOMWrappers.cpp in Sources */,
                                7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */,
                                41F062150F5F192600A07EAC /* InspectorDatabaseResource.cpp in Sources */,
-                               F33F053D120B0DA500E5743A /* InspectorDebuggerAgent.cpp in Sources */,
                                7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */,
                                0FC4E40F187F82E10045882C /* ScrollingTreeIOS.cpp in Sources */,
                                F3D4C47812E07663003DA150 /* InspectorDOMDebuggerAgent.cpp in Sources */,
index 06c0e00..f725223 100644 (file)
@@ -44,7 +44,6 @@
 #include "InspectorDOMStorageAgent.cpp"
 #include "InspectorDatabaseAgent.cpp"
 #include "InspectorDatabaseResource.cpp"
-#include "InspectorDebuggerAgent.cpp"
 #include "InspectorFrontendClientLocal.cpp"
 #include "InspectorFrontendHost.cpp"
 #include "InspectorHeapProfilerAgent.cpp"
@@ -75,6 +74,7 @@
 #include "ScriptCallFrame.cpp"
 #include "ScriptCallStack.cpp"
 #include "TimelineRecordFactory.cpp"
+#include "WebDebuggerAgent.cpp"
 #include "WorkerConsoleAgent.cpp"
 #include "WorkerDebuggerAgent.cpp"
 #include "WorkerInspectorController.cpp"
index 4ff135e..431baad 100644 (file)
@@ -45,7 +45,6 @@
 #include "InspectorDOMDebuggerAgent.h"
 #include "InspectorDOMStorageAgent.h"
 #include "InspectorDatabaseAgent.h"
-#include "InspectorDebuggerAgent.h"
 #include "InspectorFrontendClient.h"
 #include "InspectorHeapProfilerAgent.h"
 #include "InspectorIndexedDBAgent.h"
@@ -147,7 +146,7 @@ InspectorController::InspectorController(Page& page, InspectorClient* inspectorC
     m_agents.append(std::move(consoleAgentPtr));
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get(), m_overlay.get());
+    auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(m_injectedScriptManager.get(), m_instrumentingAgents.get(), pageAgent, m_overlay.get());
     m_debuggerAgent = debuggerAgentPtr.get();
     m_agents.append(std::move(debuggerAgentPtr));
 
index 405e693..81ef816 100644 (file)
 
 namespace Inspector {
 class InspectorAgent;
-class InspectorObject;
-class InspectorFrontendChannel;
 class InspectorBackendDispatcher;
+class InspectorDebuggerAgent;
+class InspectorFrontendChannel;
+class InspectorObject;
 }
 
 namespace WebCore {
@@ -58,7 +59,6 @@ class InspectorApplicationCacheAgent;
 class InspectorClient;
 class InspectorDOMAgent;
 class InspectorDOMDebuggerAgent;
-class InspectorDebuggerAgent;
 class InspectorFrontendClient;
 class InspectorMemoryAgent;
 class InspectorOverlay;
@@ -156,7 +156,7 @@ private:
     InspectorPageAgent* m_pageAgent;
     InspectorMemoryAgent* m_memoryAgent;
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    InspectorDebuggerAgent* m_debuggerAgent;
+    Inspector::InspectorDebuggerAgent* m_debuggerAgent;
     InspectorDOMDebuggerAgent* m_domDebuggerAgent;
     InspectorProfilerAgent* m_profilerAgent;
 #endif
index 97b291d..7cc8ebe 100644 (file)
  */
 
 #include "config.h"
+#include "InspectorDOMDebuggerAgent.h"
 
 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
 
-#include "InspectorDOMDebuggerAgent.h"
-
 #include "HTMLElement.h"
 #include "InspectorDOMAgent.h"
-#include "InspectorDebuggerAgent.h"
 #include "InspectorInstrumentation.h"
 #include "InspectorWebFrontendDispatchers.h"
 #include "InstrumentingAgents.h"
index c32378c..4dd792c 100644 (file)
@@ -33,9 +33,9 @@
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
 
-#include "InspectorDebuggerAgent.h"
 #include "InspectorWebAgentBase.h"
 #include "InspectorWebBackendDispatchers.h"
+#include <inspector/agents/InspectorDebuggerAgent.h>
 #include <wtf/HashMap.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
@@ -49,16 +49,15 @@ namespace WebCore {
 
 class Element;
 class InspectorDOMAgent;
-class InspectorDebuggerAgent;
 class InstrumentingAgents;
 class Node;
 
 typedef String ErrorString;
 
-class InspectorDOMDebuggerAgent : public InspectorAgentBase, public InspectorDebuggerAgent::Listener, public Inspector::InspectorDOMDebuggerBackendDispatcherHandler {
+class InspectorDOMDebuggerAgent : public InspectorAgentBase, public Inspector::InspectorDebuggerAgent::Listener, public Inspector::InspectorDOMDebuggerBackendDispatcherHandler {
     WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent);
 public:
-    InspectorDOMDebuggerAgent(InstrumentingAgents*, InspectorDOMAgent*, InspectorDebuggerAgent*);
+    InspectorDOMDebuggerAgent(InstrumentingAgents*, InspectorDOMAgent*, Inspector::InspectorDebuggerAgent*);
     virtual ~InspectorDOMDebuggerAgent();
 
     // DOMDebugger API
@@ -86,7 +85,7 @@ public:
     virtual void discardAgent() override;
 
 private:
-    // InspectorDebuggerAgent::Listener implementation.
+    // Inspector::InspectorDebuggerAgent::Listener implementation.
     virtual void debuggerWasEnabled() override;
     virtual void debuggerWasDisabled() override;
     virtual void stepInto() override;
@@ -103,7 +102,7 @@ private:
     void clear();
 
     InspectorDOMAgent* m_domAgent;
-    InspectorDebuggerAgent* m_debuggerAgent;
+    Inspector::InspectorDebuggerAgent* m_debuggerAgent;
     RefPtr<Inspector::InspectorDOMDebuggerBackendDispatcher> m_backendDispatcher;
     HashMap<Node*, uint32_t> m_domBreakpoints;
     HashSet<String> m_eventListenerBreakpoints;
index 803ca4d..f465f41 100644 (file)
 */
 
 #include "config.h"
+#include "InspectorInstrumentation.h"
 
 #if ENABLE(INSPECTOR)
 
-#include "InspectorInstrumentation.h"
-
 #include "CSSRule.h"
 #include "CSSStyleRule.h"
 #include "ConsoleAPITypes.h"
@@ -52,7 +51,6 @@
 #include "InspectorDOMDebuggerAgent.h"
 #include "InspectorDOMStorageAgent.h"
 #include "InspectorDatabaseAgent.h"
-#include "InspectorDebuggerAgent.h"
 #include "InspectorHeapProfilerAgent.h"
 #include "InspectorLayerTreeAgent.h"
 #include "InspectorPageAgent.h"
@@ -76,6 +74,7 @@
 #include "WorkerRuntimeAgent.h"
 #include "WorkerThread.h"
 #include "XMLHttpRequest.h"
+#include <inspector/agents/InspectorDebuggerAgent.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 
@@ -884,14 +883,23 @@ void InspectorInstrumentation::didWriteHTMLImpl(const InspectorInstrumentationCo
         timelineAgent->didWriteHTML(endLine);
 }
 
+// JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
+static bool isConsoleAssertMessage(MessageSource source, MessageType type)
+{
+    return source == ConsoleAPIMessageSource && type == AssertMessageType;
+}
+
 // FIXME: Drop this once we no longer generate stacks outside of Inspector.
 void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
 {
     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
         consoleAgent->addMessageToConsole(source, type, level, message, callStack, requestIdentifier);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
-        debuggerAgent->addMessageToConsole(source, type);
+    // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
+        if (isConsoleAssertMessage(source, type))
+            debuggerAgent->handleConsoleAssert();
+    }
 #endif
 }
 
@@ -900,8 +908,11 @@ void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* inst
     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
         consoleAgent->addMessageToConsole(source, type, level, message, state, arguments, requestIdentifier);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
-        debuggerAgent->addMessageToConsole(source, type);
+    // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
+        if (isConsoleAssertMessage(source, type))
+            debuggerAgent->handleConsoleAssert();
+    }
 #endif
 }
 
index b5c8c85..afabce6 100644 (file)
@@ -39,6 +39,7 @@
 
 namespace Inspector {
 class InspectorAgent;
+class InspectorDebuggerAgent;
 }
 
 namespace WebCore {
@@ -51,7 +52,6 @@ class InspectorDOMAgent;
 class InspectorDOMDebuggerAgent;
 class InspectorDOMStorageAgent;
 class InspectorDatabaseAgent;
-class InspectorDebuggerAgent;
 class InspectorHeapProfilerAgent;
 class InspectorLayerTreeAgent;
 class InspectorPageAgent;
@@ -117,8 +117,8 @@ public:
     void setInspectorApplicationCacheAgent(InspectorApplicationCacheAgent* agent) { m_inspectorApplicationCacheAgent = agent; }
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    InspectorDebuggerAgent* inspectorDebuggerAgent() const { return m_inspectorDebuggerAgent; }
-    void setInspectorDebuggerAgent(InspectorDebuggerAgent* agent) { m_inspectorDebuggerAgent = agent; }
+    Inspector::InspectorDebuggerAgent* inspectorDebuggerAgent() const { return m_inspectorDebuggerAgent; }
+    void setInspectorDebuggerAgent(Inspector::InspectorDebuggerAgent* agent) { m_inspectorDebuggerAgent = agent; }
 
     PageDebuggerAgent* pageDebuggerAgent() const { return m_pageDebuggerAgent; }
     void setPageDebuggerAgent(PageDebuggerAgent* agent) { m_pageDebuggerAgent = agent; }
@@ -167,7 +167,7 @@ private:
 #endif
     InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent;
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    InspectorDebuggerAgent* m_inspectorDebuggerAgent;
+    Inspector::InspectorDebuggerAgent* m_inspectorDebuggerAgent;
     PageDebuggerAgent* m_pageDebuggerAgent;
     InspectorDOMDebuggerAgent* m_inspectorDOMDebuggerAgent;
     InspectorProfilerAgent* m_inspectorProfilerAgent;
index d01585a..6b38f3a 100644 (file)
  */
 
 #include "config.h"
+#include "PageDebuggerAgent.h"
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
 
-#include "PageDebuggerAgent.h"
-
+#include "CachedResource.h"
 #include "InspectorOverlay.h"
 #include "InspectorPageAgent.h"
 #include "InstrumentingAgents.h"
@@ -48,29 +48,46 @@ using namespace Inspector;
 
 namespace WebCore {
 
-PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
-    : InspectorDebuggerAgent(instrumentingAgents, injectedScriptManager)
+PageDebuggerAgent::PageDebuggerAgent(InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorOverlay* overlay)
+    : WebDebuggerAgent(injectedScriptManager, instrumentingAgents)
     , m_pageAgent(pageAgent)
     , m_overlay(overlay)
 {
 }
 
-PageDebuggerAgent::~PageDebuggerAgent()
-{
-}
-
 void PageDebuggerAgent::enable()
 {
-    InspectorDebuggerAgent::enable();
+    WebDebuggerAgent::enable();
     m_instrumentingAgents->setPageDebuggerAgent(this);
 }
 
 void PageDebuggerAgent::disable(bool isBeingDestroyed)
 {
-    InspectorDebuggerAgent::disable(isBeingDestroyed);
+    WebDebuggerAgent::disable(isBeingDestroyed);
     m_instrumentingAgents->setPageDebuggerAgent(nullptr);
 }
 
+String PageDebuggerAgent::sourceMapURLForScript(const Script& script)
+{
+    DEFINE_STATIC_LOCAL(String, sourceMapHTTPHeader, (ASCIILiteral("SourceMap")));
+    DEFINE_STATIC_LOCAL(String, sourceMapHTTPHeaderDeprecated, (ASCIILiteral("X-SourceMap")));
+
+    if (!script.url.isEmpty()) {
+        CachedResource* resource = m_pageAgent->cachedResource(m_pageAgent->mainFrame(), URL(ParsedURLString, script.url));
+        if (resource) {
+            String sourceMapHeader = resource->response().httpHeaderField(sourceMapHTTPHeader);
+            if (!sourceMapHeader.isEmpty())
+                return sourceMapHeader;
+
+            sourceMapHeader = resource->response().httpHeaderField(sourceMapHTTPHeaderDeprecated);
+            if (!sourceMapHeader.isEmpty())
+                return sourceMapHeader;
+        }
+    }
+
+    return InspectorDebuggerAgent::sourceMapURLForScript(script);
+}
+
 void PageDebuggerAgent::startListeningScriptDebugServer()
 {
     scriptDebugServer().addListener(this, m_pageAgent->page());
@@ -107,9 +124,11 @@ InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
         JSC::ExecState* scriptState = mainWorldExecState(m_pageAgent->mainFrame());
         return injectedScriptManager()->injectedScriptFor(scriptState);
     }
+
     InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId(*executionContextId);
     if (injectedScript.hasNoValue())
-        *errorString = "Execution context with given id not found.";
+        *errorString = ASCIILiteral("Execution context with given id not found.");
+
     return injectedScript;
 }
 
index bbaf3d5..01e3ad9 100644 (file)
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
 
-#include "InspectorDebuggerAgent.h"
 #include "PageScriptDebugServer.h"
+#include "WebDebuggerAgent.h"
 
 namespace WebCore {
 
 class InspectorOverlay;
 class InspectorPageAgent;
+class InstrumentingAgents;
 class Page;
 class PageScriptDebugServer;
 
-class PageDebuggerAgent final : public InspectorDebuggerAgent {
+class PageDebuggerAgent final : public WebDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PageDebuggerAgent(InstrumentingAgents*, InspectorPageAgent*, Inspector::InjectedScriptManager*, InspectorOverlay*);
-    virtual ~PageDebuggerAgent();
+    PageDebuggerAgent(Inspector::InjectedScriptManager*, InstrumentingAgents*, InspectorPageAgent*, InspectorOverlay*);
+    virtual ~PageDebuggerAgent() { }
 
     void didClearMainFrameWindowObject();
 
@@ -56,6 +57,8 @@ protected:
     virtual void enable() override;
     virtual void disable(bool isBeingDestroyed) override;
 
+    virtual String sourceMapURLForScript(const Script&) override;
+
 private:
     virtual void startListeningScriptDebugServer() override;
     virtual void stopListeningScriptDebugServer(bool isBeingDestroyed) override;
diff --git a/Source/WebCore/inspector/WebDebuggerAgent.cpp b/Source/WebCore/inspector/WebDebuggerAgent.cpp
new file mode 100644 (file)
index 0000000..92af5a2
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "config.h"
+#include "WebDebuggerAgent.h"
+
+#if ENABLE(INSPECTOR)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "InstrumentingAgents.h"
+
+using namespace Inspector;
+
+namespace WebCore {
+
+WebDebuggerAgent::WebDebuggerAgent(InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
+    : InspectorDebuggerAgent(injectedScriptManager)
+    , m_instrumentingAgents(instrumentingAgents)
+{
+}
+
+void WebDebuggerAgent::enable()
+{
+    InspectorDebuggerAgent::enable();
+    m_instrumentingAgents->setInspectorDebuggerAgent(this);
+}
+
+void WebDebuggerAgent::disable(bool isBeingDestroyed)
+{
+    InspectorDebuggerAgent::disable(isBeingDestroyed);
+    m_instrumentingAgents->setInspectorDebuggerAgent(nullptr);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/WebDebuggerAgent.h b/Source/WebCore/inspector/WebDebuggerAgent.h
new file mode 100644 (file)
index 0000000..5c6173f
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#ifndef WebDebuggerAgent_h
+#define WebDebuggerAgent_h
+
+#if ENABLE(INSPECTOR)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include <inspector/agents/InspectorDebuggerAgent.h>
+
+namespace WebCore {
+
+class InstrumentingAgents;
+typedef String ErrorString;
+
+class WebDebuggerAgent : public Inspector::InspectorDebuggerAgent {
+    WTF_MAKE_NONCOPYABLE(WebDebuggerAgent);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    WebDebuggerAgent(Inspector::InjectedScriptManager*, InstrumentingAgents*);
+    virtual ~WebDebuggerAgent() { }
+
+protected:
+    virtual void enable() override;
+    virtual void disable(bool isBeingDestroyed) override;
+
+    InstrumentingAgents* m_instrumentingAgents;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+#endif // ENABLE(INSPECTOR)
+
+#endif // !defined(WebDebuggerAgent_h)
index f4c4cf0..3a8bad5 100644 (file)
@@ -92,8 +92,8 @@ private:
 
 const char* WorkerDebuggerAgent::debuggerTaskMode = "debugger";
 
-WorkerDebuggerAgent::WorkerDebuggerAgent(InstrumentingAgents* instrumentingAgents, WorkerGlobalScope* inspectedWorkerGlobalScope, InjectedScriptManager* injectedScriptManager)
-    : InspectorDebuggerAgent(instrumentingAgents, injectedScriptManager)
+WorkerDebuggerAgent::WorkerDebuggerAgent(InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, WorkerGlobalScope* inspectedWorkerGlobalScope)
+    : WebDebuggerAgent(injectedScriptManager, instrumentingAgents)
     , m_scriptDebugServer(inspectedWorkerGlobalScope, WorkerDebuggerAgent::debuggerTaskMode)
     , m_inspectedWorkerGlobalScope(inspectedWorkerGlobalScope)
 {
@@ -140,9 +140,10 @@ WorkerScriptDebugServer& WorkerDebuggerAgent::scriptDebugServer()
 InjectedScript WorkerDebuggerAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId)
 {
     if (executionContextId) {
-        *error = "Execution context id is not supported for workers as there is only one execution context.";
+        *error = ASCIILiteral("Execution context id is not supported for workers as there is only one execution context.");
         return InjectedScript();
     }
+
     JSC::ExecState* scriptState = execStateFromWorkerGlobalScope(m_inspectedWorkerGlobalScope);
     return injectedScriptManager()->injectedScriptFor(scriptState);
 }
index 08b032b..b086096 100644 (file)
@@ -32,7 +32,8 @@
 #define WorkerDebuggerAgent_h
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
-#include "InspectorDebuggerAgent.h"
+
+#include "WebDebuggerAgent.h"
 #include "WorkerScriptDebugServer.h"
 
 namespace WebCore {
@@ -40,11 +41,11 @@ namespace WebCore {
 class WorkerGlobalScope;
 class WorkerThread;
 
-class WorkerDebuggerAgent final : public InspectorDebuggerAgent {
+class WorkerDebuggerAgent final : public WebDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(WorkerDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WorkerDebuggerAgent(InstrumentingAgents*, WorkerGlobalScope*, Inspector::InjectedScriptManager*);
+    WorkerDebuggerAgent(Inspector::InjectedScriptManager*, InstrumentingAgents*, WorkerGlobalScope*);
     virtual ~WorkerDebuggerAgent();
 
     static const char* debuggerTaskMode;
index 80891b6..21d39bd 100644 (file)
@@ -92,7 +92,7 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope& workerGl
 
     auto consoleAgent = std::make_unique<WorkerConsoleAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get());
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(m_instrumentingAgents.get(), &workerGlobalScope, m_injectedScriptManager.get());
+    auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(m_injectedScriptManager.get(), m_instrumentingAgents.get(), &workerGlobalScope);
     m_runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
     m_agents.append(std::move(debuggerAgent));