diff options
author | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 23:46:31 +0000 |
---|---|---|
committer | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 23:46:31 +0000 |
commit | 6892170a2019fee4d7379327da4e4ca3810352db (patch) | |
tree | 2489887817f3f6109eea470f16fb8871acdd9918 /webkit | |
parent | 6abfeeb39355769268e42ab2d41eab2d11208091 (diff) | |
download | chromium_src-6892170a2019fee4d7379327da4e4ca3810352db.zip chromium_src-6892170a2019fee4d7379327da4e4ca3810352db.tar.gz chromium_src-6892170a2019fee4d7379327da4e4ca3810352db.tar.bz2 |
Merge 39141:39143: The ScriptCallStack (2/2)
Review URL: http://codereview.chromium.org/14092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/build/V8Bindings/SConscript | 3 | ||||
-rw-r--r-- | webkit/build/V8Bindings/V8Bindings.vcproj | 14 | ||||
-rw-r--r-- | webkit/build/WebCore/WebCore.vcproj | 4 | ||||
-rw-r--r-- | webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/dom/Window/console-trace-expected.txt | 1 | ||||
-rw-r--r-- | webkit/port/bindings/scripts/CodeGeneratorV8.pm | 15 | ||||
-rw-r--r-- | webkit/port/bindings/v8/ScriptCallFrame.cpp | 65 | ||||
-rw-r--r-- | webkit/port/bindings/v8/ScriptCallFrame.h | 75 | ||||
-rw-r--r-- | webkit/port/bindings/v8/ScriptCallStack.cpp | 60 | ||||
-rw-r--r-- | webkit/port/bindings/v8/ScriptCallStack.h | 59 | ||||
-rw-r--r-- | webkit/port/bindings/v8/ScriptString.h | 1 | ||||
-rw-r--r-- | webkit/port/bindings/v8/ScriptValue.h | 10 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.cpp | 103 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.h | 16 | ||||
-rw-r--r-- | webkit/port/page/inspector/InspectorController.cpp | 52 | ||||
-rw-r--r-- | webkit/webkit.xcodeproj/project.pbxproj | 18 |
15 files changed, 349 insertions, 147 deletions
diff --git a/webkit/build/V8Bindings/SConscript b/webkit/build/V8Bindings/SConscript index af3b92a..8f3aa71 100644 --- a/webkit/build/V8Bindings/SConscript +++ b/webkit/build/V8Bindings/SConscript @@ -326,7 +326,8 @@ inputs = [ '$PORT_DIR/bindings/v8/np_v8object.cpp', '$PORT_DIR/bindings/v8/npruntime.cpp', '$PORT_DIR/bindings/v8/RGBColor.cpp', - '$PORT_DIR/bindings/v8/ScriptCallContextV8.cpp', + '$PORT_DIR/bindings/v8/ScriptCallFrame.cpp', + '$PORT_DIR/bindings/v8/ScriptCallStack.cpp', '$PORT_DIR/bindings/v8/ScriptInstance.cpp', '$PORT_DIR/bindings/v8/ScriptValue.cpp', '$PORT_DIR/bindings/v8/v8_custom.cpp', diff --git a/webkit/build/V8Bindings/V8Bindings.vcproj b/webkit/build/V8Bindings/V8Bindings.vcproj index bf54ed6..5038105 100644 --- a/webkit/build/V8Bindings/V8Bindings.vcproj +++ b/webkit/build/V8Bindings/V8Bindings.vcproj @@ -2485,7 +2485,19 @@ >
</File>
<File
- RelativePath="..\..\port\bindings\v8\ScriptCallContextV8.cpp"
+ RelativePath="..\..\port\bindings\v8\ScriptCallFrame.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\port\bindings\v8\ScriptCallFrame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\port\bindings\v8\ScriptCallStack.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\port\bindings\v8\ScriptCallStack.h"
>
</File>
<File
diff --git a/webkit/build/WebCore/WebCore.vcproj b/webkit/build/WebCore/WebCore.vcproj index f1c228c..bbbaa00 100644 --- a/webkit/build/WebCore/WebCore.vcproj +++ b/webkit/build/WebCore/WebCore.vcproj @@ -446,10 +446,6 @@ >
</File>
<File
- RelativePath="..\..\..\third_party\WebKit\WebCore\page\ScriptCallContext.h"
- >
- </File>
- <File
RelativePath="..\..\..\third_party\WebKit\WebCore\page\SecurityOrigin.cpp"
>
</File>
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/dom/Window/console-trace-expected.txt b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/dom/Window/console-trace-expected.txt index 33f2e4d..19d6e7c 100644 --- a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/dom/Window/console-trace-expected.txt +++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/dom/Window/console-trace-expected.txt @@ -1,4 +1,3 @@ -CONSOLE MESSAGE: line 6: Uncaught Error: NOT_SUPPORTED_ERR: DOM Exception 9 Tests for absence of ASSERT in console.trace() due to incomplete inheritance chain. Test succeeds if this document doesn't crash a Debug build diff --git a/webkit/port/bindings/scripts/CodeGeneratorV8.pm b/webkit/port/bindings/scripts/CodeGeneratorV8.pm index 72d5a80..b128c8a 100644 --- a/webkit/port/bindings/scripts/CodeGeneratorV8.pm +++ b/webkit/port/bindings/scripts/CodeGeneratorV8.pm @@ -793,6 +793,11 @@ END push(@implContentDecls, " ExceptionCode ec = 0;\n"); } + if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { + push(@implContentDecls, " ScriptCallStack callStack(args, $numParameters);\n"); + $implIncludes{"ScriptCallStack.h"} = 1; + } + my $paramIndex = 0; foreach my $parameter (@{$function->parameters}) { my $parameterName = $parameter->name; @@ -1340,6 +1345,10 @@ sub GenerateFunctionCallString() if ($function->signature->extendedAttributes->{"v8implname"}) { $name = $function->signature->extendedAttributes->{"v8implname"}; } + + if ($function->signature->extendedAttributes->{"ImplementationFunction"}) { + $name = $function->signature->extendedAttributes->{"ImplementationFunction"}; + } my $functionString = "imp->${name}("; @@ -1385,6 +1394,12 @@ sub GenerateFunctionCallString() } $index++; } + + if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { + $functionString .= ", " if not $first; + $functionString .= "&callStack"; + if ($first) { $first = 0; } + } if (@{$function->raisesExceptions}) { $functionString .= ", " if not $first; diff --git a/webkit/port/bindings/v8/ScriptCallFrame.cpp b/webkit/port/bindings/v8/ScriptCallFrame.cpp new file mode 100644 index 0000000..bfcdd37 --- /dev/null +++ b/webkit/port/bindings/v8/ScriptCallFrame.cpp @@ -0,0 +1,65 @@ +// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * 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
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * 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
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER 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 "ScriptCallFrame.h" + +#include "PlatformString.h" +#include "v8.h" +#include "v8_binding.h" +#include "v8_proxy.h" +#include "ScriptValue.h" + +namespace WebCore { + + ScriptCallFrame::ScriptCallFrame(const String& functionName, + const String& urlString, + int lineNumber, + const v8::Arguments& arguments, + unsigned int skipArgumentCount) + : m_functionName(functionName) + , m_sourceURL(urlString) + , m_lineNumber(lineNumber) + { + for (int i = 0; i < arguments.Length(); ++i) { + m_arguments.append(ScriptValue(arguments[i])); + } + } + + ScriptCallFrame::~ScriptCallFrame() + { + } + + const ScriptValue& ScriptCallFrame::argumentAt(unsigned index) const + { + ASSERT(m_arguments.size() > index); + return m_arguments[index]; + } + +} // namespace WebCore diff --git a/webkit/port/bindings/v8/ScriptCallFrame.h b/webkit/port/bindings/v8/ScriptCallFrame.h new file mode 100644 index 0000000..bf6f1a7 --- /dev/null +++ b/webkit/port/bindings/v8/ScriptCallFrame.h @@ -0,0 +1,75 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * 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 +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * 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 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER 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 ScriptCallFrame_h +#define ScriptCallFrame_h + +#include "KURL.h" +#include <wtf/Vector.h> +#include "ScriptString.h" + +namespace v8 { + class Arguments; +} + +namespace WebCore { + class ScriptValue; + + // FIXME: Implement retrieving line number and source URL and storing here + // for all call frames, not just the first one. + // See <https://bugs.webkit.org/show_bug.cgi?id=22556> and + // <https://bugs.webkit.org/show_bug.cgi?id=21180> + class ScriptCallFrame { + public: + ScriptCallFrame(const String& functionName, + const String& urlString, + int lineNumber, + const v8::Arguments&, + unsigned skipArgumentCount); + ~ScriptCallFrame(); + + const ScriptString& functionName() const { return m_functionName; } + const KURL& sourceURL() const { return m_sourceURL; } + unsigned lineNumber() const { return m_lineNumber; } + + // argument retrieval methods + const ScriptValue& argumentAt(unsigned) const; + unsigned argumentCount() const { return m_arguments.size(); } + + private: + ScriptString m_functionName; + KURL m_sourceURL; + unsigned m_lineNumber; + + Vector<ScriptValue> m_arguments; + }; + +} // namespace WebCore + +#endif // ScriptCallFrame_h diff --git a/webkit/port/bindings/v8/ScriptCallStack.cpp b/webkit/port/bindings/v8/ScriptCallStack.cpp new file mode 100644 index 0000000..0ebb912 --- /dev/null +++ b/webkit/port/bindings/v8/ScriptCallStack.cpp @@ -0,0 +1,60 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * 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 +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * 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 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER 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 "ScriptCallStack.h" + +#include "v8.h" +#include "v8_binding.h" +#include "v8_proxy.h" + +namespace WebCore { + +ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, + unsigned skipArgumentCount) + : m_lastCaller(String(), V8Proxy::GetSourceName(), + V8Proxy::GetSourceLineNumber() + 1, arguments, + skipArgumentCount) +{ +} + +ScriptCallStack::~ScriptCallStack() +{ +} + +const ScriptCallFrame& ScriptCallStack::at(unsigned index) const +{ + // Currently, only one ScriptCallFrame is supported. When we can get + // a full stack trace from V8, we can do this right. + ASSERT(index == 0); + + return m_lastCaller; +} + +} // namespace WebCore diff --git a/webkit/port/bindings/v8/ScriptCallStack.h b/webkit/port/bindings/v8/ScriptCallStack.h new file mode 100644 index 0000000..d3cfe04 --- /dev/null +++ b/webkit/port/bindings/v8/ScriptCallStack.h @@ -0,0 +1,59 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * 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 +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * 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 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER 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 ScriptCallStack_h +#define ScriptCallStack_h + +#include "ScriptCallFrame.h" +#include "ScriptValue.h" +#include <wtf/Noncopyable.h> + +namespace v8 { + class Arguments; +} + +namespace WebCore { + + class ScriptCallStack : public Noncopyable { + public: + ScriptCallStack(const v8::Arguments&, unsigned skipArgumentCount = 0); + ~ScriptCallStack(); + + // frame retrieval methods + const ScriptCallFrame &at(unsigned) const; + // TODO(dglazkov): implement retrieving and storing call stack trace + unsigned size() const { return 1; } + + private: + ScriptCallFrame m_lastCaller; + }; + +} // namespace WebCore + +#endif // ScriptCallStack_h diff --git a/webkit/port/bindings/v8/ScriptString.h b/webkit/port/bindings/v8/ScriptString.h index fd379e3..e6eb036 100644 --- a/webkit/port/bindings/v8/ScriptString.h +++ b/webkit/port/bindings/v8/ScriptString.h @@ -37,6 +37,7 @@ namespace WebCore { class ScriptString { public: + ScriptString(const String& s) : m_str(s) {} ScriptString(const char* s) : m_str(s) {} operator String() const { return m_str; } diff --git a/webkit/port/bindings/v8/ScriptValue.h b/webkit/port/bindings/v8/ScriptValue.h index 5106cb4..ff3556f 100644 --- a/webkit/port/bindings/v8/ScriptValue.h +++ b/webkit/port/bindings/v8/ScriptValue.h @@ -92,6 +92,16 @@ public: return !operator==(value); } + bool isNull() const + { + return m_value->IsNull(); + } + + bool isUndefined() const + { + return m_value->IsUndefined(); + } + void clear() { if (!m_value.IsEmpty()) { #ifndef NDEBUG diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index da488ba..e4ae777 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -100,7 +100,6 @@ #include "RenderPartObject.h" #include "RenderWidget.h" #include "ScheduledAction.h" -#include "ScriptCallContext.h" #include "ScriptState.h" #include "ScriptController.h" #include "SecurityOrigin.h" @@ -2296,108 +2295,6 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData) { } -// Console --------------------------------------------------------------------- - -CALLBACK_FUNC_DECL(ConsoleAssert) { - INC_STATS("DOM.Console.assert()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleCount) { - INC_STATS("DOM.Console.count()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleDebug) { - INC_STATS("DOM.Console.debug()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleDir) { - INC_STATS("DOM.Console.dir()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleError) { - INC_STATS("DOM.Console.error()"); - v8::Handle<v8::Value> holder = args.Holder(); - Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); - ScriptCallContext context(args); - imp->error(&context); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleGroup) { - INC_STATS("DOM.Console.group()"); - v8::Handle<v8::Value> holder = args.Holder(); - Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); - ScriptCallContext context(args); - imp->group(&context); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleInfo) { - INC_STATS("DOM.Console.info()"); - v8::Handle<v8::Value> holder = args.Holder(); - Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); - ScriptCallContext context(args); - imp->info(&context); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleLog) { - INC_STATS("DOM.Console.log()"); - v8::Handle<v8::Value> holder = args.Holder(); - Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); - ScriptCallContext context(args); - imp->log(&context); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleProfile) { - INC_STATS("DOM.Console.profile()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleProfileEnd) { - INC_STATS("DOM.Console.profileEnd()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleTimeEnd) { - INC_STATS("DOM.Console.timeEnd()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleWarn) { - INC_STATS("DOM.Console.warn()"); - v8::Handle<v8::Value> holder = args.Holder(); - Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); - ScriptCallContext context(args); - imp->warn(&context); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleDirxml) { - INC_STATS("DOM.Console.dirxml()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(ConsoleTrace) { - INC_STATS("DOM.Console.trace()"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); - return v8::Undefined(); -} - - // Clipboard ------------------------------------------------------------------- diff --git a/webkit/port/bindings/v8/v8_custom.h b/webkit/port/bindings/v8/v8_custom.h index 08ea4bc..ce7bd03 100644 --- a/webkit/port/bindings/v8/v8_custom.h +++ b/webkit/port/bindings/v8/v8_custom.h @@ -267,22 +267,6 @@ DECLARE_CALLBACK(CanvasRenderingContext2DFillText) DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText) DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData) -// Console customized functions -DECLARE_CALLBACK(ConsoleAssert) -DECLARE_CALLBACK(ConsoleCount) -DECLARE_CALLBACK(ConsoleDebug) -DECLARE_CALLBACK(ConsoleDir) -DECLARE_CALLBACK(ConsoleError) -DECLARE_CALLBACK(ConsoleGroup) -DECLARE_CALLBACK(ConsoleInfo) -DECLARE_CALLBACK(ConsoleLog) -DECLARE_CALLBACK(ConsoleProfile) -DECLARE_CALLBACK(ConsoleProfileEnd) -DECLARE_CALLBACK(ConsoleTimeEnd) -DECLARE_CALLBACK(ConsoleWarn) -DECLARE_CALLBACK(ConsoleDirxml) -DECLARE_CALLBACK(ConsoleTrace) - // Implementation of Clipboard attributes and methods. DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes) DECLARE_CALLBACK(ClipboardClearData) diff --git a/webkit/port/page/inspector/InspectorController.cpp b/webkit/port/page/inspector/InspectorController.cpp index 773dbdd..c8a5c4c 100644 --- a/webkit/port/page/inspector/InspectorController.cpp +++ b/webkit/port/page/inspector/InspectorController.cpp @@ -63,7 +63,7 @@ #include "Range.h" #include "ResourceRequest.h" #include "ResourceResponse.h" -#include "ScriptCallContext.h" +#include "ScriptCallStack.h" #include "ScriptController.h" #include "Settings.h" #include "SharedBuffer.h" @@ -135,26 +135,28 @@ struct ConsoleMessage { { } - ConsoleMessage(MessageSource s, MessageLevel l, ScriptCallContext* context, unsigned g) + ConsoleMessage(MessageSource s, MessageLevel l, ScriptCallStack* callStack, unsigned g) : source(s) , level(l) #if USE(JSC) - , wrappedArguments(args.size()) + , wrappedArguments(callStack->at(0).argumentCount()) #elif USE(V8) - , arguments(context->argumentCount()) + , arguments(callStack->at(0).argumentCount()) #endif - , line(context->lineNumber()) - , url(context->sourceURL()) , groupLevel(g) , repeatCount(1) { + const ScriptCallFrame& lastCaller = callStack->at(0); + line = lastCaller.lineNumber(); + url = lastCaller.sourceURL().string(); + #if USE(JSC) JSLock lock(false); - for (unsigned i = 0; i < context->argumentCount(); ++i) - wrappedArguments[i] = JSInspectedObjectWrapper::wrap(context->argumentAt(i)); + for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) + wrappedArguments[i] = JSInspectedObjectWrapper::wrap(callStack->state(), lastCaller.argumentAt(i).jsValue()); #elif USE(V8) - for (unsigned i = 0; i < context->argumentCount(); ++i) { - arguments[i] = context->argumentAt(i); + for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) { + arguments[i] = lastCaller.argumentAt(i); } #endif } @@ -810,12 +812,12 @@ void InspectorController::addDatabaseScriptResource(InspectorDatabaseResource*) // TODO(aa): Implement database support for inspector. } -void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, ScriptCallContext* context) +void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, ScriptCallStack* callStack) { if (!enabled()) return; - addConsoleMessage(context, new ConsoleMessage(source, level, context, m_groupLevel)); + addConsoleMessage(0, new ConsoleMessage(source, level, callStack, m_groupLevel)); } void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID) @@ -826,7 +828,7 @@ void InspectorController::addMessageToConsole(MessageSource source, MessageLevel addConsoleMessage(0, new ConsoleMessage(source, level, message, lineNumber, sourceID, m_groupLevel)); } -void InspectorController::addConsoleMessage(ScriptCallContext* context, ConsoleMessage* consoleMessage) +void InspectorController::addConsoleMessage(ScriptState*, ConsoleMessage* consoleMessage) { ASSERT(enabled()); ASSERT_ARG(consoleMessage, consoleMessage); @@ -860,11 +862,11 @@ void InspectorController::clearConsoleMessages() m_previousMessage = 0; } -void InspectorController::startGroup(MessageSource source, ScriptCallContext* context) +void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack) { ++m_groupLevel; - addConsoleMessage(context, new ConsoleMessage(source, StartGroupMessageLevel, context, m_groupLevel)); + addConsoleMessage(0, new ConsoleMessage(source, StartGroupMessageLevel, callStack, m_groupLevel)); } void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL) @@ -1803,4 +1805,24 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const drawHighlightForBoxes(context, lineBoxRects, contentBox, paddingBox, borderBox, marginBox); } +// TODO(dglazkov): These next three methods should be easy to implement or gain +// for free when we unfork inspector + +void InspectorController::count(const String& title, unsigned lineNumber, const String& sourceID) +{ + notImplemented(); +} + +void InspectorController::startTiming(const String& title) +{ + notImplemented(); +} + +bool InspectorController::stopTiming(const String& title, double& elapsed) +{ + elapsed = 0; + notImplemented(); + return false; +} + } // namespace WebCore diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj index 3a02fe8..6a4fc5e 100644 --- a/webkit/webkit.xcodeproj/project.pbxproj +++ b/webkit/webkit.xcodeproj/project.pbxproj @@ -41,6 +41,8 @@ 04C3AFC30EF1E43D0046D578 /* NavigatorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04C3AFC20EF1E43D0046D578 /* NavigatorBase.cpp */; }; 04C3AFC60EF1E45F0046D578 /* WorkerNavigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04C3AFC50EF1E45F0046D578 /* WorkerNavigator.cpp */; }; 416F45220ED7697D008215B6 /* FrameLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416F45210ED7697D008215B6 /* FrameLoaderClient.cpp */; }; + 419107560EF319C300BFDCC5 /* ScriptCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419107550EF319C300BFDCC5 /* ScriptCallFrame.cpp */; }; + 4191075F0EF319FC00BFDCC5 /* ScriptCallStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4191075E0EF319FC00BFDCC5 /* ScriptCallStack.cpp */; }; 41AF32C60EE5E6ED00BF6361 /* ScriptInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41AF32C40EE5E6ED00BF6361 /* ScriptInstance.cpp */; }; 4D11C5520E9AC23100EF7617 /* RenderThemeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E49E50DE0E65E33200AD47F7 /* RenderThemeMac.mm */; }; 4D1637CC0EBFA49E008F024E /* SQLiteAuthorizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D1637C30EBFA49E008F024E /* SQLiteAuthorizer.cpp */; }; @@ -563,7 +565,6 @@ E40054A70E9BC4C20055B38E /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40054A60E9BC4C20055B38E /* RefCountedLeakCounter.cpp */; }; E40054B10E9BCC5C0055B38E /* CollatorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40054B00E9BCC5C0055B38E /* CollatorICU.cpp */; }; E40060DB0EA69E0B0055B38E /* ScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40060DA0EA69E0B0055B38E /* ScriptController.cpp */; }; - E40063610EA907510055B38E /* ScriptCallContextV8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40063600EA907510055B38E /* ScriptCallContextV8.cpp */; }; E40064540EA90AA10055B38E /* Console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E8E3D0D7F3C48001ECF42 /* Console.cpp */; }; E4006ABA0EC235870055B38E /* AXObjectCacheChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4006AB90EC235870055B38E /* AXObjectCacheChromium.cpp */; }; E40FB28F0EAFF0BC006F380A /* PlatformScreenMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E40FB28E0EAFF0BC006F380A /* PlatformScreenMac.mm */; }; @@ -1445,6 +1446,10 @@ 04C3AFC70EF1E4650046D578 /* WorkerNavigator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerNavigator.h; sourceTree = "<group>"; }; 416F45210ED7697D008215B6 /* FrameLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoaderClient.cpp; sourceTree = "<group>"; }; 419106470EF2D6D500BFDCC5 /* ScriptState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptState.h; sourceTree = "<group>"; }; + 419107540EF319C300BFDCC5 /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = "<group>"; }; + 419107550EF319C300BFDCC5 /* ScriptCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallFrame.cpp; sourceTree = "<group>"; }; + 4191075D0EF319FC00BFDCC5 /* ScriptCallStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStack.h; sourceTree = "<group>"; }; + 4191075E0EF319FC00BFDCC5 /* ScriptCallStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStack.cpp; sourceTree = "<group>"; }; 41AF32C40EE5E6ED00BF6361 /* ScriptInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptInstance.cpp; sourceTree = "<group>"; }; 41AF32C50EE5E6ED00BF6361 /* ScriptInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptInstance.h; sourceTree = "<group>"; }; 4D1637C30EBFA49E008F024E /* SQLiteAuthorizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteAuthorizer.cpp; sourceTree = "<group>"; }; @@ -1520,7 +1525,6 @@ 4D1640E10EC29BB4008F024E /* PositionOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionOptions.h; sourceTree = "<group>"; }; 4D1640E20EC29BB4008F024E /* PrintContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintContext.cpp; sourceTree = "<group>"; }; 4D1640E30EC29BB4008F024E /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; }; - 4D1640E40EC29BB4008F024E /* ScriptCallContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallContext.h; sourceTree = "<group>"; }; 4D1641140EC29D01008F024E /* GeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationService.cpp; sourceTree = "<group>"; }; 4D1641150EC29D01008F024E /* GeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationService.h; sourceTree = "<group>"; }; 4D1641160EC29D01008F024E /* HostWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostWindow.h; sourceTree = "<group>"; }; @@ -4217,7 +4221,6 @@ E40054B30E9BCC720055B38E /* Collator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Collator.h; sourceTree = "<group>"; }; E40060D90EA69E0B0055B38E /* ScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptController.h; sourceTree = "<group>"; }; E40060DA0EA69E0B0055B38E /* ScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptController.cpp; sourceTree = "<group>"; }; - E40063600EA907510055B38E /* ScriptCallContextV8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallContextV8.cpp; sourceTree = "<group>"; }; E40063760EA908220055B38E /* ScriptCallContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScriptCallContext.cpp; path = ../third_party/WebKit/WebCore/bindings/js/ScriptCallContext.cpp; sourceTree = SOURCE_ROOT; }; E4006AB90EC235870055B38E /* AXObjectCacheChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AXObjectCacheChromium.cpp; sourceTree = "<group>"; }; E40FB28E0EAFF0BC006F380A /* PlatformScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformScreenMac.mm; path = mac/PlatformScreenMac.mm; sourceTree = "<group>"; }; @@ -4508,7 +4511,10 @@ 7B0095DA0DAFF0DC00F72082 /* npruntime_priv.h */, 934CC2270EDCC37600A658F2 /* RGBColor.cpp */, 934CC2290EDCC38400A658F2 /* RGBColor.h */, - E40063600EA907510055B38E /* ScriptCallContextV8.cpp */, + 419107550EF319C300BFDCC5 /* ScriptCallFrame.cpp */, + 419107540EF319C300BFDCC5 /* ScriptCallFrame.h */, + 4191075E0EF319FC00BFDCC5 /* ScriptCallStack.cpp */, + 4191075D0EF319FC00BFDCC5 /* ScriptCallStack.h */, E40060D90EA69E0B0055B38E /* ScriptController.h */, E40060DA0EA69E0B0055B38E /* ScriptController.cpp */, 41AF32C50EE5E6ED00BF6361 /* ScriptInstance.h */, @@ -5566,7 +5572,6 @@ 4D1640E30EC29BB4008F024E /* PrintContext.h */, 7B5E8F130D7F3C49001ECF42 /* Screen.cpp */, 7B5E8F140D7F3C49001ECF42 /* Screen.h */, - 4D1640E40EC29BB4008F024E /* ScriptCallContext.h */, 7B5E918C0D7F3CC2001ECF42 /* SecurityOrigin.cpp */, 7B5E918D0D7F3CC2001ECF42 /* SecurityOrigin.h */, 7B5E918E0D7F3CC2001ECF42 /* SecurityOriginHash.h */, @@ -8143,6 +8148,8 @@ 7B0095F30DAFF0DD00F72082 /* np_v8object.cpp in Sources */, 7B0095F50DAFF0DD00F72082 /* npruntime.cpp in Sources */, 934CC2280EDCC37600A658F2 /* RGBColor.cpp in Sources */, + 419107560EF319C300BFDCC5 /* ScriptCallFrame.cpp in Sources */, + 4191075F0EF319FC00BFDCC5 /* ScriptCallStack.cpp in Sources */, 41AF32C60EE5E6ED00BF6361 /* ScriptInstance.cpp in Sources */, 934CC3590EDCCEFE00A658F2 /* ScriptValue.cpp in Sources */, 7B0091390DAFEFBE00F72082 /* SVGElementFactory.cpp in Sources */, @@ -9385,7 +9392,6 @@ 7B2B0A650E3143EC00D4C6B7 /* PNGImageDecoder.cpp in Sources */, E473F6600EAE00A6006C2098 /* PopupMenuChromium.cpp in Sources */, 4D11C5520E9AC23100EF7617 /* RenderThemeMac.mm in Sources */, - E40063610EA907510055B38E /* ScriptCallContextV8.cpp in Sources */, E40060DB0EA69E0B0055B38E /* ScriptController.cpp in Sources */, E473F6620EAE00D5006C2098 /* ScrollView.cpp in Sources */, E473F6640EAE00E4006C2098 /* SearchPopupMenuChromium.cpp in Sources */, |