Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Mar 2014 19:33:51 +0000 (19:33 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Mar 2014 19:33:51 +0000 (19:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127944

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Always expose the Console object in JSContexts, just like we
do for web pages. The default behavior will route to an
attached JSContext inspector. This can be overriden by
setting the ConsoleClient on the JSGlobalObject, which WebCore
does to get slightly different behavior.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
Update build systems.

* API/tests/testapi.js:
* API/tests/testapi.mm:
Test that "console" exists in C and ObjC contexts.

* runtime/ConsoleClient.cpp: Added.
(JSC::ConsoleClient::printURLAndPosition):
(JSC::ConsoleClient::printMessagePrefix):
(JSC::ConsoleClient::printConsoleMessage):
(JSC::ConsoleClient::printConsoleMessageWithArguments):
(JSC::ConsoleClient::internalMessageWithTypeAndLevel):
(JSC::ConsoleClient::logWithLevel):
(JSC::ConsoleClient::clear):
(JSC::ConsoleClient::dir):
(JSC::ConsoleClient::dirXML):
(JSC::ConsoleClient::table):
(JSC::ConsoleClient::trace):
(JSC::ConsoleClient::assertCondition):
(JSC::ConsoleClient::group):
(JSC::ConsoleClient::groupCollapsed):
(JSC::ConsoleClient::groupEnd):
* runtime/ConsoleClient.h: Added.
(JSC::ConsoleClient::~ConsoleClient):
New private interface for handling the console object's methods.
A lot of the methods funnel through messageWithTypeAndLevel.

* runtime/ConsoleTypes.h: Renamed from Source/JavaScriptCore/inspector/ConsoleTypes.h.
Moved to JSC namespace.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
Create the "console" object when initializing the environment.
Also set the default console client to be the JS context inspector.

* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::setConsoleClient):
(JSC::JSGlobalObject::consoleClient):
Ability to change the console client, so WebCore can set a custom client.

* runtime/ConsolePrototype.cpp: Added.
(JSC::ConsolePrototype::finishCreation):
(JSC::valueToStringWithUndefinedOrNullCheck):
(JSC::consoleLogWithLevel):
(JSC::consoleProtoFuncDebug):
(JSC::consoleProtoFuncError):
(JSC::consoleProtoFuncLog):
(JSC::consoleProtoFuncWarn):
(JSC::consoleProtoFuncClear):
(JSC::consoleProtoFuncDir):
(JSC::consoleProtoFuncDirXML):
(JSC::consoleProtoFuncTable):
(JSC::consoleProtoFuncTrace):
(JSC::consoleProtoFuncAssert):
(JSC::consoleProtoFuncCount):
(JSC::consoleProtoFuncProfile):
(JSC::consoleProtoFuncProfileEnd):
(JSC::consoleProtoFuncTime):
(JSC::consoleProtoFuncTimeEnd):
(JSC::consoleProtoFuncTimeStamp):
(JSC::consoleProtoFuncGroup):
(JSC::consoleProtoFuncGroupCollapsed):
(JSC::consoleProtoFuncGroupEnd):
* runtime/ConsolePrototype.h: Added.
(JSC::ConsolePrototype::create):
(JSC::ConsolePrototype::createStructure):
(JSC::ConsolePrototype::ConsolePrototype):
Define the console object interface. Parse out required / expected
arguments and throw expcetions when methods are misused.

* runtime/JSConsole.cpp: Added.
* runtime/JSConsole.h: Added.
(JSC::JSConsole::createStructure):
(JSC::JSConsole::create):
(JSC::JSConsole::JSConsole):
Empty "console" object. Everything is in the prototype.

* inspector/JSConsoleClient.cpp: Added.
(Inspector::JSConsoleClient::JSGlobalObjectConsole):
(Inspector::JSConsoleClient::count):
(Inspector::JSConsoleClient::profile):
(Inspector::JSConsoleClient::profileEnd):
(Inspector::JSConsoleClient::time):
(Inspector::JSConsoleClient::timeEnd):
(Inspector::JSConsoleClient::timeStamp):
(Inspector::JSConsoleClient::warnUnimplemented):
(Inspector::JSConsoleClient::internalAddMessage):
* inspector/JSConsoleClient.h: Added.
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::consoleClient):
* inspector/JSGlobalObjectInspectorController.h:
Default JSContext ConsoleClient implementation. Handle nearly
everything exception profile/profileEnd and timeStamp.

Source/WebCore:

Covered by existing tests.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* ForwardingHeaders/runtime/ConsoleClient.h: Added.
* ForwardingHeaders/runtime/ConsoleTypes.h: Renamed from Source/WebCore/ForwardingHeaders/inspector/ConsoleTypes.h.
* GNUmakefile.list.am:
* PlatformGTK.cmake:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/gobject/GNUmakefile.am:
Update build systems.

* page/Console.cpp: Removed.
* page/Console.h: Removed.
* page/Console.idl: Removed.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::~DOMWindow):
(WebCore::DOMWindow::resetDOMWindowProperties):
* page/DOMWindow.h:
(WebCore::DOMWindow::defaultStatus):
* page/DOMWindow.idl:
Removed the old IDL generated Console object on window.

* page/PageConsole.cpp:
(WebCore::PageConsole::shouldPrintExceptions):
(WebCore::PageConsole::setShouldPrintExceptions):
(WebCore::PageConsole::mute):
(WebCore::PageConsole::unmute):
(WebCore::PageConsole::messageWithTypeAndLevel):
(WebCore::PageConsole::count):
(WebCore::PageConsole::profile):
(WebCore::PageConsole::profileEnd):
(WebCore::PageConsole::time):
(WebCore::PageConsole::timeEnd):
(WebCore::PageConsole::timeStamp):
(WebCore::PageConsole::group):
(WebCore::PageConsole::groupCollapsed):
(WebCore::PageConsole::groupEnd):
(WebCore::PageConsole::clearProfiles):
* page/PageConsole.h:
Move the handling of Console object into PageConsole.

* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
(WebCore::ScriptCachedFrameData::restore):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::clearWindowShell):
(WebCore::ScriptController::initScript):
Set the PageConsole as the ConsoleClient of the JSGlobalObject
so that WebCore may handle console messages directly. For instance
it may pass messages on to the ChromeClient.

* testing/Internals.cpp:
(WebCore::Internals::consoleProfiles):
To access profiles, go through PageConsole now instead of Console.

* bindings/js/JSDOMWindowBase.cpp:
* bindings/objc/WebScriptObject.mm:
* css/MediaList.cpp:
* dom/ScriptExecutionContext.h:
* dom/UIEvent.cpp:
* dom/ViewportArguments.cpp:
* html/parser/XSSAuditorDelegate.cpp:
* inspector/CommandLineAPIHost.h:
* inspector/InspectorInstrumentation.cpp:
* inspector/InspectorInstrumentation.h:
* inspector/InspectorProfilerAgent.cpp:
* inspector/WebConsoleAgent.cpp:
* loader/FrameLoader.cpp:
* loader/MixedContentChecker.cpp:
* loader/appcache/ApplicationCacheGroup.cpp:
* loader/cache/CachedResourceLoader.cpp:
* page/ChromeClient.h:
* page/ContentSecurityPolicy.cpp:
* page/Page.cpp:
* page/Page.h:
* svg/SVGDocumentExtensions.cpp:
* workers/WorkerMessagingProxy.cpp:
* workers/WorkerReportingProxy.h:
Update includes.

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::addMessageToConsole):
Update namespaces.

Source/WebKit/mac:

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
Update namespaces.

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.h:
Update namespaces.

Source/WebKit/wince:

* WebCoreSupport/ChromeClientWinCE.h:
Update namespaces.

Source/WebKit2:

* WebProcess/WebCoreSupport/WebChromeClient.h:
Update namespaces.

LayoutTests:

* http/tests/security/cross-frame-access-getOwnPropertyDescriptor-expected.txt:

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

87 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/security/cross-frame-access-getOwnPropertyDescriptor-expected.txt
Source/JavaScriptCore/API/tests/testapi.js
Source/JavaScriptCore/API/tests/testapi.mm
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/JSConsoleClient.cpp [new file with mode: 0644]
Source/JavaScriptCore/inspector/JSConsoleClient.h [new file with mode: 0644]
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
Source/JavaScriptCore/runtime/ConsoleClient.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/ConsoleClient.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/ConsolePrototype.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/ConsolePrototype.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/ConsoleTypes.h [moved from Source/JavaScriptCore/inspector/ConsoleTypes.h with 90% similarity]
Source/JavaScriptCore/runtime/JSConsole.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSConsole.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/ForwardingHeaders/runtime/ConsoleClient.h [new file with mode: 0644]
Source/WebCore/ForwardingHeaders/runtime/ConsoleTypes.h [moved from Source/WebCore/ForwardingHeaders/inspector/ConsoleTypes.h with 100% similarity]
Source/WebCore/GNUmakefile.list.am
Source/WebCore/PlatformGTK.cmake
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/gobject/GNUmakefile.am
Source/WebCore/bindings/gobject/WebKitDOMDeprecated.cpp
Source/WebCore/bindings/gobject/WebKitDOMDeprecated.h
Source/WebCore/bindings/gobject/WebKitDOMDeprecated.symbols
Source/WebCore/bindings/gobject/webkitdom.symbols
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/objc/WebScriptObject.mm
Source/WebCore/css/MediaList.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/dom/UIEvent.cpp
Source/WebCore/dom/ViewportArguments.cpp
Source/WebCore/html/parser/XSSAuditorDelegate.cpp
Source/WebCore/inspector/CommandLineAPIHost.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorProfilerAgent.cpp
Source/WebCore/inspector/WebConsoleAgent.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/MixedContentChecker.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/Console.cpp [deleted file]
Source/WebCore/page/Console.h [deleted file]
Source/WebCore/page/Console.idl [deleted file]
Source/WebCore/page/ContentSecurityPolicy.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindow.idl
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/PageConsole.cpp
Source/WebCore/page/PageConsole.h
Source/WebCore/svg/SVGDocumentExtensions.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/workers/WorkerMessagingProxy.cpp
Source/WebCore/workers/WorkerReportingProxy.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/win/WebCoreSupport/WebChromeClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

index 7c4d7b7..8438fba 100644 (file)
@@ -1,3 +1,12 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        * http/tests/security/cross-frame-access-getOwnPropertyDescriptor-expected.txt:
+
 2014-03-06  Brendan Long  <b.long@cablelabs.com>
 
         Implement VideoTrackList.selectedIndex
index bdd60bf..dd7d84a 100644 (file)
@@ -52,6 +52,7 @@ CONSOLE MESSAGE: Blocked a frame with origin "http://127.0.0.1:8000" from access
 CONSOLE MESSAGE: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
 CONSOLE MESSAGE: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
 CONSOLE MESSAGE: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
 This test checks cross-frame access security of getOwnPropertyDescriptor (https://bugs.webkit.org/show_bug.cgi?id=32119).
 
 
index 47c20a8..410fc45 100644 (file)
@@ -20,7 +20,7 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 function bludgeonArguments() { if (0) arguments; return function g() {} }
@@ -253,6 +253,9 @@ shouldThrow("EvilExceptionObject*5");
 EvilExceptionObject.toStringExplicit = function f() { return f(); }
 shouldThrow("String(EvilExceptionObject)");
 
+shouldBe("console", "[object Console]");
+shouldBe("typeof console.log", "function");
+
 shouldBe("EmptyObject", "[object CallbackObject]");
 
 for (var i = 0; i < 6; ++i)
index f778bfe..1a09d54 100644 (file)
@@ -763,6 +763,14 @@ void testObjectiveCAPI()
 
     @autoreleasepool {
         JSContext *context = [[JSContext alloc] init];
+        JSValue *result = [context evaluateScript:@"String(console)"];
+        checkResult(@"String(console)", [result isEqualToObject:@"[object Console]"]);
+        result = [context evaluateScript:@"typeof console.log"];
+        checkResult(@"typeof console.log", [result isEqualToObject:@"function"]);
+    }
+
+    @autoreleasepool {
+        JSContext *context = [[JSContext alloc] init];
         TestObject* testObject = [TestObject testObject];
         context[@"testObject"] = testObject;
         JSValue *result = [context evaluateScript:@"String(testObject)"];
index 31fb852..9a609e6 100644 (file)
@@ -352,6 +352,8 @@ set(JavaScriptCore_SOURCES
     runtime/CommonSlowPathsExceptions.cpp
     runtime/CompilationResult.cpp
     runtime/Completion.cpp
+    runtime/ConsoleClient.cpp
+    runtime/ConsolePrototype.cpp
     runtime/ConstructData.cpp
     runtime/DataView.cpp
     runtime/DataView.h
@@ -389,6 +391,7 @@ set(JavaScriptCore_SOURCES
     runtime/JSBoundFunction.cpp
     runtime/JSCJSValue.cpp
     runtime/JSCell.cpp
+    runtime/JSConsole.cpp
     runtime/JSDataView.cpp
     runtime/JSDataViewPrototype.cpp
     runtime/JSDateMath.cpp
index 7f5ec80..00a614a 100644 (file)
@@ -1,3 +1,119 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        Always expose the Console object in JSContexts, just like we
+        do for web pages. The default behavior will route to an
+        attached JSContext inspector. This can be overriden by
+        setting the ConsoleClient on the JSGlobalObject, which WebCore
+        does to get slightly different behavior.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        Update build systems.
+
+        * API/tests/testapi.js:
+        * API/tests/testapi.mm:
+        Test that "console" exists in C and ObjC contexts.
+
+        * runtime/ConsoleClient.cpp: Added.
+        (JSC::ConsoleClient::printURLAndPosition):
+        (JSC::ConsoleClient::printMessagePrefix):
+        (JSC::ConsoleClient::printConsoleMessage):
+        (JSC::ConsoleClient::printConsoleMessageWithArguments):
+        (JSC::ConsoleClient::internalMessageWithTypeAndLevel):
+        (JSC::ConsoleClient::logWithLevel):
+        (JSC::ConsoleClient::clear):
+        (JSC::ConsoleClient::dir):
+        (JSC::ConsoleClient::dirXML):
+        (JSC::ConsoleClient::table):
+        (JSC::ConsoleClient::trace):
+        (JSC::ConsoleClient::assertCondition):
+        (JSC::ConsoleClient::group):
+        (JSC::ConsoleClient::groupCollapsed):
+        (JSC::ConsoleClient::groupEnd):
+        * runtime/ConsoleClient.h: Added.
+        (JSC::ConsoleClient::~ConsoleClient):
+        New private interface for handling the console object's methods.
+        A lot of the methods funnel through messageWithTypeAndLevel.
+
+        * runtime/ConsoleTypes.h: Renamed from Source/JavaScriptCore/inspector/ConsoleTypes.h.
+        Moved to JSC namespace.
+
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::JSGlobalObject):
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::reset):
+        (JSC::JSGlobalObject::visitChildren):
+        Create the "console" object when initializing the environment.
+        Also set the default console client to be the JS context inspector.
+
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::setConsoleClient):
+        (JSC::JSGlobalObject::consoleClient):
+        Ability to change the console client, so WebCore can set a custom client.
+
+        * runtime/ConsolePrototype.cpp: Added.
+        (JSC::ConsolePrototype::finishCreation):
+        (JSC::valueToStringWithUndefinedOrNullCheck):
+        (JSC::consoleLogWithLevel):
+        (JSC::consoleProtoFuncDebug):
+        (JSC::consoleProtoFuncError):
+        (JSC::consoleProtoFuncLog):
+        (JSC::consoleProtoFuncWarn):
+        (JSC::consoleProtoFuncClear):
+        (JSC::consoleProtoFuncDir):
+        (JSC::consoleProtoFuncDirXML):
+        (JSC::consoleProtoFuncTable):
+        (JSC::consoleProtoFuncTrace):
+        (JSC::consoleProtoFuncAssert):
+        (JSC::consoleProtoFuncCount):
+        (JSC::consoleProtoFuncProfile):
+        (JSC::consoleProtoFuncProfileEnd):
+        (JSC::consoleProtoFuncTime):
+        (JSC::consoleProtoFuncTimeEnd):
+        (JSC::consoleProtoFuncTimeStamp):
+        (JSC::consoleProtoFuncGroup):
+        (JSC::consoleProtoFuncGroupCollapsed):
+        (JSC::consoleProtoFuncGroupEnd):
+        * runtime/ConsolePrototype.h: Added.
+        (JSC::ConsolePrototype::create):
+        (JSC::ConsolePrototype::createStructure):
+        (JSC::ConsolePrototype::ConsolePrototype):
+        Define the console object interface. Parse out required / expected
+        arguments and throw expcetions when methods are misused.
+
+        * runtime/JSConsole.cpp: Added.
+        * runtime/JSConsole.h: Added.
+        (JSC::JSConsole::createStructure):
+        (JSC::JSConsole::create):
+        (JSC::JSConsole::JSConsole):
+        Empty "console" object. Everything is in the prototype.
+
+        * inspector/JSConsoleClient.cpp: Added.
+        (Inspector::JSConsoleClient::JSGlobalObjectConsole):
+        (Inspector::JSConsoleClient::count):
+        (Inspector::JSConsoleClient::profile):
+        (Inspector::JSConsoleClient::profileEnd):
+        (Inspector::JSConsoleClient::time):
+        (Inspector::JSConsoleClient::timeEnd):
+        (Inspector::JSConsoleClient::timeStamp):
+        (Inspector::JSConsoleClient::warnUnimplemented):
+        (Inspector::JSConsoleClient::internalAddMessage):
+        * inspector/JSConsoleClient.h: Added.
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        (Inspector::JSGlobalObjectInspectorController::consoleClient):
+        * inspector/JSGlobalObjectInspectorController.h:
+        Default JSContext ConsoleClient implementation. Handle nearly
+        everything exception profile/profileEnd and timeStamp.
+
 2014-03-06  Andreas Kling  <akling@apple.com>
 
         Drop unlinked function code on memory pressure.
index 5b83a4f..9745c00 100644 (file)
@@ -677,7 +677,6 @@ javascriptcore_sources += \
        Source/JavaScriptCore/icu/unicode/uversion.h \
        Source/JavaScriptCore/inspector/ConsoleMessage.cpp \
        Source/JavaScriptCore/inspector/ConsoleMessage.h \
-       Source/JavaScriptCore/inspector/ConsoleTypes.h \
        Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp \
        Source/JavaScriptCore/inspector/ContentSearchUtilities.h \
        Source/JavaScriptCore/inspector/IdentifiersFactory.cpp \
@@ -942,6 +941,11 @@ javascriptcore_sources += \
        Source/JavaScriptCore/runtime/CodeCache.h \
        Source/JavaScriptCore/runtime/CodeSpecializationKind.cpp \
        Source/JavaScriptCore/runtime/CodeSpecializationKind.h \
+       Source/JavaScriptCore/runtime/ConsoleClient.cpp \
+       Source/JavaScriptCore/runtime/ConsoleClient.h \
+       Source/JavaScriptCore/runtime/ConsolePrototype.cpp \
+       Source/JavaScriptCore/runtime/ConsolePrototype.h \
+       Source/JavaScriptCore/runtime/ConsoleTypes.h \
        Source/JavaScriptCore/runtime/CommonIdentifiers.cpp \
        Source/JavaScriptCore/runtime/CommonIdentifiers.h \
        Source/JavaScriptCore/runtime/CommonSlowPathsExceptions.cpp \
@@ -1035,6 +1039,8 @@ javascriptcore_sources += \
     Source/JavaScriptCore/runtime/JSArrayIterator.h \
        Source/JavaScriptCore/runtime/JSCell.cpp \
        Source/JavaScriptCore/runtime/JSCell.h \
+       Source/JavaScriptCore/runtime/JSConsole.cpp \
+       Source/JavaScriptCore/runtime/JSConsole.h \
        Source/JavaScriptCore/runtime/JSDataView.cpp \
        Source/JavaScriptCore/runtime/JSDataView.h \
        Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp \
index ec0e415..b183043 100644 (file)
     <ClCompile Include="..\runtime\CommonSlowPathsExceptions.cpp" />
     <ClCompile Include="..\runtime\CompilationResult.cpp" />
     <ClCompile Include="..\runtime\Completion.cpp" />
+    <ClCompile Include="..\runtime\ConsoleClient.cpp" />
+    <ClCompile Include="..\runtime\ConsolePrototype.cpp" />
     <ClCompile Include="..\runtime\ConstructData.cpp" />
     <ClCompile Include="..\runtime\DataView.cpp" />
     <ClCompile Include="..\runtime\DateConstructor.cpp" />
     <ClCompile Include="..\runtime\JSBoundFunction.cpp" />
     <ClCompile Include="..\runtime\JSCJSValue.cpp" />
     <ClCompile Include="..\runtime\JSCell.cpp" />
+    <ClCompile Include="..\runtime\JSConsole.cpp" />
     <ClCompile Include="..\runtime\JSDataView.cpp" />
     <ClCompile Include="..\runtime\JSDataViewPrototype.cpp" />
     <ClCompile Include="..\runtime\JSDateMath.cpp" />
     <ClInclude Include="..\heap\WriteBarrierBuffer.h" />
     <ClInclude Include="..\heap\WriteBarrierSupport.h" />
     <ClInclude Include="..\inspector\ConsoleMessage.h" />
-    <ClInclude Include="..\inspector\ConsoleTypes.h" />
     <ClInclude Include="..\inspector\ContentSearchUtilities.h" />
     <ClInclude Include="..\inspector\IdentifiersFactory.h" />
     <ClInclude Include="..\inspector\InjectedScript.h" />
     <ClInclude Include="..\runtime\CommonSlowPathsExceptions.h" />
     <ClInclude Include="..\runtime\CompilationResult.h" />
     <ClInclude Include="..\runtime\Completion.h" />
+    <ClInclude Include="..\runtime\ConsoleClient.h" />
+    <ClInclude Include="..\runtime\ConsolePrototype.h" />
+    <ClInclude Include="..\runtime\ConsoleTypes.h" />
     <ClInclude Include="..\runtime\ConstantMode.h" />
     <ClInclude Include="..\runtime\ConstructData.h" />
     <ClInclude Include="..\runtime\DataView.h" />
     <ClInclude Include="..\runtime\JSCJSValue.h" />
     <ClInclude Include="..\runtime\JSCJSValueInlines.h" />
     <ClInclude Include="..\runtime\JSCell.h" />
+    <ClInclude Include="..\runtime\JSConsole.h" />
     <ClInclude Include="..\runtime\JSDataView.h" />
     <ClInclude Include="..\runtime\JSDataViewPrototype.h" />
     <ClInclude Include="..\runtime\JSDateMath.h" />
index 3e00e20..f40037a 100644 (file)
     <ClCompile Include="..\runtime\Completion.cpp">
       <Filter>runtime</Filter>
     </ClCompile>
+    <ClCompile Include="..\runtime\ConsoleClient.cpp">
+      <Filter>runtime</Filter>
+    </ClCompile>
+    <ClCompile Include="..\runtime\ConsolePrototype.cpp">
+      <Filter>runtime</Filter>
+    </ClCompile>
     <ClCompile Include="..\runtime\ConstructData.cpp">
       <Filter>runtime</Filter>
     </ClCompile>
     <ClCompile Include="..\runtime\JSCell.cpp">
       <Filter>runtime</Filter>
     </ClCompile>
+    <ClCompile Include="..\runtime\JSConsole.cpp">
+      <Filter>runtime</Filter>
+    </ClCompile>
     <ClCompile Include="..\runtime\JSDateMath.cpp">
       <Filter>runtime</Filter>
     </ClCompile>
     <ClInclude Include="..\runtime\Completion.h">
       <Filter>runtime</Filter>
     </ClInclude>
+    <ClInclude Include="..\runtime\ConsoleClient.h">
+      <Filter>runtime</Filter>
+    </ClInclude>
+    <ClInclude Include="..\runtime\ConsolePrototype.h">
+      <Filter>runtime</Filter>
+    </ClInclude>
+    <ClInclude Include="..\runtime\ConsoleTypes.h">
+      <Filter>runtime</Filter>
+    </ClInclude>
     <ClInclude Include="..\runtime\ConstructData.h">
       <Filter>runtime</Filter>
     </ClInclude>
     <ClInclude Include="..\runtime\JSCell.h">
       <Filter>runtime</Filter>
     </ClInclude>
+    <ClInclude Include="..\runtime\JSConsole.h">
+      <Filter>runtime</Filter>
+    </ClInclude>
     <ClInclude Include="..\runtime\JSDateMath.h">
       <Filter>runtime</Filter>
     </ClInclude>
index 752df15..b070f74 100644 (file)
                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, ); }; };
+               A53CE08518BC1A5600BEDF76 /* ConsolePrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A53CE08118BC1A5600BEDF76 /* ConsolePrototype.cpp */; };
+               A53CE08618BC1A5600BEDF76 /* ConsolePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = A53CE08218BC1A5600BEDF76 /* ConsolePrototype.h */; };
+               A53CE08718BC1A5600BEDF76 /* JSConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A53CE08318BC1A5600BEDF76 /* JSConsole.cpp */; };
+               A53CE08818BC1A5600BEDF76 /* JSConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = A53CE08418BC1A5600BEDF76 /* JSConsole.h */; };
+               A53CE08A18BC21C300BEDF76 /* ConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A53CE08918BC21C300BEDF76 /* ConsoleClient.h */; 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 */; };
                A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */; };
                A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */; };
                A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A5B6A74D18C6DBA600F11E91 /* ConsoleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5B6A74C18C6DBA600F11E91 /* ConsoleClient.cpp */; };
                A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E1182340B300A82E69 /* RemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E2182340B300A82E69 /* RemoteInspector.mm */; };
                A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */; };
                A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A5C3A1A518C0490200C9593A /* JSConsoleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5C3A1A318C0490200C9593A /* JSConsoleClient.cpp */; };
+               A5C3A1A618C0490200C9593A /* JSConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C3A1A418C0490200C9593A /* JSConsoleClient.h */; };
                A5CEEE14187F3BAD00E55C99 /* InspectorAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */; };
                A5D0A1BB1862301B00C7B496 /* InspectorEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D0A1BA1862301B00C7B496 /* InspectorEnvironment.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5FD0067189AFE9C00633231 /* ScriptArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5FD0065189AFE9C00633231 /* ScriptArguments.cpp */; };
                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>"; };
+               A53CE08118BC1A5600BEDF76 /* ConsolePrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsolePrototype.cpp; sourceTree = "<group>"; };
+               A53CE08218BC1A5600BEDF76 /* ConsolePrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsolePrototype.h; sourceTree = "<group>"; };
+               A53CE08318BC1A5600BEDF76 /* JSConsole.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsole.cpp; sourceTree = "<group>"; };
+               A53CE08418BC1A5600BEDF76 /* JSConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSConsole.h; sourceTree = "<group>"; };
+               A53CE08918BC21C300BEDF76 /* ConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleClient.h; 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>"; };
                A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectDebuggable.cpp; sourceTree = "<group>"; };
                A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectDebuggable.h; sourceTree = "<group>"; };
                A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendChannel.h; sourceTree = "<group>"; };
+               A5B6A74C18C6DBA600F11E91 /* ConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleClient.cpp; sourceTree = "<group>"; };
                A5BA15E1182340B300A82E69 /* RemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspector.h; sourceTree = "<group>"; };
                A5BA15E2182340B300A82E69 /* RemoteInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspector.mm; sourceTree = "<group>"; };
                A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorConstants.h; sourceTree = "<group>"; };
                A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorXPCConnection.h; sourceTree = "<group>"; };
                A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspectorXPCConnection.mm; sourceTree = "<group>"; };
                A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorDebuggable.h; sourceTree = "<group>"; };
+               A5C3A1A318C0490200C9593A /* JSConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsoleClient.cpp; sourceTree = "<group>"; };
+               A5C3A1A418C0490200C9593A /* JSConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSConsoleClient.h; sourceTree = "<group>"; };
                A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAgent.cpp; sourceTree = "<group>"; };
                A5CEEE13187F3BAD00E55C99 /* InspectorAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAgent.h; sourceTree = "<group>"; };
                A5D0A1BA1862301B00C7B496 /* InspectorEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorEnvironment.h; sourceTree = "<group>"; };
                                969A09220ED1E09C00F1F681 /* Completion.cpp */,
                                F5BB2BC5030F772101FCFE1D /* Completion.h */,
                                0FDB2CE9174896C7007B3C1B /* ConcurrentJITLock.h */,
+                               A53CE08918BC21C300BEDF76 /* ConsoleClient.h */,
+                               A5B6A74C18C6DBA600F11E91 /* ConsoleClient.cpp */,
+                               A53CE08118BC1A5600BEDF76 /* ConsolePrototype.cpp */,
+                               A53CE08218BC1A5600BEDF76 /* ConsolePrototype.h */,
+                               A5FD0071189B038C00633231 /* ConsoleTypes.h */,
                                0FFC99D0184EC8AD009C10AB /* ConstantMode.h */,
                                BCA62DFF0E2826310004F30D /* ConstructData.cpp */,
                                BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */,
                                BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */,
                                BC1167D80E19BCC9008066DD /* JSCell.h */,
                                0F97496F1687ADE200A4FF6A /* JSCellInlines.h */,
+                               A53CE08318BC1A5600BEDF76 /* JSConsole.cpp */,
+                               A53CE08418BC1A5600BEDF76 /* JSConsole.h */,
                                0F1DD84918A945BE0026F3FA /* JSCInlines.h */,
                                F692A8870255597D01FF60F7 /* JSCJSValue.cpp */,
                                14ABB36E099C076400E2A24F /* JSCJSValue.h */,
                                A532438E185696CE002ED692 /* scripts */,
                                A5FD0077189B051000633231 /* ConsoleMessage.cpp */,
                                A5FD0078189B051000633231 /* ConsoleMessage.h */,
-                               A5FD0071189B038C00633231 /* ConsoleTypes.h */,
                                A57D23EF1891B5B40031C7FA /* ContentSearchUtilities.cpp */,
                                A57D23F01891B5B40031C7FA /* ContentSearchUtilities.h */,
                                A54982011891D0B00081E5B8 /* EventLoop.cpp */,
                                A593CF811840377100BFCE27 /* InspectorValues.h */,
                                A503FA13188E0FAF00110F14 /* JavaScriptCallFrame.cpp */,
                                A503FA14188E0FAF00110F14 /* JavaScriptCallFrame.h */,
+                               A5C3A1A318C0490200C9593A /* JSConsoleClient.cpp */,
+                               A5C3A1A418C0490200C9593A /* JSConsoleClient.h */,
                                A51007BE187CC3C600B38879 /* JSGlobalObjectInspectorController.cpp */,
                                A51007BF187CC3C600B38879 /* JSGlobalObjectInspectorController.h */,
                                A503FA27188F105900110F14 /* JSGlobalObjectScriptDebugServer.cpp */,
                                6553A33217A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h in Headers */,
                                0FD82E39141AB14D00179C94 /* CompactJITCodeMap.h in Headers */,
                                A7E5A3A81797432D00E893C0 /* CompilationResult.h in Headers */,
+                               A53CE08818BC1A5600BEDF76 /* JSConsole.h in Headers */,
                                BC18C3F40E16F5CD00B34460 /* Completion.h in Headers */,
                                0FDB2CEA174896C7007B3C1B /* ConcurrentJITLock.h in Headers */,
                                BC18C3F50E16F5CD00B34460 /* config.h in Headers */,
                                0FFB921816D02EB20055A5DB /* DFGAllocator.h in Headers */,
                                A737810C1799EA2E00817533 /* DFGAnalysis.h in Headers */,
                                0F1E3A461534CBAF000F9456 /* DFGArgumentPosition.h in Headers */,
+                               A5C3A1A618C0490200C9593A /* JSConsoleClient.h in Headers */,
                                0F16015E156198C900C2587C /* DFGArgumentsSimplificationPhase.h in Headers */,
                                0F485322187750560083B687 /* DFGArithMode.h in Headers */,
                                0F05C3B41683CF9200BAF45B /* DFGArrayifySlowPathGenerator.h in Headers */,
                                0F24E54317EA9F5900ABB217 /* FPRInfo.h in Headers */,
                                0FDB2CC9173DA520007B3C1B /* FTLAbbreviatedTypes.h in Headers */,
                                0FEA0A08170513DB00BB722C /* FTLAbbreviations.h in Headers */,
+                               A53CE08A18BC21C300BEDF76 /* ConsoleClient.h in Headers */,
                                0FEA0A1D1708B00700BB722C /* FTLAbstractHeap.h in Headers */,
                                0FEA0A1F1708B00700BB722C /* FTLAbstractHeapRepository.h in Headers */,
                                0F485328187DFDEC0083B687 /* FTLAvailableRecovery.h in Headers */,
                                0F235BD717178E1C00690C7F /* FTLExitArgumentList.h in Headers */,
                                0F235BD917178E1C00690C7F /* FTLExitThunkGenerator.h in Headers */,
                                0F235BDB17178E1C00690C7F /* FTLExitValue.h in Headers */,
+                               A53CE08618BC1A5600BEDF76 /* ConsolePrototype.h in Headers */,
                                A7F2996C17A0BB670010417A /* FTLFail.h in Headers */,
                                0FEA0A2C170B661900BB722C /* FTLFormattedValue.h in Headers */,
                                0FD8A31A17D51F2200CA2C40 /* FTLForOSREntryJITCode.h in Headers */,
                                A704D90517A0BAA8006BA554 /* DFGInPlaceAbstractState.cpp in Sources */,
                                0F300B7B18AB1B1400A6D72E /* DFGIntegerCheckCombiningPhase.cpp in Sources */,
                                0FC97F3D18202119002C9B26 /* DFGInvalidationPointInjectionPhase.cpp in Sources */,
+                               A5C3A1A518C0490200C9593A /* JSConsoleClient.cpp in Sources */,
                                0FEA0A33170D40BF00BB722C /* DFGJITCode.cpp in Sources */,
                                86EC9DCB1328DF82002B2AD7 /* DFGJITCompiler.cpp in Sources */,
                                A78A9778179738B8009DF744 /* DFGJITFinalizer.cpp in Sources */,
                                0F235BE117178E1C00690C7F /* FTLThunks.cpp in Sources */,
                                0F6B1CC51862C47800845D97 /* FTLUnwindInfo.cpp in Sources */,
                                0F235BE317178E1C00690C7F /* FTLValueFormat.cpp in Sources */,
+                               A53CE08718BC1A5600BEDF76 /* JSConsole.cpp in Sources */,
                                0F5A6283188C98D40072C9DF /* FTLValueRange.cpp in Sources */,
                                147F39CB107EC37600427A48 /* FunctionConstructor.cpp in Sources */,
                                0FF0F19F16B72A17005DF95B /* FunctionExecutableDump.cpp in Sources */,
                                0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */,
                                86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */,
                                A729009C17976C6000317298 /* MacroAssemblerARMv7.cpp in Sources */,
+                               A53CE08518BC1A5600BEDF76 /* ConsolePrototype.cpp in Sources */,
                                A7A4AE0817973B26005612B1 /* MacroAssemblerX86Common.cpp in Sources */,
+                               A5B6A74D18C6DBA600F11E91 /* ConsoleClient.cpp in Sources */,
                                A700873917CBE85300C3E643 /* MapConstructor.cpp in Sources */,
                                A78507D617CBC6FD0011F6E7 /* MapData.cpp in Sources */,
                                A74DEF91182D991400522C22 /* MapIteratorConstructor.cpp in Sources */,
diff --git a/Source/JavaScriptCore/inspector/JSConsoleClient.cpp b/Source/JavaScriptCore/inspector/JSConsoleClient.cpp
new file mode 100644 (file)
index 0000000..572cc5c
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * 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 "JSConsoleClient.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "InspectorConsoleAgent.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSConsoleClient::JSConsoleClient(InspectorConsoleAgent* consoleAgent)
+    : ConsoleClient()
+    , m_consoleAgent(consoleAgent)
+{
+}
+
+void JSConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<ScriptArguments> prpArguments)
+{
+    RefPtr<ScriptArguments> arguments = prpArguments;
+
+#if !LOG_DISABLED
+    ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, arguments);
+#endif
+
+    String message;
+    arguments->getFirstArgumentAsString(message);
+    m_consoleAgent->addMessageToConsole(MessageSource::ConsoleAPI, type, level, message, exec, arguments.release());
+}
+
+void JSConsoleClient::count(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    m_consoleAgent->count(exec, arguments);
+}
+
+void JSConsoleClient::profile(ExecState*, const String&)
+{
+    // FIXME: JSContext inspection needs a profiler.
+    warnUnimplemented(ASCIILiteral("console.profile"));
+}
+
+void JSConsoleClient::profileEnd(ExecState*, const String&)
+{
+    // FIXME: JSContext inspection needs a profiler.
+    // Already warned in profile(), we do not need to warn again.
+}
+
+void JSConsoleClient::time(ExecState*, const String& title)
+{
+    m_consoleAgent->startTiming(title);
+}
+
+void JSConsoleClient::timeEnd(ExecState* exec, const String& title)
+{
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
+    m_consoleAgent->stopTiming(title, callStack.release());
+}
+
+void JSConsoleClient::timeStamp(ExecState*, PassRefPtr<ScriptArguments>)
+{
+    // FIXME: JSContext inspection needs a timeline.
+    warnUnimplemented(ASCIILiteral("console.timeStamp"));
+}
+
+void JSConsoleClient::warnUnimplemented(const String& method)
+{
+    String message = method + " is currently ignored in JavaScript context inspection.";
+    m_consoleAgent->addMessageToConsole(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Warning, message, nullptr, nullptr);
+}
+
+} // namespace Inspector
+
+#endif
diff --git a/Source/JavaScriptCore/inspector/JSConsoleClient.h b/Source/JavaScriptCore/inspector/JSConsoleClient.h
new file mode 100644 (file)
index 0000000..a9f74c8
--- /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 JSConsoleClient_h
+#define JSConsoleClient_h
+
+#include "ConsoleClient.h"
+
+namespace Inspector {
+
+class InspectorConsoleAgent;
+
+class JSConsoleClient final : public JSC::ConsoleClient {
+public:
+    explicit JSConsoleClient(InspectorConsoleAgent*);
+    virtual ~JSConsoleClient() { }
+
+protected:
+    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<ScriptArguments>) override;
+    virtual void count(JSC::ExecState*, PassRefPtr<ScriptArguments>) override;
+    virtual void profile(JSC::ExecState*, const String& title) override;
+    virtual void profileEnd(JSC::ExecState*, const String& title) override;
+    virtual void time(JSC::ExecState*, const String& title) override;
+    virtual void timeEnd(JSC::ExecState*, const String& title) override;
+    virtual void timeStamp(JSC::ExecState*, PassRefPtr<ScriptArguments>) override;
+
+private:
+    void warnUnimplemented(const String& method);
+    void internalAddMessage(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<ScriptArguments>);
+
+    InspectorConsoleAgent* m_consoleAgent;
+};
+
+}
+
+#endif // !defined(JSConsoleClient_h)
index 0288bcf..059c699 100644 (file)
 #include "InspectorAgent.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorFrontendChannel.h"
+#include "JSConsoleClient.h"
 #include "JSGlobalObject.h"
 #include "JSGlobalObjectConsoleAgent.h"
 #include "JSGlobalObjectDebuggerAgent.h"
 #include "JSGlobalObjectRuntimeAgent.h"
+#include "ScriptArguments.h"
 #include "ScriptCallStack.h"
 #include "ScriptCallStackFactory.h"
 #include <cxxabi.h>
@@ -59,6 +61,7 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
     auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(m_injectedScriptManager.get(), m_globalObject, consoleAgent.get());
 
     m_consoleAgent = consoleAgent.get();
+    m_consoleClient = std::make_unique<JSConsoleClient>(m_consoleAgent);
 
     runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
 
@@ -154,6 +157,11 @@ void JSGlobalObjectInspectorController::reportAPIException(ExecState* exec, JSVa
     m_consoleAgent->addMessageToConsole(MessageSource::JS, MessageType::Log, MessageLevel::Error, errorMessage, callStack);
 }
 
+ConsoleClient* JSGlobalObjectInspectorController::consoleClient() const
+{
+    return m_consoleClient.get();
+}
+
 InspectorFunctionCallHandler JSGlobalObjectInspectorController::functionCallHandler() const
 {
     return JSC::call;
index 8266e59..032228d 100644 (file)
@@ -35,6 +35,7 @@
 #include <wtf/text/WTFString.h>
 
 namespace JSC {
+class ConsoleClient;
 class ExecState;
 class JSGlobalObject;
 class JSValue;
@@ -43,9 +44,11 @@ class JSValue;
 namespace Inspector {
 
 class InjectedScriptManager;
+class InspectorConsoleAgent;
 class InspectorBackendDispatcher;
 class InspectorConsoleAgent;
 class InspectorFrontendChannel;
+class JSConsoleClient;
 class ScriptCallStack;
 
 class JSGlobalObjectInspectorController final : public InspectorEnvironment {
@@ -63,6 +66,8 @@ public:
 
     void reportAPIException(JSC::ExecState*, JSC::JSValue exception);
 
+    JSC::ConsoleClient* consoleClient() const;
+
     virtual bool developerExtrasEnabled() const override { return true; }
     virtual bool canAccessInspectedScriptState(JSC::ExecState*) const override { return true; }
     virtual InspectorFunctionCallHandler functionCallHandler() const override;
@@ -75,6 +80,7 @@ private:
 
     JSC::JSGlobalObject& m_globalObject;
     std::unique_ptr<InjectedScriptManager> m_injectedScriptManager;
+    std::unique_ptr<JSConsoleClient> m_consoleClient;
     InspectorConsoleAgent* m_consoleAgent;
     InspectorAgentRegistry m_agents;
     InspectorFrontendChannel* m_inspectorFrontendChannel;
index f857fc7..7eaf7cc 100644 (file)
@@ -30,8 +30,8 @@
 
 #include "InspectorJSBackendDispatchers.h"
 #include "InspectorJSFrontendDispatchers.h"
-#include "inspector/ConsoleTypes.h"
 #include "inspector/InspectorAgentBase.h"
+#include "runtime/ConsoleTypes.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
diff --git a/Source/JavaScriptCore/runtime/ConsoleClient.cpp b/Source/JavaScriptCore/runtime/ConsoleClient.cpp
new file mode 100644 (file)
index 0000000..87c0751
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2013, 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 "ConsoleClient.h"
+
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+#include "ScriptValue.h"
+#include <stdio.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+using namespace Inspector;
+
+namespace JSC {
+
+void ConsoleClient::printURLAndPosition(const String& url, unsigned lineNumber, unsigned columnNumber)
+{
+    if (url.isEmpty())
+        return;
+
+    if (lineNumber > 0 && columnNumber > 0)
+        printf("%s:%u:%u", url.utf8().data(), lineNumber, columnNumber);
+    else if (lineNumber > 0)
+        printf("%s:%u", url.utf8().data(), lineNumber);
+    else
+        printf("%s", url.utf8().data());
+}
+
+void ConsoleClient::printMessagePrefix(MessageSource source, MessageType type, MessageLevel level)
+{
+    const char* sourceString;
+    switch (source) {
+    case MessageSource::XML:
+        sourceString = "XML";
+        break;
+    case MessageSource::JS:
+        sourceString = "JS";
+        break;
+    case MessageSource::Network:
+        sourceString = "NETWORK";
+        break;
+    case MessageSource::ConsoleAPI:
+        sourceString = "CONSOLE";
+        break;
+    case MessageSource::Storage:
+        sourceString = "STORAGE";
+        break;
+    case MessageSource::AppCache:
+        sourceString = "APPCACHE";
+        break;
+    case MessageSource::Rendering:
+        sourceString = "RENDERING";
+        break;
+    case MessageSource::CSS:
+        sourceString = "CSS";
+        break;
+    case MessageSource::Security:
+        sourceString = "SECURITY";
+        break;
+    case MessageSource::Other:
+        sourceString = "OTHER";
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        sourceString = "UNKNOWN";
+        break;
+    }
+
+    const char* levelString;
+    switch (level) {
+    case MessageLevel::Debug:
+        levelString = "DEBUG";
+        break;
+    case MessageLevel::Log:
+        levelString = "LOG";
+        break;
+    case MessageLevel::Warning:
+        levelString = "WARN";
+        break;
+    case MessageLevel::Error:
+        levelString = "ERROR";
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        levelString = "UNKNOWN";
+        break;
+    }
+
+    if (type == MessageType::Trace)
+        levelString = "TRACE";
+
+    printf("%s %s:", sourceString, levelString);
+}
+
+void ConsoleClient::printConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, const String& url, unsigned lineNumber, unsigned columnNumber)
+{
+    ConsoleClient::printURLAndPosition(url, lineNumber, columnNumber);
+    printf(": ");
+    ConsoleClient::printMessagePrefix(source, type, level);
+    printf(" %s\n", message.utf8().data());
+}
+
+void ConsoleClient::printConsoleMessageWithArguments(MessageSource source, MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<ScriptArguments> prpArguments)
+{
+    RefPtr<ScriptArguments> arguments = prpArguments;
+
+    bool isTraceMessage = type == MessageType::Trace;
+    size_t stackSize = isTraceMessage ? ScriptCallStack::maxCallStackSizeToCapture : 1;
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, stackSize));
+    const ScriptCallFrame& lastCaller = callStack->at(0);
+
+    ConsoleClient::printURLAndPosition(lastCaller.sourceURL(), lastCaller.lineNumber(), lastCaller.columnNumber());
+    printf(": ");
+    ConsoleClient::printMessagePrefix(source, type, level);
+    for (size_t i = 0; i < arguments->argumentCount(); ++i) {
+        String argAsString = arguments->argumentAt(i).toString(arguments->globalState());
+        printf(" %s", argAsString.utf8().data());
+    }
+    printf("\n");
+
+    if (isTraceMessage) {
+        for (size_t i = 0; i < callStack->size(); ++i) {
+            const ScriptCallFrame& callFrame = callStack->at(i);
+            String functionName = String(callFrame.functionName());
+            if (functionName.isEmpty())
+                functionName = ASCIILiteral("(unknown)");
+            printf("%lu: %s (", static_cast<unsigned long>(i), functionName.utf8().data());
+            ConsoleClient::printURLAndPosition(callFrame.sourceURL(), callFrame.lineNumber(), callFrame.columnNumber());
+            printf(")\n");
+        }
+    }
+}
+
+void ConsoleClient::internalMessageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<ScriptArguments> prpArguments, ArgumentRequirement argumentRequirement)
+{
+    RefPtr<ScriptArguments> arguments = prpArguments;
+    if (argumentRequirement == ArgumentRequired && !arguments->argumentCount())
+        return;
+
+    messageWithTypeAndLevel(type, level, exec, arguments.release());
+}
+
+void ConsoleClient::logWithLevel(ExecState* exec, PassRefPtr<ScriptArguments> arguments, MessageLevel level)
+{
+    internalMessageWithTypeAndLevel(MessageType::Log, level, exec, arguments, ArgumentRequired);
+}
+
+void ConsoleClient::clear(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::Clear, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+}
+
+void ConsoleClient::dir(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::Dir, MessageLevel::Log, exec, arguments, ArgumentRequired);
+}
+
+void ConsoleClient::dirXML(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::DirXML, MessageLevel::Log, exec, arguments, ArgumentRequired);
+}
+
+void ConsoleClient::table(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::Table, MessageLevel::Log, exec, arguments, ArgumentRequired);
+}
+
+void ConsoleClient::trace(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::Trace, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+}
+
+void ConsoleClient::assertCondition(ExecState* exec, PassRefPtr<ScriptArguments> arguments, bool condition)
+{
+    if (condition)
+        return;
+
+    internalMessageWithTypeAndLevel(MessageType::Assert, MessageLevel::Error, exec, arguments, ArgumentNotRequired);
+}
+
+void ConsoleClient::group(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::StartGroup, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+}
+
+void ConsoleClient::groupCollapsed(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::StartGroupCollapsed, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+}
+
+void ConsoleClient::groupEnd(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    internalMessageWithTypeAndLevel(MessageType::EndGroup, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ConsoleClient.h b/Source/JavaScriptCore/runtime/ConsoleClient.h
new file mode 100644 (file)
index 0000000..7e784ef
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * 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 ConsoleClient_h
+#define ConsoleClient_h
+
+#include "ConsoleTypes.h"
+#include <wtf/Forward.h>
+
+namespace Inspector {
+class ScriptArguments;
+}
+
+namespace JSC {
+
+class ExecState;
+
+class ConsoleClient {
+public:
+    virtual ~ConsoleClient() { }
+
+    static void printURLAndPosition(const String& url, unsigned lineNumber, unsigned columnNumber);
+    static void printMessagePrefix(MessageSource, MessageType, MessageLevel);
+    JS_EXPORT_PRIVATE static void printConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, const String& url, unsigned lineNumber, unsigned columnNumber);
+    JS_EXPORT_PRIVATE static void printConsoleMessageWithArguments(MessageSource, MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+
+    void logWithLevel(ExecState*, PassRefPtr<Inspector::ScriptArguments>, MessageLevel);
+    void clear(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void dir(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void dirXML(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void table(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void trace(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void assertCondition(ExecState*, PassRefPtr<Inspector::ScriptArguments>, bool condition);
+    void group(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void groupCollapsed(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void groupEnd(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+
+    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>) = 0;
+    virtual void count(ExecState*, PassRefPtr<Inspector::ScriptArguments>) = 0;
+    virtual void profile(ExecState*, const String& title) = 0;
+    virtual void profileEnd(ExecState*, const String& title) = 0;
+    virtual void time(ExecState*, const String& title) = 0;
+    virtual void timeEnd(ExecState*, const String& title) = 0;
+    virtual void timeStamp(ExecState*, PassRefPtr<Inspector::ScriptArguments>) = 0;
+
+private:
+    enum ArgumentRequirement { ArgumentRequired, ArgumentNotRequired };
+    void internalMessageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, ArgumentRequirement);
+};
+
+} // namespace JSC
+
+#endif // ConsoleClient_h
diff --git a/Source/JavaScriptCore/runtime/ConsolePrototype.cpp b/Source/JavaScriptCore/runtime/ConsolePrototype.cpp
new file mode 100644 (file)
index 0000000..f064b7c
--- /dev/null
@@ -0,0 +1,395 @@
+/*
+ * 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 "ConsolePrototype.h"
+
+#include "ConsoleClient.h"
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSCJSValueInlines.h"
+#include "JSConsole.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStackFactory.h"
+#include "StructureInlines.h"
+
+namespace JSC {
+
+const ClassInfo ConsolePrototype::s_info = { "ConsolePrototype", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ConsolePrototype) };
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDirXML(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTable(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTrace(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupCollapsed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupEnd(ExecState*);
+
+void ConsolePrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(info()));
+    vm.prototypeMap.addPrototype(this);
+
+    // For legacy reasons, console properties are enumerable, writable, deleteable,
+    // and all have a length of 0. This may change if Console is standardized.
+
+    JSC_NATIVE_FUNCTION("debug", consoleProtoFuncDebug, None, 0);
+    JSC_NATIVE_FUNCTION("error", consoleProtoFuncError, None, 0);
+    JSC_NATIVE_FUNCTION("log", consoleProtoFuncLog, None, 0);
+    JSC_NATIVE_FUNCTION("info", consoleProtoFuncLog, None, 0); // "info" is an alias of "log".
+    JSC_NATIVE_FUNCTION("warn", consoleProtoFuncWarn, None, 0);
+
+    JSC_NATIVE_FUNCTION("clear", consoleProtoFuncClear, None, 0);
+    JSC_NATIVE_FUNCTION("dir", consoleProtoFuncDir, None, 0);
+    JSC_NATIVE_FUNCTION("dirxml", consoleProtoFuncDirXML, None, 0);
+    JSC_NATIVE_FUNCTION("table", consoleProtoFuncTable, None, 0);
+    JSC_NATIVE_FUNCTION("trace", consoleProtoFuncTrace, None, 0);
+    JSC_NATIVE_FUNCTION("assert", consoleProtoFuncAssert, None, 0);
+    JSC_NATIVE_FUNCTION("count", consoleProtoFuncCount, None, 0);
+    JSC_NATIVE_FUNCTION("profile", consoleProtoFuncProfile, None, 0);
+    JSC_NATIVE_FUNCTION("profileEnd", consoleProtoFuncProfileEnd, None, 0);
+    JSC_NATIVE_FUNCTION("time", consoleProtoFuncTime, None, 0);
+    JSC_NATIVE_FUNCTION("timeEnd", consoleProtoFuncTimeEnd, None, 0);
+    JSC_NATIVE_FUNCTION("timeStamp", consoleProtoFuncTimeStamp, None, 0);
+    JSC_NATIVE_FUNCTION("group", consoleProtoFuncGroup, None, 0);
+    JSC_NATIVE_FUNCTION("groupCollapsed", consoleProtoFuncGroupCollapsed, None, 0);
+    JSC_NATIVE_FUNCTION("groupEnd", consoleProtoFuncGroupEnd, None, 0);
+}
+
+static String valueToStringWithUndefinedOrNullCheck(ExecState* exec, JSValue value)
+{
+    if (value.isUndefinedOrNull())
+        return String();
+    return value.toString(exec)->value(exec);
+}
+
+static EncodedJSValue consoleLogWithLevel(ExecState* exec, MessageLevel level)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->logWithLevel(exec, arguments.release(), level);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Debug);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Error);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Log);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Error);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->clear(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->dir(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDirXML(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->dirXML(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTable(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->table(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTrace(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->trace(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    bool condition(exec->argument(0).toBoolean(exec));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 1));
+    client->assertCondition(exec, arguments.release(), condition);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->count(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (argsCount <= 0) {
+        client->profile(exec, String());
+        return JSValue::encode(jsUndefined());
+    }
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->profile(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (argsCount <= 0) {
+        client->profileEnd(exec, String());
+        return JSValue::encode(jsUndefined());
+    }
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->profileEnd(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    if (exec->argumentCount() < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->time(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    if (exec->argumentCount() < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->timeEnd(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->timeStamp(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->group(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupCollapsed(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->groupCollapsed(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupEnd(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->hostThisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis->globalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->groupEnd(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/ConsolePrototype.h b/Source/JavaScriptCore/runtime/ConsolePrototype.h
new file mode 100644 (file)
index 0000000..a27ad24
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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 ConsolePrototype_h
+#define ConsolePrototype_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class ConsolePrototype : public JSNonFinalObject {
+public:
+    typedef JSNonFinalObject Base;
+
+    DECLARE_INFO;
+
+    static ConsolePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        ConsolePrototype* prototype = new (NotNull, allocateCell<ConsolePrototype>(vm.heap)) ConsolePrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
+        return prototype;
+    }
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+private:
+    ConsolePrototype(VM& vm, Structure* structure)
+        : Base(vm, structure)
+    {
+    }
+    void finishCreation(VM&, JSGlobalObject*);
+};
+
+}
+
+#endif // !defined(ConsolePrototype_h)
@@ -26,7 +26,7 @@
 #ifndef ConsoleTypes_h
 #define ConsoleTypes_h
 
-namespace Inspector {
+namespace JSC {
 
 enum class MessageSource {
     XML,
@@ -64,11 +64,10 @@ enum class MessageLevel {
     Debug = 4,
 };
 
-} // namespace Inspector
+} // namespace JSC
 
-// These will likely move out of the inspector namespace.
-using Inspector::MessageSource;
-using Inspector::MessageType;
-using Inspector::MessageLevel;
+using JSC::MessageSource;
+using JSC::MessageType;
+using JSC::MessageLevel;
 
 #endif // ConsoleTypes_h
diff --git a/Source/JavaScriptCore/runtime/JSConsole.cpp b/Source/JavaScriptCore/runtime/JSConsole.cpp
new file mode 100644 (file)
index 0000000..c27f1f1
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 "JSConsole.h"
+
+namespace JSC {
+
+const ClassInfo JSConsole::s_info = { "Console", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSConsole) };
+
+}
diff --git a/Source/JavaScriptCore/runtime/JSConsole.h b/Source/JavaScriptCore/runtime/JSConsole.h
new file mode 100644 (file)
index 0000000..de611ec
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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 JSConsole_h
+#define JSConsole_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class JSConsole : public JSNonFinalObject {
+public:
+    typedef JSNonFinalObject Base;
+
+    DECLARE_EXPORT_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+    static JSConsole* create(VM& vm, Structure* structure)
+    {
+        JSConsole* instance = new (NotNull, allocateCell<JSConsole>(vm.heap)) JSConsole(vm, structure);
+        instance->finishCreation(vm);
+        return instance;
+    }
+
+    static JSConsole* create(ExecState* exec, Structure* structure)
+    {
+        return create(exec->vm(), structure);
+    }
+
+private:
+    JSConsole(VM& vm, Structure* structure)
+        : Base(vm, structure)
+    {
+    }
+};
+
+}
+
+#endif // !defined(JSConsole_h)
index 3dfaa2f..85a9dc2 100644 (file)
@@ -41,6 +41,7 @@
 #include "BooleanPrototype.h"
 #include "CodeBlock.h"
 #include "CodeCache.h"
+#include "ConsolePrototype.h"
 #include "DateConstructor.h"
 #include "DatePrototype.h"
 #include "Debugger.h"
@@ -64,6 +65,7 @@
 #include "JSCallbackConstructor.h"
 #include "JSCallbackFunction.h"
 #include "JSCallbackObject.h"
+#include "JSConsole.h"
 #include "JSDataView.h"
 #include "JSDataViewPrototype.h"
 #include "JSFunction.h"
@@ -165,6 +167,8 @@ JSGlobalObject::JSGlobalObject(VM& vm, Structure* structure, const GlobalObjectM
     , m_varInjectionWatchpoint(adoptRef(new WatchpointSet(IsWatched)))
     , m_weakRandom(Options::forceWeakRandomSeed() ? Options::forcedWeakRandomSeed() : static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
     , m_evalEnabled(true)
+    , m_experimentsEnabled(false)
+    , m_consoleClient(nullptr)
     , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable)
 {
 }
@@ -206,6 +210,7 @@ void JSGlobalObject::init(JSObject* thisValue)
     m_inspectorDebuggable = std::make_unique<JSGlobalObjectDebuggable>(*this);
     m_inspectorDebuggable->init();
     m_inspectorDebuggable->setRemoteDebuggingAllowed(true);
+    m_consoleClient = m_inspectorController->consoleClient();
 #endif
 
     reset(prototype());
@@ -458,6 +463,11 @@ void JSGlobalObject::reset(JSValue prototype)
     m_specialPointers[Special::ObjectConstructor] = objectConstructor;
     m_specialPointers[Special::ArrayConstructor] = arrayConstructor;
 
+    ConsolePrototype* consolePrototype = ConsolePrototype::create(vm, this, ConsolePrototype::createStructure(vm, this, m_objectPrototype.get()));
+    m_consoleStructure.set(vm, this, JSConsole::createStructure(vm, this, consolePrototype));
+    JSConsole* consoleObject = JSConsole::create(vm, m_consoleStructure.get());
+    putDirectWithoutTransition(vm, Identifier(exec, "console"), consoleObject, DontEnum);
+
     if (m_experimentsEnabled) {
         NamePrototype* privateNamePrototype = NamePrototype::create(exec, NamePrototype::createStructure(vm, this, m_objectPrototype.get()));
         m_privateNameStructure.set(vm, this, NameInstance::createStructure(vm, this, privateNamePrototype));
@@ -666,6 +676,7 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
     visitor.append(&thisObject->m_privateNameStructure);
     visitor.append(&thisObject->m_regExpMatchesArrayStructure);
     visitor.append(&thisObject->m_regExpStructure);
+    visitor.append(&thisObject->m_consoleStructure);
     visitor.append(&thisObject->m_internalFunctionStructure);
 
 #if ENABLE(PROMISES)
index 80ea70c..aab4a93 100644 (file)
@@ -54,6 +54,7 @@ namespace JSC {
 
 class ArrayPrototype;
 class BooleanPrototype;
+class ConsoleClient;
 class Debugger;
 class ErrorConstructor;
 class ErrorPrototype;
@@ -203,6 +204,7 @@ protected:
     WriteBarrier<Structure> m_privateNameStructure;
     WriteBarrier<Structure> m_regExpMatchesArrayStructure;
     WriteBarrier<Structure> m_regExpStructure;
+    WriteBarrier<Structure> m_consoleStructure;
     WriteBarrier<Structure> m_internalFunctionStructure;
     
     WriteBarrier<Structure> m_iteratorResultStructure;
@@ -252,6 +254,7 @@ protected:
     bool m_evalEnabled;
     String m_evalDisabledErrorMessage;
     bool m_experimentsEnabled;
+    ConsoleClient* m_consoleClient;
 
     static JS_EXPORTDATA const GlobalObjectMethodTable s_globalObjectMethodTable;
     const GlobalObjectMethodTable* m_globalObjectMethodTable;
@@ -439,6 +442,9 @@ public:
     Inspector::JSGlobalObjectInspectorController& inspectorController() const { return *m_inspectorController.get(); }
 #endif
 
+    JS_EXPORT_PRIVATE void setConsoleClient(ConsoleClient* consoleClient) { m_consoleClient = consoleClient; }
+    ConsoleClient* consoleClient() const { return m_consoleClient; }
+
     void setName(const String&);
     const String& name() const { return m_name; }
 
index 2fb0e69..8960864 100644 (file)
@@ -545,7 +545,6 @@ set(WebCore_IDL_FILES
     loader/appcache/DOMApplicationCache.idl
 
     page/BarProp.idl
-    page/Console.idl
     page/Crypto.idl
     page/DOMSecurityPolicy.idl
     page/DOMSelection.idl
@@ -1692,7 +1691,6 @@ set(WebCore_SOURCES
     page/BarProp.cpp
     page/CaptionUserPreferences.cpp
     page/Chrome.cpp
-    page/Console.cpp
     page/ContentSecurityPolicy.cpp
     page/ContextMenuContext.cpp
     page/ContextMenuController.cpp
index c0fd165..55463b6 100644 (file)
@@ -1,3 +1,95 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        Covered by existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * ForwardingHeaders/runtime/ConsoleClient.h: Added.
+        * ForwardingHeaders/runtime/ConsoleTypes.h: Renamed from Source/WebCore/ForwardingHeaders/inspector/ConsoleTypes.h.
+        * GNUmakefile.list.am:
+        * PlatformGTK.cmake:
+        * WebCore.exp.in:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/gobject/GNUmakefile.am:
+        Update build systems.
+
+        * page/Console.cpp: Removed.
+        * page/Console.h: Removed.
+        * page/Console.idl: Removed.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::~DOMWindow):
+        (WebCore::DOMWindow::resetDOMWindowProperties):
+        * page/DOMWindow.h:
+        (WebCore::DOMWindow::defaultStatus):
+        * page/DOMWindow.idl:
+        Removed the old IDL generated Console object on window.
+
+        * page/PageConsole.cpp:
+        (WebCore::PageConsole::shouldPrintExceptions):
+        (WebCore::PageConsole::setShouldPrintExceptions):
+        (WebCore::PageConsole::mute):
+        (WebCore::PageConsole::unmute):
+        (WebCore::PageConsole::messageWithTypeAndLevel):
+        (WebCore::PageConsole::count):
+        (WebCore::PageConsole::profile):
+        (WebCore::PageConsole::profileEnd):
+        (WebCore::PageConsole::time):
+        (WebCore::PageConsole::timeEnd):
+        (WebCore::PageConsole::timeStamp):
+        (WebCore::PageConsole::group):
+        (WebCore::PageConsole::groupCollapsed):
+        (WebCore::PageConsole::groupEnd):
+        (WebCore::PageConsole::clearProfiles):
+        * page/PageConsole.h:
+        Move the handling of Console object into PageConsole.
+
+        * bindings/js/ScriptCachedFrameData.cpp:
+        (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
+        (WebCore::ScriptCachedFrameData::restore):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::clearWindowShell):
+        (WebCore::ScriptController::initScript):
+        Set the PageConsole as the ConsoleClient of the JSGlobalObject
+        so that WebCore may handle console messages directly. For instance
+        it may pass messages on to the ChromeClient.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::consoleProfiles):
+        To access profiles, go through PageConsole now instead of Console.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        * bindings/objc/WebScriptObject.mm:
+        * css/MediaList.cpp:
+        * dom/ScriptExecutionContext.h:
+        * dom/UIEvent.cpp:
+        * dom/ViewportArguments.cpp:
+        * html/parser/XSSAuditorDelegate.cpp:
+        * inspector/CommandLineAPIHost.h:
+        * inspector/InspectorInstrumentation.cpp:
+        * inspector/InspectorInstrumentation.h:
+        * inspector/InspectorProfilerAgent.cpp:
+        * inspector/WebConsoleAgent.cpp:
+        * loader/FrameLoader.cpp:
+        * loader/MixedContentChecker.cpp:
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        * loader/cache/CachedResourceLoader.cpp:
+        * page/ChromeClient.h:
+        * page/ContentSecurityPolicy.cpp:
+        * page/Page.cpp:
+        * page/Page.h:
+        * svg/SVGDocumentExtensions.cpp:
+        * workers/WorkerMessagingProxy.cpp:
+        * workers/WorkerReportingProxy.h:
+        Update includes.
+
 2014-03-06  Zsolt Borbely  <borbezs@inf.u-szeged.hu>
 
         Fix the !ENABLE(CSS_STICKY_POSITION) build
index cacf51d..ea52408 100644 (file)
@@ -80,7 +80,6 @@
 #include "JSCommandLineAPIHost.cpp"
 #include "JSComment.cpp"
 #include "JSCompositionEvent.cpp"
-#include "JSConsole.cpp"
 #include "JSCoordinates.cpp"
 #include "JSCounter.cpp"
 #include "JSCrypto.cpp"
index 76d537b..bf752ab 100644 (file)
@@ -459,7 +459,6 @@ NON_SVG_BINDING_IDLS = \
     $(WebCore)/loader/appcache/DOMApplicationCache.idl \
     $(WebCore)/page/AbstractView.idl \
     $(WebCore)/page/BarProp.idl \
-    $(WebCore)/page/Console.idl \
     $(WebCore)/page/Crypto.idl \
     $(WebCore)/page/DOMSecurityPolicy.idl \
     $(WebCore)/page/DOMSelection.idl \
diff --git a/Source/WebCore/ForwardingHeaders/runtime/ConsoleClient.h b/Source/WebCore/ForwardingHeaders/runtime/ConsoleClient.h
new file mode 100644 (file)
index 0000000..57db396
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_ConsoleClient_h
+#define WebCore_FWD_ConsoleClient_h
+#include <JavaScriptCore/ConsoleClient.h>
+#endif
index 021cebd..3905f44 100644 (file)
@@ -111,8 +111,6 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSComment.h \
        DerivedSources/WebCore/JSCompositionEvent.cpp \
        DerivedSources/WebCore/JSCompositionEvent.h \
-       DerivedSources/WebCore/JSConsole.cpp \
-       DerivedSources/WebCore/JSConsole.h \
        DerivedSources/WebCore/JSConvolverNode.cpp \
        DerivedSources/WebCore/JSConvolverNode.h \
        DerivedSources/WebCore/JSCoordinates.cpp \
@@ -1556,7 +1554,6 @@ dom_binding_idls += \
        $(WebCore)/inspector/ScriptProfileNode.idl \
        $(WebCore)/loader/appcache/DOMApplicationCache.idl \
        $(WebCore)/page/BarProp.idl \
-       $(WebCore)/page/Console.idl \
        $(WebCore)/page/Crypto.idl \
        $(WebCore)/page/DOMSecurityPolicy.idl \
        $(WebCore)/page/DOMSelection.idl \
@@ -4041,8 +4038,6 @@ webcore_sources += \
        Source/WebCore/page/Chrome.cpp \
        Source/WebCore/page/Chrome.h \
        Source/WebCore/page/ChromeClient.h \
-       Source/WebCore/page/Console.cpp \
-       Source/WebCore/page/Console.h \
        Source/WebCore/page/ContentSecurityPolicy.cpp \
        Source/WebCore/page/ContentSecurityPolicy.h \
        Source/WebCore/page/ContextMenuClient.h \
index 835b585..df431fb 100644 (file)
@@ -617,7 +617,6 @@ list(APPEND GObjectDOMBindings_IDL_FILES
     loader/appcache/DOMApplicationCache.idl
 
     page/BarProp.idl
-    page/Console.idl
     page/DOMSecurityPolicy.idl
     page/DOMSelection.idl
     page/DOMWindow.idl
index 9e3fbc8..24ad02a 100644 (file)
@@ -1881,7 +1881,6 @@ __ZNK7WebCore8Settings18standardFontFamilyE11UScriptCode
 __ZNK7WebCore8Settings19sansSerifFontFamilyE11UScriptCode
 __ZNK7WebCore8Settings20pictographFontFamilyE11UScriptCode
 __ZNK7WebCore9DOMWindow27pendingUnloadEventListenersEv
-__ZNK7WebCore9DOMWindow7consoleEv
 __ZNK7WebCore9FloatQuad11boundingBoxEv
 __ZNK7WebCore9FloatRect10intersectsERKS0_
 __ZNK7WebCore9FloatRect8containsERKS0_
@@ -1922,6 +1921,7 @@ __ZNK7WebCore9PageCache10frameCountEv
 __ZNK7WebCore9RenderBox11clientWidthEv
 __ZNK7WebCore9RenderBox12clientHeightEv
 __ZNK7WebCore9TreeScope14getElementByIdERKN3WTF6StringE
+__ZTVN7WebCore11PageConsoleE
 __ZTVN7WebCore12ChromeClientE
 __ZTVN7WebCore14LoaderStrategyE
 __ZTVN7WebCore14StaticNodeListE
index 1415770..1962110 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSConsole.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
-      <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="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCoordinates.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     </ClCompile>
     <ClCompile Include="..\page\Chrome.cpp" />
     <ClCompile Include="..\page\animation\CompositeAnimation.cpp" />
-    <ClCompile Include="..\page\Console.cpp" />
     <ClCompile Include="..\page\ContentSecurityPolicy.cpp" />
     <ClCompile Include="..\page\ContextMenuContext.cpp" />
     <ClCompile Include="..\page\ContextMenuController.cpp" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCommandLineAPIHost.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSComment.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCompositionEvent.h" />
-    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSConsole.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCoordinates.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCounter.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCrypto.h" />
     <ClInclude Include="..\ForwardingHeaders\heap\StrongInlines.h" />
     <ClInclude Include="..\ForwardingHeaders\heap\Weak.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\ConsoleMessage.h" />
-    <ClInclude Include="..\ForwardingHeaders\inspector\ConsoleTypes.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\IdentifiersFactory.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InjectedScript.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InjectedScriptBase.h" />
     <ClInclude Include="..\ForwardingHeaders\runtime\BooleanObject.h" />
     <ClInclude Include="..\ForwardingHeaders\runtime\CallData.h" />
     <ClInclude Include="..\ForwardingHeaders\runtime\Completion.h" />
+    <ClInclude Include="..\ForwardingHeaders\runtime\ConsoleTypes.h" />
     <ClInclude Include="..\ForwardingHeaders\runtime\ConstructData.h" />
     <ClInclude Include="..\ForwardingHeaders\runtime\DateInstance.h" />
     <ClInclude Include="..\ForwardingHeaders\runtime\Error.h" />
     <ClInclude Include="..\page\Chrome.h" />
     <ClInclude Include="..\page\ChromeClient.h" />
     <ClInclude Include="..\page\animation\CompositeAnimation.h" />
-    <ClInclude Include="..\page\Console.h" />
     <ClInclude Include="..\page\ContentSecurityPolicy.h" />
     <ClInclude Include="..\page\ContextMenuClient.h" />
     <ClInclude Include="..\page\ContextMenuContext.h" />
     <ClInclude Include="..\page\Navigator.h" />
     <ClInclude Include="..\page\NavigatorBase.h" />
     <ClInclude Include="..\page\OriginAccessEntry.h" />
+    <ClInclude Include="..\page\PageConsole.h" />
     <ClInclude Include="..\page\PageGroup.h" />
     <ClInclude Include="..\page\PageGroupLoadDeferrer.h" />
     <ClInclude Include="..\page\PageSerializer.h" />
index 30c9589..cf6da5a 100644 (file)
     <ClCompile Include="..\page\animation\CompositeAnimation.cpp">
       <Filter>page</Filter>
     </ClCompile>
-    <ClCompile Include="..\page\Console.cpp">
-      <Filter>page</Filter>
-    </ClCompile>
     <ClCompile Include="..\page\ContentSecurityPolicy.cpp">
       <Filter>page</Filter>
     </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCompositionEvent.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
-    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSConsole.cpp">
-      <Filter>DerivedSources</Filter>
-    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCoordinates.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
     <ClInclude Include="..\page\animation\CompositeAnimation.h">
       <Filter>page</Filter>
     </ClInclude>
-    <ClInclude Include="..\page\Console.h">
-      <Filter>page</Filter>
-    </ClInclude>
     <ClInclude Include="..\page\ContentSecurityPolicy.h">
       <Filter>page</Filter>
     </ClInclude>
     <ClInclude Include="..\ForwardingHeaders\inspector\ConsoleMessage.h">
       <Filter>ForwardingHeaders\inspector</Filter>
     </ClInclude>
-    <ClInclude Include="..\ForwardingHeaders\inspector\ConsoleTypes.h">
-      <Filter>ForwardingHeaders\inspector</Filter>
-    </ClInclude>
     <ClInclude Include="..\ForwardingHeaders\inspector\IdentifiersFactory.h">
       <Filter>ForwardingHeaders\inspector</Filter>
     </ClInclude>
     <ClInclude Include="..\ForwardingHeaders\runtime\Completion.h">
       <Filter>ForwardingHeaders\runtime</Filter>
     </ClInclude>
+    <ClInclude Include="..\ForwardingHeaders\runtime\ConsoleTypes.h">
+      <Filter>ForwardingHeaders\runtime</Filter>
+    </ClInclude>
     <ClInclude Include="..\ForwardingHeaders\runtime\ConstructData.h">
       <Filter>ForwardingHeaders\runtime</Filter>
     </ClInclude>
     <ClInclude Include="..\page\OriginAccessEntry.h">
       <Filter>page</Filter>
     </ClInclude>
+    <ClInclude Include="..\page\PageConsole.h">
+      <Filter>page</Filter>
+    </ClInclude>
     <ClInclude Include="..\page\PageGroup.h">
       <Filter>page</Filter>
     </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCompositionEvent.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
-    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSConsole.h">
-      <Filter>DerivedSources</Filter>
-    </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCoordinates.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
index e84bc75..45b3c03 100644 (file)
                BC06EE040BFD71AA00856E9D /* JSHTMLTableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06EE020BFD71AA00856E9D /* JSHTMLTableElement.cpp */; };
                BC06EE050BFD71AA00856E9D /* JSHTMLTableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06EE030BFD71AA00856E9D /* JSHTMLTableElement.h */; };
                BC073BAA0C399B1F000F5979 /* FloatConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = BC073BA90C399B1F000F5979 /* FloatConversion.h */; };
-               BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0B36A10CD3C67C00AC7EB5 /* Console.cpp */; };
-               BC0B36A50CD3C67C00AC7EB5 /* Console.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0B36A20CD3C67C00AC7EB5 /* Console.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC10D76717D8EE6E005E2626 /* RenderBlockFlow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFB45F417D8E49400444446 /* RenderBlockFlow.cpp */; };
                BC10D76817D8EE71005E2626 /* RenderBlockFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB45F317D8E39200444446 /* RenderBlockFlow.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC124EE70C2641CD009E2349 /* BarProp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC124EE40C2641CD009E2349 /* BarProp.cpp */; };
                BC97E412109154FA0010D361 /* JSHTMLAllCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC97E410109154FA0010D361 /* JSHTMLAllCollection.cpp */; };
                BC97E413109154FA0010D361 /* JSHTMLAllCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC97E411109154FA0010D361 /* JSHTMLAllCollection.h */; };
                BC97E42C10915B060010D361 /* JSHTMLAllCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC97E42B10915B060010D361 /* JSHTMLAllCollectionCustom.cpp */; };
-               BC98543D0CD3D98B00069BC1 /* JSConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC98543B0CD3D98B00069BC1 /* JSConsole.cpp */; };
-               BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = BC98543C0CD3D98B00069BC1 /* JSConsole.h */; };
                BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */; };
                BC99812E0DBE807A008CE9EF /* DOMAbstractViewFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BC99812D0DBE807A008CE9EF /* DOMAbstractViewFrame.h */; };
                BC9ADD230CC4032600098C4C /* WebKitCSSTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLTProcessor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC06F24D06D18A7E004A6FA3 /* XSLTProcessorLibxslt.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTProcessorLibxslt.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC073BA90C399B1F000F5979 /* FloatConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FloatConversion.h; sourceTree = "<group>"; };
-               BC0B36A10CD3C67C00AC7EB5 /* Console.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Console.cpp; sourceTree = "<group>"; };
-               BC0B36A20CD3C67C00AC7EB5 /* Console.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Console.h; sourceTree = "<group>"; };
-               BC0B36A30CD3C67C00AC7EB5 /* Console.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Console.idl; sourceTree = "<group>"; };
                BC124EE40C2641CD009E2349 /* BarProp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BarProp.cpp; sourceTree = "<group>"; };
                BC124EE50C2641CD009E2349 /* BarProp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BarProp.h; sourceTree = "<group>"; };
                BC124EE60C2641CD009E2349 /* BarProp.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = BarProp.idl; sourceTree = "<group>"; };
                BC97E410109154FA0010D361 /* JSHTMLAllCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAllCollection.cpp; sourceTree = "<group>"; };
                BC97E411109154FA0010D361 /* JSHTMLAllCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAllCollection.h; sourceTree = "<group>"; };
                BC97E42B10915B060010D361 /* JSHTMLAllCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAllCollectionCustom.cpp; sourceTree = "<group>"; };
-               BC98543B0CD3D98B00069BC1 /* JSConsole.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsole.cpp; sourceTree = "<group>"; };
-               BC98543C0CD3D98B00069BC1 /* JSConsole.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSConsole.h; sourceTree = "<group>"; };
                BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheetCustom.cpp; sourceTree = "<group>"; };
                BC99812D0DBE807A008CE9EF /* DOMAbstractViewFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMAbstractViewFrame.h; sourceTree = "<group>"; };
                BC9A6141146859D9006057FD /* DOMExceptions.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMExceptions.in; sourceTree = "<group>"; };
                                14D8238A0AF92DF60004F057 /* Chrome.cpp */,
                                14D823500AF92A790004F057 /* Chrome.h */,
                                14D824060AF93AEB0004F057 /* ChromeClient.h */,
-                               BC0B36A10CD3C67C00AC7EB5 /* Console.cpp */,
-                               BC0B36A20CD3C67C00AC7EB5 /* Console.h */,
-                               BC0B36A30CD3C67C00AC7EB5 /* Console.idl */,
                                97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */,
                                97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */,
                                065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */,
                        children = (
                                BC124EFD0C26447A009E2349 /* JSBarProp.cpp */,
                                BC124EFE0C26447A009E2349 /* JSBarProp.h */,
-                               BC98543B0CD3D98B00069BC1 /* JSConsole.cpp */,
-                               BC98543C0CD3D98B00069BC1 /* JSConsole.h */,
                                975CA29F1303679D00E99AD9 /* JSCrypto.cpp */,
                                975CA2A01303679D00E99AD9 /* JSCrypto.h */,
                                BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */,
                                79F2F5A21091939A000D87CB /* CompositionEvent.h in Headers */,
                                FD31608F12B026F700C1A359 /* Cone.h in Headers */,
                                65C97AF308EA908800ACD273 /* config.h in Headers */,
-                               BC0B36A50CD3C67C00AC7EB5 /* Console.h in Headers */,
                                A818721C0977D3C0005826D9 /* ContainerNode.h in Headers */,
                                E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */,
                                BC5EB9810E82072500B25965 /* ContentData.h in Headers */,
                                A584FE3C1864E2D800843B10 /* JSCommandLineAPIHost.h in Headers */,
                                93F9B6E10BA0FB7200854064 /* JSComment.h in Headers */,
                                79AC9219109945C80021266E /* JSCompositionEvent.h in Headers */,
-                               BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */,
                                FDA15EBE12B03F0B003A583A /* JSConvolverNode.h in Headers */,
                                FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */,
                                930705DA09E0C9BF00B17FE4 /* JSCounter.h in Headers */,
                                93309DDC099E64920056E581 /* CompositeEditCommand.cpp in Sources */,
                                79F2F5A11091939A000D87CB /* CompositionEvent.cpp in Sources */,
                                FD31608E12B026F700C1A359 /* Cone.cpp in Sources */,
-                               BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */,
                                A818721F0977D3C0005826D9 /* ContainerNode.cpp in Sources */,
                                A7A78CD51532BA62006C21E4 /* ContainerNodeAlgorithms.cpp in Sources */,
                                BC5EB9800E82072500B25965 /* ContentData.cpp in Sources */,
                                A584FE381864DAC100843B10 /* JSCommandLineAPIHostCustom.cpp in Sources */,
                                93F9B6E00BA0FB7200854064 /* JSComment.cpp in Sources */,
                                79AC9218109945C80021266E /* JSCompositionEvent.cpp in Sources */,
-                               BC98543D0CD3D98B00069BC1 /* JSConsole.cpp in Sources */,
                                FDA15EBD12B03F0B003A583A /* JSConvolverNode.cpp in Sources */,
                                FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */,
                                930705D809E0C9B700B17FE4 /* JSCounter.cpp in Sources */,
index c84fe17..7a7e0b6 100644 (file)
@@ -13,8 +13,6 @@ webkitgtk_gdom_built_sources += \
        DerivedSources/webkitdom/WebKitDOMCharacterDataPrivate.h \
        DerivedSources/webkitdom/WebKitDOMComment.cpp \
        DerivedSources/webkitdom/WebKitDOMCommentPrivate.h \
-       DerivedSources/webkitdom/WebKitDOMConsole.cpp \
-       DerivedSources/webkitdom/WebKitDOMConsolePrivate.h \
        DerivedSources/webkitdom/WebKitDOMCSSRule.cpp \
        DerivedSources/webkitdom/WebKitDOMCSSRuleList.cpp \
        DerivedSources/webkitdom/WebKitDOMCSSRuleListPrivate.h \
@@ -398,7 +396,6 @@ webkitgtk_gdom_built_h_api += \
        DerivedSources/webkitdom/WebKitDOMValidityState.h \
        DerivedSources/webkitdom/WebKitDOMDOMApplicationCache.h \
        DerivedSources/webkitdom/WebKitDOMBarProp.h \
-       DerivedSources/webkitdom/WebKitDOMConsole.h \
        DerivedSources/webkitdom/WebKitDOMCustom.h \
        DerivedSources/webkitdom/WebKitDOMDeprecated.h \
        DerivedSources/webkitdom/WebKitDOMDOMWindowCSS.h \
index d403cfc..2409163 100644 (file)
@@ -151,14 +151,6 @@ gboolean webkit_dom_bar_info_get_visible(void*)
     return FALSE;
 }
 
-// WebKitDOMConsole
-
-void* webkit_dom_console_get_memory(WebKitDOMConsole*)
-{
-    g_warning("%s: this functionality has been removed from WebKit, this function does nothing.", __func__);
-    return 0;
-}
-
 // WebKitDOMCSSStyleDeclaration
 
 WebKitDOMCSSValue* webkit_dom_css_style_declaration_get_property_css_value(WebKitDOMCSSStyleDeclaration*, const gchar*)
index c03a9c5..bb3ce73 100644 (file)
@@ -175,19 +175,6 @@ WEBKIT_DEPRECATED gboolean
 webkit_dom_bar_info_get_visible(void* self);
 
 /**
- * webkit_dom_console_get_memory:
- * @self: A #WebKitDOMConsole
- *
- * This functionality has been removed from WebKit, this function does nothing.
- *
- * Returns: (transfer none):
- *
- * Deprecated: 2.2
- */
-WEBKIT_DEPRECATED void*
-webkit_dom_console_get_memory(WebKitDOMConsole* self);
-
-/**
  * webkit_dom_css_style_declaration_get_property_css_value:
  * @self: A #WebKitDOMCSSStyleDeclaration
  * @propertyName: A #gchar
index 7a05ff2..ae29289 100644 (file)
@@ -12,7 +12,6 @@ WebKitDOMNodeList* webkit_dom_webkit_named_flow_get_content_nodes(WebKitDOMWebKi
 WebKitDOMNodeList* webkit_dom_webkit_named_flow_get_regions_by_content_node(WebKitDOMWebKitNamedFlow*, WebKitDOMNode*)
 GType webkit_dom_bar_info_get_type(void)
 gboolean webkit_dom_bar_info_get_visible(void*)
-void* webkit_dom_console_get_memory(WebKitDOMConsole*)
 WebKitDOMCSSValue* webkit_dom_css_style_declaration_get_property_css_value(WebKitDOMCSSStyleDeclaration*, const gchar*)
 gboolean webkit_dom_document_get_webkit_hidden(WebKitDOMDocument*)
 gchar* webkit_dom_document_get_webkit_visibility_state(WebKitDOMDocument*)
index 2e54c2a..10c0d75 100644 (file)
@@ -1346,8 +1346,6 @@ void webkit_dom_dom_application_cache_abort(WebKitDOMDOMApplicationCache*)
 gboolean webkit_dom_dom_application_cache_dispatch_event(WebKitDOMDOMApplicationCache*, WebKitDOMEvent*, GError**)
 gushort webkit_dom_dom_application_cache_get_status(WebKitDOMDOMApplicationCache*)
 gboolean webkit_dom_bar_prop_get_visible(WebKitDOMBarProp*)
-void webkit_dom_console_time(WebKitDOMConsole*, const gchar*)
-void webkit_dom_console_group_end(WebKitDOMConsole*)
 gboolean webkit_dom_html_text_area_element_is_edited(WebKitDOMHTMLTextAreaElement*)
 gboolean webkit_dom_html_input_element_is_edited(WebKitDOMHTMLInputElement*)
 void webkit_dom_html_media_element_set_current_time(WebKitDOMHTMLMediaElement*, gdouble, GError**)
@@ -1365,7 +1363,6 @@ WebKitDOMNodeList* webkit_dom_webkit_named_flow_get_content_nodes(WebKitDOMWebKi
 WebKitDOMNodeList* webkit_dom_webkit_named_flow_get_regions_by_content_node(WebKitDOMWebKitNamedFlow*, WebKitDOMNode*)
 GType webkit_dom_bar_info_get_type(void)
 gboolean webkit_dom_bar_info_get_visible(void*)
-void* webkit_dom_console_get_memory(WebKitDOMConsole*)
 WebKitDOMCSSValue* webkit_dom_css_style_declaration_get_property_css_value(WebKitDOMCSSStyleDeclaration*, const gchar*)
 gboolean webkit_dom_document_get_webkit_hidden(WebKitDOMDocument*)
 gchar* webkit_dom_document_get_webkit_visibility_state(WebKitDOMDocument*)
@@ -1475,7 +1472,6 @@ gdouble webkit_dom_dom_window_get_device_pixel_ratio(WebKitDOMDOMWindow*)
 WebKitDOMDOMApplicationCache* webkit_dom_dom_window_get_application_cache(WebKitDOMDOMWindow*)
 WebKitDOMStorage* webkit_dom_dom_window_get_session_storage(WebKitDOMDOMWindow*, GError**)
 WebKitDOMStorage* webkit_dom_dom_window_get_local_storage(WebKitDOMDOMWindow*, GError**)
-WebKitDOMConsole* webkit_dom_dom_window_get_console(WebKitDOMDOMWindow*)
 WebKitDOMPerformance* webkit_dom_dom_window_get_performance(WebKitDOMDOMWindow*)
 WebKitDOMDOMWindowCSS* webkit_dom_dom_window_get_css(WebKitDOMDOMWindow*)
 WebKitDOMStorageInfo* webkit_dom_dom_window_get_webkit_storage_info(WebKitDOMDOMWindow*)
index e4f9c40..163d620 100644 (file)
@@ -24,7 +24,6 @@
 #include "JSDOMWindowBase.h"
 
 #include "Chrome.h"
-#include "Console.h"
 #include "DOMWindow.h"
 #include "Frame.h"
 #include "InspectorController.h"
index c4e12f9..24d1e04 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Copyright (c) 2008, Google Inc. All rights reserved.
  * 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:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above
@@ -15,7 +15,7 @@
  *     * Neither the name of Google Inc. nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,6 +36,7 @@
 #include "Frame.h"
 #include "GCController.h"
 #include "Page.h"
+#include "PageConsole.h"
 #include "PageGroup.h"
 #include <heap/StrongInlines.h>
 #include <runtime/JSLock.h>
@@ -56,9 +57,10 @@ ScriptCachedFrameData::ScriptCachedFrameData(Frame& frame)
     for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
         JSDOMWindow* window = iter->value->window();
         m_windows.add(iter->key.get(), Strong<JSDOMWindow>(window->vm(), window));
+        window->setConsoleClient(nullptr);
     }
 
-    scriptController.attachDebugger(0);
+    scriptController.attachDebugger(nullptr);
 }
 
 ScriptCachedFrameData::~ScriptCachedFrameData()
@@ -70,6 +72,7 @@ void ScriptCachedFrameData::restore(Frame& frame)
 {
     JSLockHolder lock(JSDOMWindowBase::commonVM());
 
+    Page* page = frame.page();
     ScriptController& scriptController = frame.script();
     ScriptController::ShellMap& windowShells = scriptController.m_windowShells;
 
@@ -86,11 +89,14 @@ void ScriptCachedFrameData::restore(Frame& frame)
 
             windowShell->setWindow(domWindow);
 
-            if (Page* page = frame.page()) {
+            if (page) {
                 scriptController.attachDebugger(windowShell, page->debugger());
                 windowShell->window()->setProfileGroup(page->group().identifier());
             }
         }
+
+        if (page)
+            windowShell->window()->setConsoleClient(&page->console());
     }
 }
 
index d635413..f78aea8 100644 (file)
 #include "JSDOMWindow.h"
 #include "JSDocument.h"
 #include "JSMainThreadExecState.h"
+#include "MainFrame.h"
 #include "NP_jsobject.h"
 #include "Page.h"
+#include "PageConsole.h"
 #include "PageGroup.h"
 #include "PluginView.h"
 #include "ScriptSourceCode.h"
@@ -186,8 +188,16 @@ void ScriptController::clearWindowShell(DOMWindow* newDOMWindow, bool goingIntoP
         if (&windowShell->window()->impl() == newDOMWindow)
             continue;
 
-        // Clear the debugger from the current window before setting the new window.
-        attachDebugger(windowShell, 0);
+        // Clear the debugger and console from the current window before setting the new window.
+        attachDebugger(windowShell, nullptr);
+        windowShell->window()->setConsoleClient(nullptr);
+
+        // FIXME: We should clear console profiles for each frame as soon as the frame is destroyed.
+        // Instead of clearing all of them when the main frame is destroyed.
+        if (m_frame.isMainFrame()) {
+            if (Page* page = m_frame.page())
+                page->console().clearProfiles();
+        }
 
         windowShell->window()->willRemoveFromWindowShell();
         windowShell->setWindow(newDOMWindow);
@@ -200,6 +210,7 @@ void ScriptController::clearWindowShell(DOMWindow* newDOMWindow, bool goingIntoP
         if (Page* page = m_frame.page()) {
             attachDebugger(windowShell, page->debugger());
             windowShell->window()->setProfileGroup(page->group().identifier());
+            windowShell->window()->setConsoleClient(&page->console());
         }
     }
 
@@ -225,6 +236,7 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld& world)
     if (Page* page = m_frame.page()) {
         attachDebugger(windowShell, page->debugger());
         windowShell->window()->setProfileGroup(page->group().identifier());
+        windowShell->window()->setConsoleClient(&page->console());
     }
 
     m_frame.loader().dispatchDidClearWindowObjectInWorld(world);
index c45672e..588ca52 100644 (file)
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #import "config.h"
 #import "WebScriptObjectPrivate.h"
 
 #import "BridgeJSC.h"
-#import "Console.h"
 #import "DOMInternal.h"
-#import "DOMWindow.h"
 #import "Frame.h"
 #import "JSDOMWindow.h"
 #import "JSDOMWindowCustom.h"
index f00014f..afec29d 100644 (file)
@@ -23,7 +23,6 @@
 #include "CSSImportRule.h"
 #include "CSSParser.h"
 #include "CSSStyleSheet.h"
-#include "Console.h"
 #include "DOMWindow.h"
 #include "Document.h"
 #include "ExceptionCode.h"
index df0acf3..2981c50 100644 (file)
@@ -32,7 +32,7 @@
 #include "SecurityContext.h"
 #include "Supplementable.h"
 #include "URL.h"
-#include <inspector/ConsoleTypes.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/HashSet.h>
 
 namespace JSC {
index 1ded079..4b3dc83 100644 (file)
@@ -23,7 +23,6 @@
 #include "config.h"
 #include "UIEvent.h"
 
-#include "Console.h"
 #include "Node.h"
 
 namespace WebCore {
index 0f6c083..3df6640 100644 (file)
@@ -28,9 +28,6 @@
 #include "config.h"
 #include "ViewportArguments.h"
 
-#include "Chrome.h"
-#include "Console.h"
-#include "DOMWindow.h"
 #include "Document.h"
 #include "Frame.h"
 #include "IntSize.h"
index 322d44d..08e5efa 100644 (file)
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "XSSAuditorDelegate.h"
 
-#include "Console.h"
-#include "DOMWindow.h"
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "FormData.h"
index 6178eee..3654789 100644 (file)
@@ -31,7 +31,7 @@
 #define CommandLineAPIHost_h
 
 #include "ScriptState.h"
-#include <inspector/ConsoleTypes.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
index 0eb63b8..b5bc62b 100644 (file)
 #include "WorkerRuntimeAgent.h"
 #include "WorkerThread.h"
 #include "XMLHttpRequest.h"
-#include <inspector/ConsoleTypes.h>
 #include <inspector/ScriptArguments.h>
 #include <inspector/ScriptCallStack.h>
 #include <inspector/agents/InspectorDebuggerAgent.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 
index 5b3d8c8..f9a00b8 100644 (file)
@@ -43,7 +43,7 @@
 #include "ScriptState.h"
 #include "StorageArea.h"
 #include "WebSocketFrame.h"
-#include <inspector/ConsoleTypes.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/RefPtr.h>
 
 #if ENABLE(WEB_REPLAY)
index df856d8..6dea033 100644 (file)
@@ -33,7 +33,6 @@
 #if ENABLE(INSPECTOR)
 
 #include "CommandLineAPIHost.h"
-#include "Console.h"
 #include "InspectorWebFrontendDispatchers.h"
 #include "InstrumentingAgents.h"
 #include "Page.h"
 #include "WebInjectedScriptManager.h"
 #include "WorkerScriptDebugServer.h"
 #include <bindings/ScriptObject.h>
-#include <inspector/ConsoleTypes.h>
 #include <inspector/InjectedScript.h>
 #include <inspector/InspectorValues.h>
 #include <inspector/agents/InspectorConsoleAgent.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/text/StringConcatenate.h>
 
index 57c8f4d..643d11f 100644 (file)
@@ -30,7 +30,6 @@
 #if ENABLE(INSPECTOR)
 
 #include "CommandLineAPIHost.h"
-#include "Console.h"
 #include "DOMWindow.h"
 #include "ResourceError.h"
 #include "ResourceResponse.h"
index 294a23c..a5efe0b 100644 (file)
  * are met:
  *
  * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
+ *     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. 
+ *     documentation and/or other materials provided with the distribution.
  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
+ *     from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -43,7 +43,6 @@
 #include "CachedResourceLoader.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
-#include "Console.h"
 #include "ContentSecurityPolicy.h"
 #include "DOMImplementation.h"
 #include "DOMWindow.h"
index 17f34e0..a405333 100644 (file)
@@ -6,13 +6,13 @@
  * are met:
  *
  * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
+ *     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. 
+ *     documentation and/or other materials provided with the distribution.
  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
+ *     from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 #include "config.h"
 #include "MixedContentChecker.h"
 
-#include "Console.h"
-#include "DOMWindow.h"
 #include "Document.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
-#include "SchemeRegistry.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include <wtf/text/CString.h>
index 4518cfc..79fbe4f 100644 (file)
@@ -32,9 +32,7 @@
 #include "ApplicationCacheStorage.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
-#include "Console.h"
 #include "DOMApplicationCache.h"
-#include "DOMWindow.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
 #include "FrameLoader.h"
index 9d28d75..aadcaab 100644 (file)
@@ -35,7 +35,6 @@
 #include "CachedResourceRequest.h"
 #include "CachedScript.h"
 #include "CachedXSLStyleSheet.h"
-#include "Console.h"
 #include "ContentSecurityPolicy.h"
 #include "DOMWindow.h"
 #include "Document.h"
index 60437e2..544eb78 100644 (file)
@@ -35,7 +35,7 @@
 #include "ScrollingCoordinator.h"
 #include "SearchPopupMenu.h"
 #include "WebCoreKeyboardUIMode.h"
-#include <inspector/ConsoleTypes.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/Forward.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
diff --git a/Source/WebCore/page/Console.cpp b/Source/WebCore/page/Console.cpp
deleted file mode 100644 (file)
index 790d703..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Console.h"
-
-#include "Chrome.h"
-#include "ChromeClient.h"
-#include "Document.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "FrameTree.h"
-#include "InspectorConsoleInstrumentation.h"
-#include "InspectorController.h"
-#include "Page.h"
-#include "PageConsole.h"
-#include "PageGroup.h"
-#include "ScriptProfile.h"
-#include "ScriptProfiler.h"
-#include "ScriptableDocumentParser.h"
-#include "Settings.h"
-#include <bindings/ScriptValue.h>
-#include <inspector/ConsoleTypes.h>
-#include <inspector/ScriptArguments.h>
-#include <inspector/ScriptCallStack.h>
-#include <inspector/ScriptCallStackFactory.h>
-#include <stdio.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-using namespace Inspector;
-
-namespace WebCore {
-
-Console::Console(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-}
-
-Console::~Console()
-{
-}
-
-static void internalAddMessage(Page* page, MessageType type, MessageLevel level, JSC::ExecState* state, PassRefPtr<ScriptArguments> prpArguments, bool acceptNoArguments = false, bool printTrace = false)
-{
-    RefPtr<ScriptArguments> arguments = prpArguments;
-
-    if (!page)
-        return;
-
-    if (!acceptNoArguments && !arguments->argumentCount())
-        return;
-
-    size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1;
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state, stackSize));
-    const ScriptCallFrame& lastCaller = callStack->at(0);
-
-    String message;
-    bool gotMessage = arguments->getFirstArgumentAsString(message);
-    InspectorInstrumentation::addMessageToConsole(page, MessageSource::ConsoleAPI, type, level, message, state, arguments);
-
-    if (page->settings().privateBrowsingEnabled())
-        return;
-
-    if (gotMessage)
-        page->chrome().client().addMessageToConsole(MessageSource::ConsoleAPI, type, level, message, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL());
-
-    if (!page->settings().logsPageMessagesToSystemConsoleEnabled() && !PageConsole::shouldPrintExceptions())
-        return;
-
-    PageConsole::printSourceURLAndPosition(lastCaller.sourceURL(), lastCaller.lineNumber());
-
-    printf(": ");
-
-    PageConsole::printMessageSourceAndLevelPrefix(MessageSource::ConsoleAPI, level, printTrace);
-
-    for (size_t i = 0; i < arguments->argumentCount(); ++i) {
-        String argAsString = arguments->argumentAt(i).toString(arguments->globalState());
-        printf(" %s", argAsString.utf8().data());
-    }
-
-    printf("\n");
-
-    if (!printTrace)
-        return;
-
-    for (size_t i = 0; i < callStack->size(); ++i) {
-        const ScriptCallFrame& callFrame = callStack->at(i);
-
-        String functionName = String(callFrame.functionName());
-        if (functionName.isEmpty())
-            functionName = ASCIILiteral("(unknown)");
-
-        printf("%lu: %s (", static_cast<unsigned long>(i), functionName.utf8().data());
-
-        PageConsole::printSourceURLAndPosition(callFrame.sourceURL(), callFrame.lineNumber());
-
-        printf(")\n");
-    }
-}
-
-void Console::debug(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Log, MessageLevel::Debug, state, arguments);
-}
-
-void Console::error(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Log, MessageLevel::Error, state, arguments);
-}
-
-void Console::info(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    log(state, arguments);
-}
-
-void Console::log(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Log, MessageLevel::Log, state, arguments);
-}
-
-void Console::warn(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Log, MessageLevel::Warning, state, arguments);
-}
-
-void Console::dir(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Dir, MessageLevel::Log, state, arguments);
-}
-
-void Console::dirxml(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::DirXML, MessageLevel::Log, state, arguments);
-}
-
-void Console::table(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Table, MessageLevel::Log, state, arguments);
-}
-
-void Console::clear(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Clear, MessageLevel::Log, state, arguments, true);
-}
-
-void Console::trace(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(page(), MessageType::Trace, MessageLevel::Log, state, arguments, true, true);
-}
-
-void Console::assertCondition(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments, bool condition)
-{
-    if (condition)
-        return;
-
-    internalAddMessage(page(), MessageType::Assert, MessageLevel::Error, state, arguments, true);
-}
-
-void Console::count(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::consoleCount(page(), state, arguments);
-}
-
-void Console::profile(JSC::ExecState* state, const String& title)
-{
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    // FIXME: log a console message when profiling is disabled.
-    if (!InspectorInstrumentation::profilerEnabled(page))
-        return;
-
-    String resolvedTitle = title;
-    if (title.isNull()) // no title so give it the next user initiated profile title.
-        resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(page, true);
-
-    ScriptProfiler::start(state, resolvedTitle);
-
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state, 1));
-    const ScriptCallFrame& lastCaller = callStack->at(0);
-    InspectorInstrumentation::addStartProfilingMessageToConsole(page, resolvedTitle, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL());
-}
-
-void Console::profileEnd(JSC::ExecState* state, const String& title)
-{
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    if (!InspectorInstrumentation::profilerEnabled(page))
-        return;
-
-    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title);
-    if (!profile)
-        return;
-
-    m_profiles.append(profile);
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state, 1));
-    InspectorInstrumentation::addProfile(page, profile, callStack);
-}
-
-void Console::time(const String& title)
-{
-    InspectorInstrumentation::startConsoleTiming(m_frame, title);
-}
-
-void Console::timeEnd(JSC::ExecState* state, const String& title)
-{
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state, 1));
-    InspectorInstrumentation::stopConsoleTiming(m_frame, title, callStack.release());
-}
-
-void Console::timeStamp(PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::consoleTimeStamp(m_frame, arguments);
-}
-
-void Console::group(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::addMessageToConsole(page(), MessageSource::ConsoleAPI, MessageType::StartGroup, MessageLevel::Log, String(), state, arguments);
-}
-
-void Console::groupCollapsed(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::addMessageToConsole(page(), MessageSource::ConsoleAPI, MessageType::StartGroupCollapsed, MessageLevel::Log, String(), state, arguments);
-}
-
-void Console::groupEnd()
-{
-    InspectorInstrumentation::addMessageToConsole(page(), MessageSource::ConsoleAPI, MessageType::EndGroup, MessageLevel::Log, String(), String(), 0, 0);
-}
-
-Page* Console::page() const
-{
-    if (!m_frame)
-        return 0;
-    return m_frame->page();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/page/Console.h b/Source/WebCore/page/Console.h
deleted file mode 100644 (file)
index 98e4b47..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef Console_h
-#define Console_h
-
-#include "DOMWindowProperty.h"
-#include "ScriptProfile.h"
-#include "ScriptState.h"
-#include "ScriptWrappable.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace Inspector {
-class ScriptArguments;
-}
-
-namespace WebCore {
-
-class Frame;
-class Page;
-
-typedef Vector<RefPtr<ScriptProfile>> ProfilesArray;
-
-class Console : public ScriptWrappable, public RefCounted<Console>, public DOMWindowProperty {
-public:
-    static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); }
-    virtual ~Console();
-
-    void debug(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void error(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void info(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void log(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void clear(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void warn(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void dir(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void dirxml(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void table(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void trace(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void assertCondition(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, bool condition);
-    void count(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    const ProfilesArray& profiles() const { return m_profiles; }
-    void profile(JSC::ExecState*, const String& = String());
-    void profileEnd(JSC::ExecState*, const String& = String());
-    void time(const String&);
-    void timeEnd(JSC::ExecState*, const String&);
-    void timeStamp(PassRefPtr<Inspector::ScriptArguments>);
-    void group(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void groupCollapsed(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void groupEnd();
-
-private:
-    inline Page* page() const;
-
-    explicit Console(Frame*);
-
-    ProfilesArray m_profiles;
-};
-
-} // namespace WebCore
-
-#endif // Console_h
diff --git a/Source/WebCore/page/Console.idl b/Source/WebCore/page/Console.idl
deleted file mode 100644 (file)
index ad45188..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
-    NoInterfaceObject,
-    GenerateIsReachable=ImplFrame,
-] interface Console {
-
-    [CallWith=ScriptArguments&ScriptState] void debug();
-    [CallWith=ScriptArguments&ScriptState] void error();
-    [CallWith=ScriptArguments&ScriptState] void info();
-    [CallWith=ScriptArguments&ScriptState] void log();
-    [CallWith=ScriptArguments&ScriptState] void warn();
-    [CallWith=ScriptArguments&ScriptState] void dir();
-    [CallWith=ScriptArguments&ScriptState] void dirxml();
-    [CallWith=ScriptArguments&ScriptState] void table();
-    [CallWith=ScriptArguments&ScriptState] void trace();
-    [CallWith=ScriptArguments&ScriptState, ImplementedAs=assertCondition] void assert(boolean condition);
-    [CallWith=ScriptArguments&ScriptState] void count();
-
-    [CallWith=ScriptState] void profile([TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString title);
-    [CallWith=ScriptState] void profileEnd([TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString title);
-
-    void time([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString title);
-    [CallWith=ScriptState] void timeEnd([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString title);
-    [CallWith=ScriptArguments] void timeStamp();
-    [CallWith=ScriptArguments&ScriptState] void group();
-    [CallWith=ScriptArguments&ScriptState] void groupCollapsed();
-    void groupEnd();
-    [CallWith=ScriptArguments&ScriptState] void clear();
-};
-
index b6897dc..685ba58 100644 (file)
@@ -27,7 +27,6 @@
 #include "config.h"
 #include "ContentSecurityPolicy.h"
 
-#include "Console.h"
 #include "DOMStringList.h"
 #include "Document.h"
 #include "FormData.h"
index e730b08..11caa89 100644 (file)
@@ -35,7 +35,6 @@
 #include "CSSRuleList.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
-#include "Console.h"
 #include "Crypto.h"
 #include "DOMApplicationCache.h"
 #include "DOMSelection.h"
@@ -411,7 +410,6 @@ DOMWindow::~DOMWindow()
         ASSERT(!m_scrollbars);
         ASSERT(!m_statusbar);
         ASSERT(!m_toolbar);
-        ASSERT(!m_console);
         ASSERT(!m_navigator);
 #if ENABLE(WEB_TIMING)
         ASSERT(!m_performance);
@@ -558,7 +556,6 @@ void DOMWindow::resetDOMWindowProperties()
     m_scrollbars = 0;
     m_statusbar = 0;
     m_toolbar = 0;
-    m_console = 0;
     m_navigator = 0;
 #if ENABLE(WEB_TIMING)
     m_performance = 0;
@@ -667,15 +664,6 @@ BarProp* DOMWindow::toolbar() const
     return m_toolbar.get();
 }
 
-Console* DOMWindow::console() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_console)
-        m_console = Console::create(m_frame);
-    return m_console.get();
-}
-
 PageConsole* DOMWindow::pageConsole() const
 {
     if (!isCurrentlyDisplayedInFrame())
index efa10e6..b0d4baa 100644 (file)
@@ -21,7 +21,7 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef DOMWindow_h
@@ -43,7 +43,6 @@ namespace WebCore {
     class BarProp;
     class CSSRuleList;
     class CSSStyleDeclaration;
-    class Console;
     class Crypto;
     class DOMApplicationCache;
     class DOMSelection;
@@ -230,9 +229,8 @@ namespace WebCore {
         double devicePixelRatio() const;
 
         PassRefPtr<WebKitPoint> webkitConvertPointFromPageToNode(Node*, const WebKitPoint*) const;
-        PassRefPtr<WebKitPoint> webkitConvertPointFromNodeToPage(Node*, const WebKitPoint*) const;        
+        PassRefPtr<WebKitPoint> webkitConvertPointFromNodeToPage(Node*, const WebKitPoint*) const;
 
-        Console* console() const;
         PageConsole* pageConsole() const;
 
         void printErrorMessage(const String&);
@@ -473,7 +471,6 @@ namespace WebCore {
         mutable RefPtr<BarProp> m_scrollbars;
         mutable RefPtr<BarProp> m_statusbar;
         mutable RefPtr<BarProp> m_toolbar;
-        mutable RefPtr<Console> m_console;
         mutable RefPtr<Navigator> m_navigator;
         mutable RefPtr<Location> m_location;
         mutable RefPtr<StyleMedia> m_media;
@@ -513,7 +510,7 @@ namespace WebCore {
     inline String DOMWindow::defaultStatus() const
     {
         return m_defaultStatus;
-    } 
+    }
 
 } // namespace WebCore
 
index d612ae5..c4293f9 100644 (file)
     readonly attribute long orientation;
 #endif
 
-    [Replaceable] readonly attribute Console console;
-
     // cross-document messaging
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
     [DoNotCheckSecurity, Custom, RaisesException] void postMessage(SerializedScriptValue message, DOMString targetOrigin, optional Array messagePorts);
index 8b8f683..0cef459 100644 (file)
@@ -29,7 +29,6 @@
 #include "ClientRectList.h"
 #include "ContextMenuClient.h"
 #include "ContextMenuController.h"
-#include "DOMWindow.h"
 #include "DocumentMarkerController.h"
 #include "DocumentStyleSheetCollection.h"
 #include "DragController.h"
index 284c1bb..54a52c6 100644 (file)
 #include <wtf/SchedulePair.h>
 #endif
 
-#if PLATFORM(IOS)
-#include "Settings.h"
-#endif
-
 namespace JSC {
 class Debugger;
 }
index 8e16c86..47b9ba0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 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
 #include "InspectorConsoleInstrumentation.h"
 #include "InspectorController.h"
 #include "JSMainThreadExecState.h"
+#include "MainFrame.h"
 #include "Page.h"
+#include "ScriptProfile.h"
+#include "ScriptProfiler.h"
 #include "ScriptableDocumentParser.h"
 #include "Settings.h"
 #include <bindings/ScriptValue.h>
-#include <inspector/ConsoleTypes.h>
 #include <inspector/ScriptArguments.h>
 #include <inspector/ScriptCallStack.h>
 #include <inspector/ScriptCallStackFactory.h>
-#include <stdio.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
 
 using namespace Inspector;
 
 namespace WebCore {
 
-namespace {
-    int muteCount = 0;
-}
-
 PageConsole::PageConsole(Page& page)
     : m_page(page)
 {
@@ -65,82 +60,28 @@ PageConsole::~PageConsole()
 {
 }
 
-void PageConsole::printSourceURLAndPosition(const String& sourceURL, unsigned lineNumber, unsigned columnNumber)
+static int muteCount = 0;
+static bool printExceptions = false;
+
+bool PageConsole::shouldPrintExceptions()
 {
-    if (!sourceURL.isEmpty()) {
-        if (lineNumber > 0 && columnNumber > 0)
-            printf("%s:%u:%u", sourceURL.utf8().data(), lineNumber, columnNumber);
-        else if (lineNumber > 0)
-            printf("%s:%u", sourceURL.utf8().data(), lineNumber);
-        else
-            printf("%s", sourceURL.utf8().data());
-    }
+    return printExceptions;
 }
 
-void PageConsole::printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel level, bool showAsTrace)
-{
-    const char* sourceString;
-    switch (source) {
-    case MessageSource::XML:
-        sourceString = "XML";
-        break;
-    case MessageSource::JS:
-        sourceString = "JS";
-        break;
-    case MessageSource::Network:
-        sourceString = "NETWORK";
-        break;
-    case MessageSource::ConsoleAPI:
-        sourceString = "CONSOLE";
-        break;
-    case MessageSource::Storage:
-        sourceString = "STORAGE";
-        break;
-    case MessageSource::AppCache:
-        sourceString = "APPCACHE";
-        break;
-    case MessageSource::Rendering:
-        sourceString = "RENDERING";
-        break;
-    case MessageSource::CSS:
-        sourceString = "CSS";
-        break;
-    case MessageSource::Security:
-        sourceString = "SECURITY";
-        break;
-    case MessageSource::Other:
-        sourceString = "OTHER";
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        sourceString = "UNKNOWN";
-        break;
-    }
-
-    const char* levelString;
-    switch (level) {
-    case MessageLevel::Debug:
-        levelString = "DEBUG";
-        break;
-    case MessageLevel::Log:
-        levelString = "LOG";
-        break;
-    case MessageLevel::Warning:
-        levelString = "WARN";
-        break;
-    case MessageLevel::Error:
-        levelString = "ERROR";
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        levelString = "UNKNOWN";
-        break;
-    }
+void PageConsole::setShouldPrintExceptions(bool print)
+{
+    printExceptions = print;
+}
 
-    if (showAsTrace)
-        levelString = "TRACE";
+void PageConsole::mute()
+{
+    muteCount++;
+}
 
-    printf("%s %s:", sourceString, levelString);
+void PageConsole::unmute()
+{
+    ASSERT(muteCount > 0);
+    muteCount--;
 }
 
 void PageConsole::addMessage(MessageSource source, MessageLevel level, const String& message, unsigned long requestIdentifier, Document* document)
@@ -193,38 +134,88 @@ void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str
     if (!m_page.settings().logsPageMessagesToSystemConsoleEnabled() && !shouldPrintExceptions())
         return;
 
-    printSourceURLAndPosition(url, lineNumber, columnNumber);
+    ConsoleClient::printConsoleMessage(MessageSource::ConsoleAPI, MessageType::Log, level, message, url, lineNumber, columnNumber);
+}
+
+
+void PageConsole::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<Inspector::ScriptArguments> prpArguments)
+{
+    RefPtr<ScriptArguments> arguments = prpArguments;
+
+    String message;
+    bool gotMessage = arguments->getFirstArgumentAsString(message);
+    InspectorInstrumentation::addMessageToConsole(&m_page, MessageSource::ConsoleAPI, type, level, message, exec, arguments);
+
+    if (m_page.settings().privateBrowsingEnabled())
+        return;
+
+    if (gotMessage) {
+        size_t stackSize = type == MessageType::Trace ? ScriptCallStack::maxCallStackSizeToCapture : 1;
+        RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, stackSize));
+        const ScriptCallFrame& lastCaller = callStack->at(0);
+        m_page.chrome().client().addMessageToConsole(MessageSource::ConsoleAPI, type, level, message, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL());
+    }
+
+    if (m_page.settings().logsPageMessagesToSystemConsoleEnabled() || PageConsole::shouldPrintExceptions())
+        ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, arguments.release());
+}
+
+void PageConsole::count(JSC::ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+{
+    InspectorInstrumentation::consoleCount(&m_page, exec, arguments);
+}
 
-    printf(": ");
+void PageConsole::profile(JSC::ExecState* exec, const String& title)
+{
+    // FIXME: log a console message when profiling is disabled.
+    if (!InspectorInstrumentation::profilerEnabled(&m_page))
+        return;
 
-    printMessageSourceAndLevelPrefix(source, level);
+    // If no title is given, build the next user initiated profile title.
+    String resolvedTitle = title;
+    if (title.isNull())
+        resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(&m_page, true);
 
-    printf(" %s\n", message.utf8().data());
+    ScriptProfiler::start(exec, resolvedTitle);
+
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
+    const ScriptCallFrame& lastCaller = callStack->at(0);
+    InspectorInstrumentation::addStartProfilingMessageToConsole(&m_page, resolvedTitle, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL());
 }
 
-// static
-void PageConsole::mute()
+void PageConsole::profileEnd(JSC::ExecState* exec, const String& title)
 {
-    muteCount++;
+    if (!InspectorInstrumentation::profilerEnabled(&m_page))
+        return;
+
+    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(exec, title);
+    if (!profile)
+        return;
+
+    m_profiles.append(profile);
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
+    InspectorInstrumentation::addProfile(&m_page, profile, callStack);
 }
 
-// static
-void PageConsole::unmute()
+void PageConsole::time(JSC::ExecState*, const String& title)
 {
-    ASSERT(muteCount > 0);
-    muteCount--;
+    InspectorInstrumentation::startConsoleTiming(&m_page.mainFrame(), title);
 }
 
-static bool printExceptions = false;
+void PageConsole::timeEnd(JSC::ExecState* exec, const String& title)
+{
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
+    InspectorInstrumentation::stopConsoleTiming(&m_page.mainFrame(), title, callStack.release());
+}
 
-bool PageConsole::shouldPrintExceptions()
+void PageConsole::timeStamp(JSC::ExecState*, PassRefPtr<ScriptArguments> arguments)
 {
-    return printExceptions;
+    InspectorInstrumentation::consoleTimeStamp(&m_page.mainFrame(), arguments);
 }
 
-void PageConsole::setShouldPrintExceptions(bool print)
+void PageConsole::clearProfiles()
 {
-    printExceptions = print;
+    m_profiles.clear();
 }
 
 } // namespace WebCore
index 5ab7122..5041bec 100644 (file)
@@ -29,8 +29,8 @@
 #ifndef PageConsole_h
 #define PageConsole_h
 
-#include <inspector/ConsoleTypes.h>
 #include <inspector/ScriptCallStack.h>
+#include <runtime/ConsoleClient.h>
 #include <wtf/Forward.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -42,27 +42,39 @@ namespace WebCore {
 
 class Document;
 class Page;
+class ScriptProfile;
+typedef Vector<RefPtr<ScriptProfile>> ProfilesArray;
 
-class PageConsole {
+class PageConsole final : public JSC::ConsoleClient {
 public:
-    PageConsole(Page&);
-    ~PageConsole();
+    explicit PageConsole(Page&);
+    virtual ~PageConsole();
 
-    static void printSourceURLAndPosition(const String& sourceURL, unsigned lineNumber, unsigned columnNumber = 0);
-    static void printMessageSourceAndLevelPrefix(MessageSource, MessageLevel, bool showAsTrace = false);
-
-    void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, PassRefPtr<Inspector::ScriptCallStack> = 0, JSC::ExecState* = 0, unsigned long requestIdentifier = 0);
-    void addMessage(MessageSource, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>);
-    void addMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0, Document* = 0);
+    static bool shouldPrintExceptions();
+    static void setShouldPrintExceptions(bool);
 
     static void mute();
     static void unmute();
 
-    static bool shouldPrintExceptions();
-    static void setShouldPrintExceptions(bool);
+    void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, PassRefPtr<Inspector::ScriptCallStack> = nullptr, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
+    void addMessage(MessageSource, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>);
+    void addMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0, Document* = nullptr);
+
+    const ProfilesArray& profiles() const { return m_profiles; }
+    void clearProfiles();
+
+protected:
+    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>) override;
+    virtual void count(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>) override;
+    virtual void profile(JSC::ExecState*, const String& title) override;
+    virtual void profileEnd(JSC::ExecState*, const String& title) override;
+    virtual void time(JSC::ExecState*, const String& title) override;
+    virtual void timeEnd(JSC::ExecState*, const String& title) override;
+    virtual void timeStamp(JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>) override;
 
 private:
     Page& m_page;
+    ProfilesArray m_profiles;
 };
 
 } // namespace WebCore
index c1bb83d..16446e4 100644 (file)
@@ -22,7 +22,6 @@
 #include "config.h"
 #include "SVGDocumentExtensions.h"
 
-#include "Console.h"
 #include "DOMWindow.h"
 #include "Document.h"
 #include "EventListener.h"
index 60846b6..e77fe03 100644 (file)
@@ -36,7 +36,6 @@
 #include "ChromeClient.h"
 #include "ClientRect.h"
 #include "ClientRectList.h"
-#include "Console.h"
 #include "ContentDistributor.h"
 #include "Cursor.h"
 #include "DOMStringList.h"
@@ -74,6 +73,7 @@
 #include "MemoryCache.h"
 #include "MemoryInfo.h"
 #include "Page.h"
+#include "PageConsole.h"
 #include "PrintContext.h"
 #include "PseudoElement.h"
 #include "Range.h"
@@ -1447,7 +1447,7 @@ unsigned Internals::countMatchesForText(const String& text, unsigned findOptions
 
 const ProfilesArray& Internals::consoleProfiles() const
 {
-    return contextDocument()->domWindow()->console()->profiles();
+    return contextDocument()->page()->console().profiles();
 }
 
 unsigned Internals::numberOfLiveNodes() const
index 5b8e7eb..c4983bd 100644 (file)
@@ -46,9 +46,9 @@
 #include "Worker.h"
 #include "WorkerDebuggerAgent.h"
 #include "WorkerInspectorController.h"
-#include <inspector/ConsoleTypes.h>
 #include <inspector/InspectorAgentBase.h>
 #include <inspector/ScriptCallStack.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/MainThread.h>
 
 namespace WebCore {
index 003d0e2..1d55be3 100644 (file)
@@ -31,7 +31,7 @@
 #ifndef WorkerReportingProxy_h
 #define WorkerReportingProxy_h
 
-#include <inspector/ConsoleTypes.h>
+#include <runtime/ConsoleTypes.h>
 #include <wtf/Forward.h>
 
 namespace WebCore {
index d019fd8..6bc7bca 100644 (file)
@@ -1,3 +1,14 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::addMessageToConsole):
+        Update namespaces.
+
 2014-03-04  Zalan Bujtas  <zalan@apple.com>
 
         Enable device pixel repaint rect tracking.
index e1ff627..1a00e1e 100644 (file)
@@ -26,7 +26,6 @@
 #include "ChromeClientGtk.h"
 
 #include "Chrome.h"
-#include "Console.h"
 #include "DumpRenderTreeSupportGtk.h"
 #include "Editor.h"
 #include "Element.h"
@@ -362,7 +361,7 @@ bool ChromeClient::runBeforeUnloadConfirmPanel(const WTF::String& message, WebCo
     return runJavaScriptConfirm(frame, message);
 }
 
-void ChromeClient::addMessageToConsole(Inspector::MessageSource source, Inspector::MessageLevel level, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceId)
+void ChromeClient::addMessageToConsole(JSC::MessageSource source, JSC::MessageLevel level, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceId)
 {
     gboolean retval;
     g_signal_emit_by_name(m_webView, "console-message", message.utf8().data(), lineNumber, sourceId.utf8().data(), &retval);
index f2bc5b1..fa23bda 100644 (file)
@@ -1,3 +1,14 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        Update namespaces.
+
 2014-03-05  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Show external device name/type in placeholder
index 8719026..127adfe 100644 (file)
@@ -79,7 +79,7 @@ public:
     
     virtual void setResizable(bool) override;
     
-    virtual void addMessageToConsole(Inspector::MessageSource, Inspector::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceURL) override;
+    virtual void addMessageToConsole(JSC::MessageSource, JSC::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceURL) override;
 
     virtual bool canRunBeforeUnloadConfirmPanel() override;
     virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame*) override;
index 0f4fb67..65ff2de 100644 (file)
@@ -55,7 +55,6 @@
 #import <Foundation/Foundation.h>
 #import <WebCore/BlockExceptions.h>
 #import <WebCore/ColorChooser.h>
-#import <WebCore/Console.h>
 #import <WebCore/ContextMenu.h>
 #import <WebCore/ContextMenuController.h>
 #import <WebCore/Cursor.h>
@@ -95,7 +94,6 @@
 #endif
 
 #if PLATFORM(IOS)
-#import <WebCore/Console.h>
 #import <WebCore/WAKClipView.h>
 #import <WebCore/WAKWindow.h>
 #import <WebCore/WebCoreThreadMessage.h>
index 8444388..3e709ec 100644 (file)
@@ -1,3 +1,13 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        * WebCoreSupport/WebChromeClient.h:
+        Update namespaces.
+
 2014-03-04  Zalan Bujtas  <zalan@apple.com>
 
         Subpixel rendering: Make GraphicsLayer::fillRect FloatRoundedRect based and cleanup dependencies.
index 3576632..af099ec 100644 (file)
@@ -21,7 +21,7 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -38,7 +38,6 @@
 #include "WebSecurityOrigin.h"
 #include "WebView.h"
 #include <WebCore/BString.h>
-#include <WebCore/Console.h>
 #include <WebCore/ContextMenu.h>
 #include <WebCore/Cursor.h>
 #include <WebCore/FileChooser.h>
index 8066edf..34f894d 100644 (file)
@@ -77,7 +77,7 @@ public:
 
     virtual void setResizable(bool);
 
-    virtual void addMessageToConsole(Inspector::MessageSource, Inspector::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& url);
+    virtual void addMessageToConsole(JSC::MessageSource, JSC::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& url);
 
     virtual bool canRunBeforeUnloadConfirmPanel();
     virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame);
index 7383df7..1e7e8ad 100644 (file)
@@ -1,3 +1,13 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        * WebCoreSupport/ChromeClientWinCE.h:
+        Update namespaces.
+
 2014-02-24  Renata Hodovan  <rhodovan.u-szeged@partner.samsung.com>
 
         Get rid of the unused 'immediate' parameters from repaint related functions
index 1467d5c..6c568a7 100644 (file)
@@ -75,7 +75,7 @@ public:
 
     virtual void setResizable(bool) override;
 
-    virtual void addMessageToConsole(Inspector::MessageSource, Inspector::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceID) override;
+    virtual void addMessageToConsole(JSC::MessageSource, JSC::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceID) override;
 
     virtual bool canRunBeforeUnloadConfirmPanel() override;
     virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame*) override;
index 1a5d2a4..5539cc6 100644 (file)
@@ -1,3 +1,13 @@
+2014-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=127944
+
+        Reviewed by Geoffrey Garen.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Update namespaces.
+
 2014-03-06  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Close the page when the view is disposed instead of when finalized
index 346f30d..2536227 100644 (file)
@@ -90,7 +90,7 @@ private:
     
     virtual void setResizable(bool) override;
     
-    virtual void addMessageToConsole(Inspector::MessageSource, Inspector::MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID) override;
+    virtual void addMessageToConsole(JSC::MessageSource, JSC::MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID) override;
     
     virtual bool canRunBeforeUnloadConfirmPanel() override;
     virtual bool runBeforeUnloadConfirmPanel(const String& message, WebCore::Frame*) override;