Changeset 165199 in webkit for trunk/Source/JavaScriptCore/runtime/ConsoleClient.h
- Timestamp:
- Mar 6, 2014, 11:33:51 AM (11 years ago)
- Author:
- Joseph Pecoraro
- Message:
-
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.
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:
- File:
-
- 1 added