summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/v8')
-rw-r--r--WebCore/bindings/v8/DebuggerScript.js4
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.cpp21
-rw-r--r--WebCore/bindings/v8/ScriptCallFrame.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptCallFrame.h9
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.cpp10
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.h1
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptController.h2
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp8
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h2
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.cpp7
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/v8/ScriptProfiler.cpp2
-rw-r--r--WebCore/bindings/v8/ScriptStringImpl.h77
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.cpp8
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.h4
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.cpp22
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp6
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp2
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp72
-rw-r--r--WebCore/bindings/v8/V8Proxy.h30
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp17
-rw-r--r--WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp139
-rw-r--r--WebCore/bindings/v8/custom/V8ElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp (renamed from WebCore/bindings/v8/ScriptStringImpl.cpp)55
-rwxr-xr-x[-rw-r--r--]WebCore/bindings/v8/custom/V8FileReaderCustom.cpp (renamed from WebCore/bindings/v8/ScriptString.h)58
-rw-r--r--WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8LocationCustom.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp8
40 files changed, 321 insertions, 306 deletions
diff --git a/WebCore/bindings/v8/DebuggerScript.js b/WebCore/bindings/v8/DebuggerScript.js
index 0222296..6026214 100644
--- a/WebCore/bindings/v8/DebuggerScript.js
+++ b/WebCore/bindings/v8/DebuggerScript.js
@@ -98,7 +98,9 @@ DebuggerScript.setBreakpoint = function(execState, args)
Debug.disableScriptBreakPoint(breakId);
var locations = Debug.findBreakPointActualLocations(breakId);
- var actualLineNumber = locations.length ? locations[0].line : args.lineNumber;
+ if (!locations.length)
+ return undefined;
+ var actualLineNumber = locations[0].line;
var key = args.scriptId + ":" + actualLineNumber;
if (key in DebuggerScript._breakpoints) {
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp
index a000a7d..4a58853 100644
--- a/WebCore/bindings/v8/IDBBindingUtilities.cpp
+++ b/WebCore/bindings/v8/IDBBindingUtilities.cpp
@@ -58,9 +58,28 @@ bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value)
return true;
}
+class LocalContext {
+public:
+ LocalContext()
+ : m_context(v8::Context::New())
+ {
+ m_context->Enter();
+ }
+
+ ~LocalContext()
+ {
+ m_context->Exit();
+ m_context.Dispose();
+ }
+
+private:
+ v8::HandleScope m_scope;
+ v8::Persistent<v8::Context> m_context;
+};
+
PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const Vector<IDBKeyPathElement>& keyPath)
{
- v8::HandleScope scope;
+ LocalContext localContext;
v8::Handle<v8::Value> v8Value(value->deserialize());
for (size_t i = 0; i < keyPath.size(); ++i) {
switch (keyPath[i].type) {
diff --git a/WebCore/bindings/v8/ScriptCallFrame.cpp b/WebCore/bindings/v8/ScriptCallFrame.cpp
index 9554f67..f0c7343 100644
--- a/WebCore/bindings/v8/ScriptCallFrame.cpp
+++ b/WebCore/bindings/v8/ScriptCallFrame.cpp
@@ -42,7 +42,7 @@ namespace WebCore {
ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber, const v8::Arguments& arguments, unsigned skipArgumentCount)
: m_functionName(functionName)
- , m_sourceURL(ParsedURLString, urlString)
+ , m_sourceURL(urlString)
, m_lineNumber(lineNumber)
{
for (int i = skipArgumentCount; i < arguments.Length(); ++i)
@@ -51,7 +51,7 @@ ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlSt
ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber)
: m_functionName(functionName)
- , m_sourceURL(ParsedURLString, urlString)
+ , m_sourceURL(urlString)
, m_lineNumber(lineNumber)
{
}
diff --git a/WebCore/bindings/v8/ScriptCallFrame.h b/WebCore/bindings/v8/ScriptCallFrame.h
index 8d1972f..ff77d4a 100644
--- a/WebCore/bindings/v8/ScriptCallFrame.h
+++ b/WebCore/bindings/v8/ScriptCallFrame.h
@@ -32,7 +32,6 @@
#define ScriptCallFrame_h
#include "KURL.h"
-#include "ScriptString.h"
#include <wtf/Vector.h>
@@ -53,8 +52,8 @@ namespace WebCore {
ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber);
~ScriptCallFrame();
- const ScriptString& functionName() const { return m_functionName; }
- const KURL& sourceURL() const { return m_sourceURL; }
+ const String& functionName() const { return m_functionName; }
+ const String& sourceURL() const { return m_sourceURL; }
unsigned lineNumber() const { return m_lineNumber; }
// argument retrieval methods
@@ -62,8 +61,8 @@ namespace WebCore {
unsigned argumentCount() const { return m_arguments.size(); }
private:
- ScriptString m_functionName;
- KURL m_sourceURL;
+ String m_functionName;
+ String m_sourceURL;
unsigned m_lineNumber;
Vector<ScriptValue> m_arguments;
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
index 7c07829..3e29c7a 100644
--- a/WebCore/bindings/v8/ScriptCallStack.cpp
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -44,7 +44,7 @@ namespace WebCore {
static void getFrameLocation(v8::Handle<v8::StackFrame> frame, String* sourceName, int* sourceLineNumber, String* functionName)
{
ASSERT(!frame.IsEmpty());
- v8::Local<v8::String> sourceNameValue(frame->GetScriptName());
+ v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
*sourceName = sourceNameValue.IsEmpty() ? "" : toWebCoreString(sourceNameValue);
*functionName = functionNameValue.IsEmpty() ? "" : toWebCoreString(functionNameValue);
@@ -85,13 +85,19 @@ static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<
}
const int ScriptCallStack::maxCallStackSizeToCapture = 200;
+const v8::StackTrace::StackTraceOptions ScriptCallStack::stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
+ v8::StackTrace::kLineNumber
+ | v8::StackTrace::kColumnOffset
+ | v8::StackTrace::kScriptNameOrSourceURL
+ | v8::StackTrace::kFunctionName);
+
PassOwnPtr<ScriptCallStack> ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount, int framCountLimit)
{
v8::HandleScope scope;
v8::Local<v8::Context> context = v8::Context::GetCurrent();
v8::Context::Scope contextScope(context);
- v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(framCountLimit));
+ v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(framCountLimit, ScriptCallStack::stackTraceOptions));
if (stackTrace.IsEmpty())
return 0;
diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h
index 215cdec..98e5195 100644
--- a/WebCore/bindings/v8/ScriptCallStack.h
+++ b/WebCore/bindings/v8/ScriptCallStack.h
@@ -48,6 +48,7 @@ class InspectorArray;
class ScriptCallStack : public Noncopyable {
public:
static const int maxCallStackSizeToCapture;
+ static const v8::StackTrace::StackTraceOptions stackTraceOptions;
static PassOwnPtr<ScriptCallStack> create(const v8::Arguments&, unsigned skipArgumentCount = 0, int framCountLimit = 1);
static PassOwnPtr<ScriptCallStack> create(ScriptState*, v8::Handle<v8::StackTrace>);
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 8018a18..913a892 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -479,9 +479,9 @@ void ScriptController::clearWindowShell(bool)
}
#if ENABLE(INSPECTOR)
-void ScriptController::setCaptureCallStackForUncaughtExceptions(bool)
+void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value)
{
- v8::V8::SetCaptureStackTraceForUncaughtExceptions(true, ScriptCallStack::maxCallStackSizeToCapture);
+ v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
}
#endif
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 8ac9064..63f1c17 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -76,7 +76,7 @@ public:
ScriptValue executeScript(const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
// Returns true if argument is a JavaScript URL.
- bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
+ bool executeIfJavaScriptURL(const KURL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
// This function must be called from the main thread. It is safe to call it repeatedly.
static void initializeThreading();
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index 3f1a0c5..7a8dbf7 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -225,10 +225,14 @@ void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOn
setPauseOnExceptionsFunction->Call(m_debuggerScript.get(), 1, argv);
}
-void ScriptDebugServer::pause()
+void ScriptDebugServer::setPauseOnNextStatement(bool pause)
{
- if (!m_pausedPage)
+ if (m_pausedPage)
+ return;
+ if (pause)
v8::Debug::DebugBreak();
+ else
+ v8::Debug::CancelDebugBreak();
}
void ScriptDebugServer::breakProgram()
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
index d1fd71f..5c5d6c6 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.h
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -70,7 +70,7 @@ public:
PauseOnExceptionsState pauseOnExceptionsState();
void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState);
- void pause();
+ void setPauseOnNextStatement(bool pause);
void breakProgram();
void continueProgram();
void stepIntoStatement();
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp
index 29dbb02..3ea536e 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/v8/ScriptFunctionCall.cpp
@@ -33,7 +33,6 @@
#include "ScriptScope.h"
#include "ScriptState.h"
-#include "ScriptString.h"
#include "ScriptValue.h"
#include "V8Binding.h"
@@ -54,12 +53,6 @@ void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument)
m_arguments.append(argument);
}
-void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8String(argument));
-}
-
void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument)
{
m_arguments.append(argument);
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h
index 04dddc8..d4f63ac 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.h
+++ b/WebCore/bindings/v8/ScriptFunctionCall.h
@@ -39,14 +39,12 @@
namespace WebCore {
class ScriptValue;
class ScriptState;
- class ScriptString;
class ScriptCallArgumentHandler {
public:
ScriptCallArgumentHandler(ScriptState* scriptState) : m_scriptState(scriptState) { }
void appendArgument(const ScriptObject&);
- void appendArgument(const ScriptString&);
void appendArgument(const ScriptValue&);
void appendArgument(const String&);
void appendArgument(const char*);
diff --git a/WebCore/bindings/v8/ScriptProfiler.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp
index ab7cfa7..02dea14 100644
--- a/WebCore/bindings/v8/ScriptProfiler.cpp
+++ b/WebCore/bindings/v8/ScriptProfiler.cpp
@@ -32,9 +32,9 @@
#include "ScriptProfiler.h"
#include "InspectorValues.h"
-#include "ScriptString.h"
#include <v8-profiler.h>
+#include <V8Binding.h>
namespace WebCore {
diff --git a/WebCore/bindings/v8/ScriptStringImpl.h b/WebCore/bindings/v8/ScriptStringImpl.h
deleted file mode 100644
index 84a25c4..0000000
--- a/WebCore/bindings/v8/ScriptStringImpl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * 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 ScriptStringImpl_h
-#define ScriptStringImpl_h
-
-#include "OwnHandle.h"
-#include "PlatformString.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-// This class is used for strings that tend to be shared with JavaScript frequently. The JSC implementation uses wtf::UString - see bindings/js/ScriptString.h
-// Currently XMLHttpRequest uses a ScriptString to build up the responseText attribute. As data arrives from the network, it is appended to the ScriptString
-// via operator+= and a JavaScript readystatechange event is fired. JavaScript can access the responseText attribute of the XMLHttpRequest object. JavaScript
-// may also query the responseXML attribute of the XMLHttpRequest object which results in the responseText attribute being coerced into a WTF::String and
-// then parsed as an XML document.
-// This implementation optimizes for the common case where the responseText is built up with many calls to operator+= before the actual text is queried.
-class ScriptStringImpl : public RefCounted<ScriptStringImpl> {
-public:
- static PassRefPtr<ScriptStringImpl> create(const String& s)
- {
- return adoptRef(new ScriptStringImpl(s));
- }
-
- static PassRefPtr<ScriptStringImpl> create(const char* s)
- {
- return adoptRef(new ScriptStringImpl(s));
- }
-
- String toString() const;
-
- bool isNull() const;
- size_t size() const;
-
- void append(const String& s);
-
- v8::Handle<v8::String> v8StringHandle() { return m_handle.get(); }
-
-private:
- ScriptStringImpl(const String& s);
- ScriptStringImpl(const char* s);
-
- OwnHandle<v8::String> m_handle;
-};
-
-} // namespace WebCore
-
-#endif // ScriptStringImpl_h
diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp
index 4e5354e..ff92167 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.cpp
+++ b/WebCore/bindings/v8/SerializedScriptValue.cpp
@@ -1105,7 +1105,7 @@ SerializedScriptValue* SerializedScriptValue::nullValue()
PassRefPtr<SerializedScriptValue> SerializedScriptValue::release()
{
RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData));
- m_data = String();
+ m_data = String().crossThreadString();
return result.release();
}
@@ -1123,18 +1123,18 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, bool&
didThrow = true;
return;
}
- m_data = StringImpl::adopt(writer.data());
+ m_data = String(StringImpl::adopt(writer.data())).crossThreadString();
}
SerializedScriptValue::SerializedScriptValue(String data, StringDataMode mode)
{
if (mode == WireData)
- m_data = data;
+ m_data = data.crossThreadString();
else {
ASSERT(mode == StringValue);
Writer writer;
writer.writeWebCoreString(data);
- m_data = StringImpl::adopt(writer.data());
+ m_data = String(StringImpl::adopt(writer.data())).crossThreadString();
}
}
diff --git a/WebCore/bindings/v8/SerializedScriptValue.h b/WebCore/bindings/v8/SerializedScriptValue.h
index 275e5f2..b534a57 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.h
+++ b/WebCore/bindings/v8/SerializedScriptValue.h
@@ -33,11 +33,11 @@
#include "ScriptValue.h"
#include <v8.h>
-#include <wtf/RefCounted.h>
+#include <wtf/Threading.h>
namespace WebCore {
-class SerializedScriptValue : public RefCounted<SerializedScriptValue> {
+class SerializedScriptValue : public ThreadSafeShared<SerializedScriptValue> {
public:
static void deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName,
v8::PropertyAttribute, SerializedScriptValue*);
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index bea1eb8..1a39a15 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -37,7 +37,6 @@
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
-#include "InspectorTimelineAgent.h"
#include "Page.h"
#include "PageGroup.h"
#include "ScriptController.h"
@@ -342,30 +341,19 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob
// Used to avoid sleep calls in unload handlers.
if (!V8Proxy::registeredExtensionWithV8(DateExtension::get()))
- V8Proxy::registerExtension(DateExtension::get(), String());
+ V8Proxy::registerExtension(DateExtension::get());
// Dynamically tell v8 about our extensions now.
const V8Extensions& extensions = V8Proxy::extensions();
OwnArrayPtr<const char*> extensionNames(new const char*[extensions.size()]);
int index = 0;
for (size_t i = 0; i < extensions.size(); ++i) {
- if (extensions[i].group && extensions[i].group != extensionGroup)
+ // Ensure our date extension is always allowed.
+ if (extensions[i] != DateExtension::get()
+ && !m_frame->loader()->client()->allowScriptExtension(extensions[i]->name(), extensionGroup))
continue;
- if (extensions[i].useCallback) {
- // Ensure our date extension is always allowed.
- if (extensions[i].extension != DateExtension::get()
- && !m_frame->loader()->client()->allowScriptExtension(extensions[i].extension->name(), extensionGroup))
- continue;
- } else {
- // Note: we check the loader URL here instead of the document URL
- // because we might be currently loading an URL into a blank page.
- // See http://code.google.com/p/chromium/issues/detail?id=10924
- if (extensions[i].scheme.length() > 0 && (extensions[i].scheme != m_frame->loader()->activeDocumentLoader()->url().protocol()))
- continue;
- }
-
- extensionNames[index++] = extensions[i].extension->name();
+ extensionNames[index++] = extensions[i]->name();
}
v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get());
result = v8::Context::New(&extensionConfiguration, globalTemplate, global);
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index e7a8142..dd0446c 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -48,6 +48,7 @@
#include "V8EventListenerList.h"
#include "V8EventSource.h"
#include "V8FileReader.h"
+#include "V8FileWriter.h"
#include "V8HTMLCollection.h"
#include "V8HTMLDocument.h"
#include "V8IDBRequest.h"
@@ -428,6 +429,11 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
return toV8(fileReader);
#endif
+#if ENABLE(FILE_SYSTEM)
+ if (FileWriter* fileWriter = target->toFileWriter())
+ return toV8(fileWriter);
+#endif
+
ASSERT(0);
return notHandledByInterceptor();
}
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index 7f2051e..0b1d25e 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -131,7 +131,7 @@ static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, Invok
}
if (!retval)
- throwError("Error calling method on NPObject!", V8Proxy::GeneralError);
+ throwError("Error calling method on NPObject.", V8Proxy::GeneralError);
for (int i = 0; i < numArgs; i++)
_NPN_ReleaseVariantValue(&npArgs[i]);
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index be2be07..e7dca4f 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -39,7 +39,7 @@
#include "FrameLoaderClient.h"
#include "IDBFactoryBackendInterface.h"
#include "IDBPendingTransactionMonitor.h"
-#include "InspectorTimelineAgent.h"
+#include "InspectorInstrumentation.h"
#include "Page.h"
#include "PageGroup.h"
#include "PlatformBridge.h"
@@ -77,7 +77,7 @@
#include <wtf/StdLibExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/UnusedParam.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
#ifdef ANDROID_INSTRUMENT
#include "TimeCounter.h"
@@ -199,11 +199,8 @@ void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay)
// FIXME: This error message should contain more specifics of why the same
// origin check has failed.
- String str = String::format("Unsafe JavaScript attempt to access frame "
- "with URL %s from frame with URL %s. "
- "Domains, protocols and ports must match.\n",
- targetDocument->url().string().utf8().data(),
- sourceDocument->url().string().utf8().data());
+ String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(),
+ " from frame with URL ", sourceDocument->url().string(), ". Domains, protocols and ports must match.\n");
// Build a console message with fake source ID and line number.
const String kSourceID = "";
@@ -394,10 +391,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
V8GCController::checkMemoryUsage();
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
- timelineAgent->willEvaluateScript(source.url().isNull() ? String() : source.url().string(), source.startLine());
-#endif
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine());
v8::Local<v8::Value> result;
{
@@ -432,10 +426,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
PlatformBridge::traceEventEnd("v8.run", node, "");
#endif
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
- timelineAgent->didEvaluateScript();
-#endif
+ InspectorInstrumentation::didEvaluateScript(cookie);
return result;
}
@@ -536,33 +527,23 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
// execution finishs before firing the timer.
m_frame->keepAlive();
-#if ENABLE(INSPECTOR)
- Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0;
- if (inspectedPage) {
- if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) {
- v8::ScriptOrigin origin = function->GetScriptOrigin();
- String resourceName("undefined");
- int lineNumber = 1;
- if (!origin.ResourceName().IsEmpty()) {
- resourceName = toWebCoreString(origin.ResourceName());
- lineNumber = function->GetScriptLineNumber() + 1;
- }
- timelineAgent->willCallFunction(resourceName, lineNumber);
- } else
- inspectedPage = 0;
+ InspectorInstrumentationCookie cookie;
+ if (InspectorInstrumentation::hasFrontends()) {
+ v8::ScriptOrigin origin = function->GetScriptOrigin();
+ String resourceName("undefined");
+ int lineNumber = 1;
+ if (!origin.ResourceName().IsEmpty()) {
+ resourceName = toWebCoreString(origin.ResourceName());
+ lineNumber = function->GetScriptLineNumber() + 1;
+ }
+ cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
}
-#endif // !ENABLE(INSPECTOR)
m_recursion++;
result = function->Call(receiver, argc, args);
m_recursion--;
-#if ENABLE(INSPECTOR)
- if (inspectedPage)
- if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent())
- timelineAgent->didCallFunction();
-#endif // !ENABLE(INSPECTOR)
-
+ InspectorInstrumentation::didCallFunction(cookie);
}
// Release the storage mutex if applicable.
@@ -862,32 +843,17 @@ void V8Proxy::registerExtensionWithV8(v8::Extension* extension)
bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension)
{
for (size_t i = 0; i < m_extensions.size(); ++i) {
- if (m_extensions[i].extension == extension)
+ if (m_extensions[i] == extension)
return true;
}
return false;
}
-void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction)
-{
- registerExtensionWithV8(extension);
- V8ExtensionInfo info = {schemeRestriction, 0, extension, false};
- m_extensions.append(info);
-}
-
-void V8Proxy::registerExtension(v8::Extension* extension, int extensionGroup)
-{
- registerExtensionWithV8(extension);
- V8ExtensionInfo info = {String(), extensionGroup, extension, false};
- m_extensions.append(info);
-}
-
void V8Proxy::registerExtension(v8::Extension* extension)
{
registerExtensionWithV8(extension);
- V8ExtensionInfo info = {String(), 0, extension, true};
- m_extensions.append(info);
+ m_extensions.append(extension);
}
bool V8Proxy::setContextDebugId(int debugId)
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 169883b..bc5e526 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -119,18 +119,8 @@ namespace WebCore {
const int kMaxRecursionDepth = 20;
- // Information about an extension that is registered for use with V8. If
- // scheme is non-empty, it contains the URL scheme the extension should be
- // used with. If group is non-zero, the extension will only be loaded into
- // script contexts that belong to that group. Otherwise, the extension is
- // used with all schemes and contexts.
- struct V8ExtensionInfo {
- String scheme;
- int group;
- v8::Extension* extension;
- bool useCallback; // FIXME: remove
- };
- typedef WTF::Vector<V8ExtensionInfo> V8Extensions;
+ // The list of extensions that are registered for use with V8.
+ typedef WTF::Vector<v8::Extension*> V8Extensions;
class V8Proxy {
public:
@@ -328,19 +318,9 @@ namespace WebCore {
bool setContextDebugId(int id);
static int contextDebugId(v8::Handle<v8::Context>);
- // Registers a v8 extension to be available on webpages. The two forms
- // offer various restrictions on what types of contexts the extension is
- // loaded into. If a scheme is provided, only pages whose URL has the given
- // scheme will match. If extensionGroup is provided, the extension will
- // only be loaded into scripts run via evaluateInNewWorld with the
- // matching group. Will only affect v8 contexts initialized after this
- // call. Takes ownership of the v8::Extension object passed.
- static void registerExtension(v8::Extension*, const String& schemeRestriction);
- static void registerExtension(v8::Extension*, int extensionGroup);
-
- // Same as above, but new version.
- // FIXME: remove the other 2 versions in phase 3 of multipart checkin:
- // https://bugs.webkit.org/show_bug.cgi?id=45721
+ // Registers a v8 extension to be available on webpages. Will only
+ // affect v8 contexts initialized after this call. Takes ownership of
+ // the v8::Extension object passed.
static void registerExtension(v8::Extension*);
static void registerExtensionWithV8(v8::Extension*);
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
index 305fb18..99edc8b 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
@@ -78,4 +78,4 @@ v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& ar
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
index 2c89b95..4671c61 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "V8ArrayBufferView.h"
#include "V8Binding.h"
@@ -92,4 +92,4 @@ v8::Handle<v8::Value> V8ArrayBufferView::sliceCallback(const v8::Arguments& args
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index baffbd4..fc83b61 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -64,7 +64,7 @@ v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args)
Console* imp = V8Console::toNative(args.Holder());
v8::HandleScope handleScope;
ScriptState* scriptState = ScriptState::current();
- v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(ScriptCallStack::maxCallStackSizeToCapture);
+ v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(scriptState, stackTrace));
imp->trace(callStack.get());
return v8::Handle<v8::Value>();
diff --git a/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp b/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
index 8a39332..caf2e16 100644
--- a/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
@@ -34,11 +34,28 @@
#include "DOMFormData.h"
#include "V8Binding.h"
#include "V8Blob.h"
+#include "V8HTMLFormElement.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
namespace WebCore {
+v8::Handle<v8::Value> V8DOMFormData::constructorCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.FormData.Constructor");
+
+ if (!args.IsConstructCall())
+ return throwError("DOM object constructor cannot be called as a function.", V8Proxy::SyntaxError);
+
+ HTMLFormElement* form = 0;
+ if (args.Length() > 0 && V8HTMLFormElement::HasInstance(args[0]))
+ form = V8HTMLFormElement::toNative(args[0]->ToObject());
+ RefPtr<DOMFormData> domFormData = DOMFormData::create(form);
+
+ V8DOMWrapper::setDOMWrapper(args.Holder(), &info, domFormData.get());
+ return toV8(domFormData.release(), args.Holder());
+}
+
v8::Handle<v8::Value> V8DOMFormData::appendCallback(const v8::Arguments& args)
{
INC_STATS("DOM.FormData.append()");
diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
index fc8cf98..a44131a 100644
--- a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
@@ -70,8 +70,8 @@ v8::Handle<v8::Value> V8DirectoryEntry::getDirectoryCallback(const v8::Arguments
flags->setExclusive(isExclusive);
}
} else {
- EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
- flags = tmp_flags;
+ EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
+ flags = tmp_flags;
}
RefPtr<EntryCallback> successCallback;
if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
new file mode 100644
index 0000000..90b3d13
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * 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 "V8DirectoryEntrySync.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "DirectoryEntrySync.h"
+#include "ExceptionCode.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8EntryCallback.h"
+#include "V8ErrorCallback.h"
+#include "V8FileEntrySync.h"
+#include "V8Flags.h"
+#include "V8Proxy.h"
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+static bool extractBooleanValue(const v8::Handle<v8::Object>& object, const char* name, ExceptionCode& ec) {
+ ec = 0;
+ v8::Local<v8::Value> value = object->Get(v8::String::New(name));
+ if (!value.IsEmpty() && !isUndefinedOrNull(value)) {
+ v8::TryCatch block;
+ bool nativeValue = value->BooleanValue();
+ if (block.HasCaught()) {
+ ec = TYPE_MISMATCH_ERR;
+ return false;
+ }
+ return nativeValue;
+ }
+ return false;
+}
+
+static PassRefPtr<Flags> getFlags(const v8::Local<v8::Value>& arg, ExceptionCode& ec)
+{
+ ec = 0;
+ if (isUndefinedOrNull(arg) || !arg->IsObject())
+ return 0;
+ if (V8Flags::HasInstance(arg))
+ return V8Flags::toNative(v8::Handle<v8::Object>::Cast(arg));
+
+ v8::Handle<v8::Object> object;
+ {
+ v8::TryCatch block;
+ object = v8::Handle<v8::Object>::Cast(arg);
+ if (block.HasCaught()) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+ }
+
+ bool isCreate = extractBooleanValue(object, "create", ec);
+ if (ec)
+ return 0;
+ bool isExclusive = extractBooleanValue(object, "exclusive", ec);
+ if (ec)
+ return 0;
+
+ RefPtr<Flags> flags = Flags::create();
+ flags->setCreate(isCreate);
+ flags->setExclusive(isExclusive);
+
+ return flags;
+}
+
+v8::Handle<v8::Value> V8DirectoryEntrySync::getDirectoryCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DirectoryEntrySync.getDirectory");
+ DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
+ RefPtr<Flags> flags = getFlags(args[1], ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ RefPtr<DirectoryEntrySync> result = imp->getDirectory(path, flags, ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ return toV8(result.release());
+}
+
+v8::Handle<v8::Value> V8DirectoryEntrySync::getFileCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DirectoryEntrySync.getFile");
+ DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
+ RefPtr<Flags> flags = getFlags(args[1], ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ RefPtr<FileEntrySync> result = imp->getFile(path, flags, ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ return toV8(result.release());
+}
+
+
+
+} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index 3f6cd6a..02fc457 100644
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -32,7 +32,6 @@
#include "V8Element.h"
#include "Attr.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "Element.h"
#include "ExceptionCode.h"
diff --git a/WebCore/bindings/v8/ScriptStringImpl.cpp b/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp
index afe74b1..e98df19 100644
--- a/WebCore/bindings/v8/ScriptStringImpl.cpp
+++ b/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +14,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
@@ -29,46 +29,33 @@
*/
#include "config.h"
-#include "ScriptStringImpl.h"
+#include "EntrySync.h"
+
+#if ENABLE(FILE_SYSTEM)
+#include "V8Attr.h"
#include "V8Binding.h"
+#include "V8BindingState.h"
+#include "V8DirectoryEntrySync.h"
+#include "V8EntrySync.h"
+#include "V8FileEntrySync.h"
+#include "V8Proxy.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
-ScriptStringImpl::ScriptStringImpl(const String& s)
-{
- v8::HandleScope scope;
- m_handle.set(v8String(s));
-}
-
-ScriptStringImpl::ScriptStringImpl(const char* s)
-{
- v8::HandleScope scope;
- m_handle.set(v8::String::New(s));
-}
-
-String ScriptStringImpl::toString() const
+v8::Handle<v8::Value> toV8(EntrySync* impl)
{
- return v8StringToWebCoreString(m_handle.get());
-}
-
-bool ScriptStringImpl::isNull() const
-{
- return m_handle.get().IsEmpty();
-}
+ if (!impl)
+ return v8::Null();
-size_t ScriptStringImpl::size() const
-{
- return m_handle.get()->Length();
-}
+ if (impl->isFile())
+ return toV8(static_cast<FileEntrySync*>(impl));
-void ScriptStringImpl::append(const String& s)
-{
- v8::HandleScope scope;
- if (m_handle.get().IsEmpty())
- m_handle.set(v8String(s));
- else
- m_handle.set(v8::String::Concat(m_handle.get(), v8String(s)));
+ ASSERT(impl->isDirectory());
+ return toV8(static_cast<DirectoryEntrySync*>(impl));
}
} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/ScriptString.h b/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp
index 414818a..5f4fb57 100644..100755
--- a/WebCore/bindings/v8/ScriptString.h
+++ b/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +14,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
@@ -28,47 +28,33 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScriptString_h
-#define ScriptString_h
+#include "config.h"
+#include "V8FileReader.h"
-#include "PlatformString.h"
-#include "ScriptStringImpl.h"
+#include "ScriptExecutionContext.h"
#include "V8Binding.h"
namespace WebCore {
-class ScriptString {
-public:
- ScriptString() : m_impl(0) {}
- ScriptString(const String& s) : m_impl(ScriptStringImpl::create(s)) {}
- ScriptString(const char* s) : m_impl(ScriptStringImpl::create(s)) {}
-
- operator String() const { return m_impl->toString(); }
-
- bool isNull() const { return !m_impl.get() || m_impl->isNull(); }
- size_t size() const { return m_impl->size(); }
+v8::Handle<v8::Value> V8FileReader::constructorCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.FileReader.Constructor");
- ScriptString& operator=(const char* s)
- {
- m_impl = ScriptStringImpl::create(s);
- return *this;
- }
+ if (!args.IsConstructCall())
+ return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
- ScriptString& operator+=(const String& s)
- {
- m_impl->append(s);
- return *this;
- }
+ // Expect no parameters.
+ // Allocate a FileReader object as its internal field.
+ ScriptExecutionContext* context = getScriptExecutionContext();
+ if (!context)
+ return throwError("FileReader constructor's associated context is not available", V8Proxy::ReferenceError);
+ RefPtr<FileReader> fileReader = FileReader::create(context);
+ V8DOMWrapper::setDOMWrapper(args.Holder(), &info, fileReader.get());
- v8::Handle<v8::Value> v8StringOrNull() const
- {
- return isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::Value>(m_impl->v8StringHandle());
- }
-
-private:
- RefPtr<ScriptStringImpl> m_impl;
-};
+ // Add object to the wrapper map.
+ fileReader->ref();
+ V8DOMWrapper::setJSWrapperForActiveDOMObject(fileReader.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+ return args.Holder();
+}
} // namespace WebCore
-
-#endif // ScriptString_h
diff --git a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
index 93c5e91..c3dbe3b 100644
--- a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Float32Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Float32Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
index 3dffeb5..fd6f1a5 100644
--- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
@@ -38,6 +38,7 @@
#include "V8IDBIndex.h"
#include "V8IDBKey.h"
#include "V8IDBObjectStore.h"
+#include "V8IDBTransaction.h"
namespace WebCore {
@@ -55,14 +56,16 @@ v8::Handle<v8::Value> toV8(IDBAny* impl)
return toV8(impl->idbCursor());
case IDBAny::IDBDatabaseType:
return toV8(impl->idbDatabase());
+ case IDBAny::IDBFactoryType:
+ return toV8(impl->idbFactory());
case IDBAny::IDBIndexType:
return toV8(impl->idbIndex());
case IDBAny::IDBKeyType:
return toV8(impl->idbKey());
case IDBAny::IDBObjectStoreType:
return toV8(impl->idbObjectStore());
- case IDBAny::IDBFactoryType:
- return toV8(impl->idbFactory());
+ case IDBAny::IDBTransactionType:
+ return toV8(impl->idbTransaction());
case IDBAny::SerializedScriptValueType:
return impl->serializedScriptValue()->deserialize();
}
diff --git a/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
index 515af24..244a231 100644
--- a/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Int16Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Int16Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
index 46087aa..a5001ed 100644
--- a/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Int32Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Int32Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
index f941111..526d83e 100644
--- a/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Int8Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Int8Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index 6068aa2..34c7e28 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#include "V8Location.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
@@ -283,7 +282,7 @@ v8::Handle<v8::Value> V8Location::reloadCallback(const v8::Arguments& args)
return v8::Undefined();
if (!protocolIsJavaScript(frame->loader()->url()))
- frame->redirectScheduler()->scheduleRefresh(processingUserGesture());
+ frame->navigationScheduler()->scheduleRefresh();
return v8::Undefined();
}
diff --git a/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
index 5569253..e3ae263 100644
--- a/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Uint16Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Uint16Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
index c1521cf..6c60283 100644
--- a/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Uint32Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Uint32Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
index 73f995c..ea9f421 100644
--- a/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Uint8Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Uint8Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index 2355d2a..393e544 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -32,7 +32,7 @@
#include "V8XMLHttpRequest.h"
#include "Frame.h"
-#include "InspectorController.h"
+#include "InspectorInstrumentation.h"
#include "V8Binding.h"
#include "V8Blob.h"
#include "V8DOMFormData.h"
@@ -51,10 +51,10 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8:
INC_STATS("DOM.XMLHttpRequest.responsetext._get");
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
ExceptionCode ec = 0;
- const ScriptString& text = xmlHttpRequest->responseText(ec);
+ const String& text = xmlHttpRequest->responseText(ec);
if (ec)
return throwError(ec);
- return text.v8StringOrNull();
+ return v8String(text);
}
v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
@@ -114,7 +114,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
INC_STATS("DOM.XMLHttpRequest.send()");
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
- InspectorController::instrumentWillSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
+ InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
ExceptionCode ec = 0;
if (args.Length() < 1)