summaryrefslogtreecommitdiff
path: root/Source/WebCore/bindings/js
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:01:08 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:01:08 +0200
commit49233e234e5c787396cadb2cea33b31ae0cd65c1 (patch)
tree5410cb9a8fd53168bb60d62c54b654d86f03c38d /Source/WebCore/bindings/js
parentb211c645d8ab690f713515dfdc84d80b11c27d2c (diff)
downloadqtwebkit-49233e234e5c787396cadb2cea33b31ae0cd65c1.tar.gz
Imported WebKit commit 3a8c29f35d00659d2ce7a0ccdfa8304f14e82327 (http://svn.webkit.org/repository/webkit/trunk@120813)
New snapshot with Windows build fixes
Diffstat (limited to 'Source/WebCore/bindings/js')
-rw-r--r--Source/WebCore/bindings/js/DOMObjectHashTableMap.h2
-rw-r--r--Source/WebCore/bindings/js/DOMWrapperWorld.h2
-rw-r--r--Source/WebCore/bindings/js/Dictionary.cpp6
-rw-r--r--Source/WebCore/bindings/js/Dictionary.h2
-rw-r--r--Source/WebCore/bindings/js/GCController.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSBindingsAllInOne.cpp3
-rw-r--r--Source/WebCore/bindings/js/JSBlobCustom.cpp12
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.cpp11
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.h4
-rw-r--r--Source/WebCore/bindings/js/JSDOMGlobalObject.cpp15
-rw-r--r--Source/WebCore/bindings/js/JSDOMGlobalObject.h6
-rw-r--r--Source/WebCore/bindings/js/JSDOMStringListCustom.cpp42
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowBase.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSDictionary.cpp28
-rw-r--r--Source/WebCore/bindings/js/JSDictionary.h2
-rw-r--r--Source/WebCore/bindings/js/JSEventTarget.h45
-rw-r--r--Source/WebCore/bindings/js/JSEventTargetCustom.cpp (renamed from Source/WebCore/bindings/js/JSEventTarget.cpp)0
-rw-r--r--Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp1
-rw-r--r--Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp17
-rw-r--r--Source/WebCore/bindings/js/JSIDBAnyCustom.cpp3
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptManager.cpp29
-rw-r--r--Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp6
-rw-r--r--Source/WebCore/bindings/js/JSMainThreadExecState.cpp12
-rw-r--r--Source/WebCore/bindings/js/JSMainThreadExecState.h6
-rw-r--r--Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp6
-rw-r--r--Source/WebCore/bindings/js/ScriptController.cpp8
-rw-r--r--Source/WebCore/bindings/js/ScriptController.h1
-rw-r--r--Source/WebCore/bindings/js/ScriptDebugServer.cpp13
-rw-r--r--Source/WebCore/bindings/js/ScriptDebugServer.h2
-rw-r--r--Source/WebCore/bindings/js/ScriptFunctionCall.cpp2
-rw-r--r--Source/WebCore/bindings/js/ScriptFunctionCall.h2
-rw-r--r--Source/WebCore/bindings/js/ScriptProfiler.cpp2
-rw-r--r--Source/WebCore/bindings/js/ScriptProfiler.h3
-rw-r--r--Source/WebCore/bindings/js/SerializedScriptValue.cpp53
-rw-r--r--Source/WebCore/bindings/js/WorkerScriptController.cpp2
-rw-r--r--Source/WebCore/bindings/js/WorkerScriptController.h2
38 files changed, 219 insertions, 141 deletions
diff --git a/Source/WebCore/bindings/js/DOMObjectHashTableMap.h b/Source/WebCore/bindings/js/DOMObjectHashTableMap.h
index 216b945c4..64828d698 100644
--- a/Source/WebCore/bindings/js/DOMObjectHashTableMap.h
+++ b/Source/WebCore/bindings/js/DOMObjectHashTableMap.h
@@ -47,7 +47,7 @@ public:
HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.find(staticTable);
if (iter != m_map.end())
return &iter->second;
- return &m_map.set(staticTable, JSC::HashTable(*staticTable)).iterator->second;
+ return &m_map.set(staticTable, staticTable->copy()).iterator->second;
}
private:
diff --git a/Source/WebCore/bindings/js/DOMWrapperWorld.h b/Source/WebCore/bindings/js/DOMWrapperWorld.h
index 755375d65..9b83264d8 100644
--- a/Source/WebCore/bindings/js/DOMWrapperWorld.h
+++ b/Source/WebCore/bindings/js/DOMWrapperWorld.h
@@ -34,7 +34,7 @@ class JSDOMWrapper;
class ScriptController;
typedef HashMap<void*, JSC::Weak<JSDOMWrapper> > DOMObjectWrapperMap;
-typedef HashMap<StringImpl*, JSC::Weak<JSC::JSString> > JSStringCache;
+typedef HashMap<StringImpl*, JSC::Weak<JSC::JSString>, PtrHash<StringImpl*> > JSStringCache;
class JSStringOwner : public JSC::WeakHandleOwner {
public:
diff --git a/Source/WebCore/bindings/js/Dictionary.cpp b/Source/WebCore/bindings/js/Dictionary.cpp
index 81b345d48..ba960dc82 100644
--- a/Source/WebCore/bindings/js/Dictionary.cpp
+++ b/Source/WebCore/bindings/js/Dictionary.cpp
@@ -79,5 +79,9 @@ bool Dictionary::getOwnPropertiesAsStringHashMap(WTF::HashMap<String, String>& m
return true;
}
-};
+bool Dictionary::getWithUndefinedOrNullCheck(const String& propertyName, String& value) const
+{
+ return m_dictionary.getWithUndefinedOrNullCheck(propertyName, value);
+}
+};
diff --git a/Source/WebCore/bindings/js/Dictionary.h b/Source/WebCore/bindings/js/Dictionary.h
index ccceee706..37c3e8806 100644
--- a/Source/WebCore/bindings/js/Dictionary.h
+++ b/Source/WebCore/bindings/js/Dictionary.h
@@ -61,7 +61,7 @@ public:
bool isObject() const { return m_dictionary.isValid(); }
bool isUndefinedOrNull() const { return !m_dictionary.isValid(); }
bool getOwnPropertiesAsStringHashMap(WTF::HashMap<String, String>&) const;
- bool getWithUndefinedOrNullCheck(const String&, String&) const { notImplemented(); return false; }
+ bool getWithUndefinedOrNullCheck(const String& propertyName, String& value) const;
private:
template <typename T>
diff --git a/Source/WebCore/bindings/js/GCController.cpp b/Source/WebCore/bindings/js/GCController.cpp
index 2e304cb85..96dadf373 100644
--- a/Source/WebCore/bindings/js/GCController.cpp
+++ b/Source/WebCore/bindings/js/GCController.cpp
@@ -105,7 +105,7 @@ void GCController::setJavaScriptGarbageCollectorTimerEnabled(bool enable)
void GCController::discardAllCompiledCode()
{
JSLock lock(SilenceAssertionsOnly);
- JSDOMWindow::commonJSGlobalData()->heap.discardAllCompiledCode();
+ JSDOMWindow::commonJSGlobalData()->heap.deleteAllCompiledCode();
}
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 4d936393e..66b4a7f43 100644
--- a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -60,6 +60,7 @@
#include "JSDOMMimeTypeArrayCustom.cpp"
#include "JSDOMPluginArrayCustom.cpp"
#include "JSDOMPluginCustom.cpp"
+#include "JSDOMStringListCustom.cpp"
#include "JSDOMStringMapCustom.cpp"
#include "JSDOMTokenListCustom.cpp"
#include "JSDOMWindowBase.cpp"
@@ -77,7 +78,7 @@
#include "JSErrorHandler.cpp"
#include "JSEventCustom.cpp"
#include "JSEventListener.cpp"
-#include "JSEventTarget.cpp"
+#include "JSEventTargetCustom.cpp"
#include "JSExceptionBase.cpp"
#include "JSFloat32ArrayCustom.cpp"
#include "JSFloat64ArrayCustom.cpp"
diff --git a/Source/WebCore/bindings/js/JSBlobCustom.cpp b/Source/WebCore/bindings/js/JSBlobCustom.cpp
index 3392f3ce6..7384f73fc 100644
--- a/Source/WebCore/bindings/js/JSBlobCustom.cpp
+++ b/Source/WebCore/bindings/js/JSBlobCustom.cpp
@@ -35,6 +35,7 @@
#include "ExceptionCode.h"
#include "ExceptionCodePlaceholder.h"
#include "JSArrayBuffer.h"
+#include "JSArrayBufferView.h"
#include "JSDOMBinding.h"
#include "JSDictionary.h"
#include "JSFile.h"
@@ -53,9 +54,9 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Blob* blob)
return jsNull();
if (blob->isFile())
- return CREATE_DOM_WRAPPER(exec, globalObject, File, blob);
+ return wrap<JSFile>(exec, globalObject, static_cast<File*>(blob));
- return CREATE_DOM_WRAPPER(exec, globalObject, Blob, blob);
+ return wrap<JSBlob>(exec, globalObject, blob);
}
EncodedJSValue JSC_HOST_CALL JSBlobConstructor::constructJSBlob(ExecState* exec)
@@ -103,6 +104,9 @@ EncodedJSValue JSC_HOST_CALL JSBlobConstructor::constructJSBlob(ExecState* exec)
dictionary.get("type", type);
if (exec->hadException())
return JSValue::encode(jsUndefined());
+ if (!type.containsOnlyASCII())
+ return throwVMError(exec, createSyntaxError(exec, "type must consist of ASCII characters"));
+ type.makeLower();
}
ASSERT(endings == "transparent" || endings == "native");
@@ -117,7 +121,9 @@ EncodedJSValue JSC_HOST_CALL JSBlobConstructor::constructJSBlob(ExecState* exec)
JSValue item = array->getIndex(i);
#if ENABLE(BLOB)
if (item.inherits(&JSArrayBuffer::s_info))
- blobBuilder->append(toArrayBuffer(item));
+ blobBuilder->append(context, toArrayBuffer(item));
+ else if (item.inherits(&JSArrayBufferView::s_info))
+ blobBuilder->append(toArrayBufferView(item));
else
#endif
if (item.inherits(&JSBlob::s_info))
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp
index 3a6c64a05..fc179907a 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp
@@ -22,6 +22,7 @@
#include "JSDOMBinding.h"
#include "DOMObjectHashTableMap.h"
+#include "DOMStringList.h"
#include "ExceptionCode.h"
#include "ExceptionHeaders.h"
#include "ExceptionInterfaces.h"
@@ -146,6 +147,16 @@ double valueToDate(ExecState* exec, JSValue value)
return static_cast<DateInstance*>(value.toObject(exec))->internalNumber();
}
+JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<DOMStringList> stringList)
+{
+ JSC::MarkedArgumentBuffer list;
+ if (stringList) {
+ for (unsigned i = 0; i < stringList->length(); ++i)
+ list.append(jsString(exec, stringList->item(i)));
+ }
+ return JSC::constructArray(exec, globalObject, list);
+}
+
void reportException(ExecState* exec, JSValue exception)
{
if (isTerminatedExecutionException(exception))
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h
index 1be6310a8..d278a802a 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.h
+++ b/Source/WebCore/bindings/js/JSDOMBinding.h
@@ -44,6 +44,8 @@
namespace WebCore {
+class DOMStringList;
+
enum ParameterDefaultPolicy {
DefaultIsUndefined,
DefaultIsNullString
@@ -291,6 +293,8 @@ enum ParameterDefaultPolicy {
return JSC::constructArray(exec, globalObject, list);
}
+ JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<DOMStringList>);
+
template<>
inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<String>& iterator)
{
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
index dbc274d23..36104808b 100644
--- a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
+++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -93,9 +93,6 @@ void JSDOMGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
JSDOMConstructorMap::iterator end2 = thisObject->constructors().end();
for (JSDOMConstructorMap::iterator it2 = thisObject->constructors().begin(); it2 != end2; ++it2)
visitor.append(&it2->second);
-
- if (thisObject->m_injectedScript)
- visitor.append(&thisObject->m_injectedScript);
}
void JSDOMGlobalObject::setCurrentEvent(Event* currentEvent)
@@ -108,16 +105,6 @@ Event* JSDOMGlobalObject::currentEvent() const
return m_currentEvent;
}
-void JSDOMGlobalObject::setInjectedScript(JSObject* injectedScript)
-{
- m_injectedScript.setMayBeNull(globalData(), this, injectedScript);
-}
-
-JSObject* JSDOMGlobalObject::injectedScript() const
-{
- return m_injectedScript.get();
-}
-
JSDOMGlobalObject* toJSDOMGlobalObject(Document* document, JSC::ExecState* exec)
{
return toJSDOMWindow(document->frame(), currentWorld(exec));
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.h b/Source/WebCore/bindings/js/JSDOMGlobalObject.h
index bd2773ae4..3ce12d10f 100644
--- a/Source/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -68,9 +68,6 @@ namespace WebCore {
void setCurrentEvent(Event*);
Event* currentEvent() const;
- void setInjectedScript(JSObject*);
- JSObject* injectedScript() const;
-
static void visitChildren(JSC::JSCell*, JSC::SlotVisitor&);
DOMWrapperWorld* world() { return m_world.get(); }
@@ -88,7 +85,6 @@ namespace WebCore {
Event* m_currentEvent;
RefPtr<DOMWrapperWorld> m_world;
- JSC::WriteBarrier<JSObject> m_injectedScript;
};
template<class ConstructorClass>
diff --git a/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp b/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp
new file mode 100644
index 000000000..7f8d5ec53
--- /dev/null
+++ b/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 Research In Motion Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "JSDOMStringList.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+PassRefPtr<DOMStringList> toDOMStringList(ExecState* exec, JSValue value)
+{
+ if (value.inherits(&JSDOMStringList::s_info))
+ return jsCast<JSDOMStringList*>(asObject(value))->impl();
+
+ if (!isJSArray(value))
+ return 0;
+
+ JSArray* array = asArray(value);
+ RefPtr<DOMStringList> stringList = DOMStringList::create();
+ for (unsigned i = 0; i < array->length(); ++i)
+ stringList->append(ustringToString(array->getIndex(i).toString(exec)->value(exec)));
+
+ return stringList.release();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
index 1ea8c8b44..f18a05e3b 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -74,7 +74,7 @@ void JSDOMWindowBase::updateDocument()
{
ASSERT(m_impl->document());
ExecState* exec = globalExec();
- symbolTablePutWithAttributes(exec->globalData(), Identifier(exec, "document"), toJS(exec, this, m_impl->document()), DontDelete | ReadOnly);
+ symbolTablePutWithAttributes(this, exec->globalData(), Identifier(exec, "document"), toJS(exec, this, m_impl->document()), DontDelete | ReadOnly);
}
ScriptExecutionContext* JSDOMWindowBase::scriptExecutionContext() const
diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp
index fc6a16d93..4967107df 100644
--- a/Source/WebCore/bindings/js/JSDictionary.cpp
+++ b/Source/WebCore/bindings/js/JSDictionary.cpp
@@ -102,6 +102,24 @@ void JSDictionary::convertValue(ExecState* exec, JSValue value, String& result)
result = ustringToString(value.toString(exec)->value(exec));
}
+void JSDictionary::convertValue(ExecState* exec, JSValue value, Vector<String>& result)
+{
+ if (value.isUndefinedOrNull())
+ return;
+
+ unsigned length;
+ JSObject* object = toJSSequence(exec, value, length);
+ if (exec->hadException())
+ return;
+
+ for (unsigned i = 0 ; i < length; ++i) {
+ JSValue itemValue = object->get(exec, i);
+ if (exec->hadException())
+ return;
+ result.append(ustringToString(itemValue.toString(exec)->value(exec)));
+ }
+}
+
void JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result)
{
result = ScriptValue(exec->globalData(), value);
@@ -167,4 +185,14 @@ void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicSt
}
#endif
+bool JSDictionary::getWithUndefinedOrNullCheck(const String& propertyName, String& result) const
+{
+ JSValue value;
+ if (tryGetProperty(propertyName.utf8().data(), value) != PropertyFound || value.isUndefinedOrNull())
+ return false;
+
+ result = ustringToString(value.toString(m_exec)->value(m_exec));
+ return true;
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSDictionary.h b/Source/WebCore/bindings/js/JSDictionary.h
index e0ba16997..bd1754dd8 100644
--- a/Source/WebCore/bindings/js/JSDictionary.h
+++ b/Source/WebCore/bindings/js/JSDictionary.h
@@ -58,6 +58,7 @@ public:
// Returns true if the property was found in the dictionary, and the value could be converted to the desired type.
template <typename Result>
bool get(const char* propertyName, Result&) const;
+ bool getWithUndefinedOrNullCheck(const String& propertyName, String& value) const;
JSC::ExecState* execState() const { return m_exec; }
JSC::JSObject* initializerObject() const { return m_initializerObject; }
@@ -91,6 +92,7 @@ private:
static void convertValue(JSC::ExecState*, JSC::JSValue, Dictionary& result);
static void convertValue(JSC::ExecState*, JSC::JSValue, String& result);
static void convertValue(JSC::ExecState*, JSC::JSValue, ScriptValue& result);
+ static void convertValue(JSC::ExecState*, JSC::JSValue, Vector<String>& result);
static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<SerializedScriptValue>& result);
static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<DOMWindow>& result);
static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<EventTarget>& result);
diff --git a/Source/WebCore/bindings/js/JSEventTarget.h b/Source/WebCore/bindings/js/JSEventTarget.h
deleted file mode 100644
index ddd823241..000000000
--- a/Source/WebCore/bindings/js/JSEventTarget.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef JSEventTarget_h
-#define JSEventTarget_h
-
-#include <runtime/JSValue.h>
-
-namespace JSC {
- class ExecState;
-}
-
-namespace WebCore {
-
- class EventTarget;
- class JSDOMGlobalObject;
-
- JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, EventTarget*);
- EventTarget* toEventTarget(JSC::JSValue);
-
-} // namespace WebCore
-
-#endif // JSEventTarget_h
diff --git a/Source/WebCore/bindings/js/JSEventTarget.cpp b/Source/WebCore/bindings/js/JSEventTargetCustom.cpp
index 66e157615..66e157615 100644
--- a/Source/WebCore/bindings/js/JSEventTarget.cpp
+++ b/Source/WebCore/bindings/js/JSEventTargetCustom.cpp
diff --git a/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
index 7b106ba9d..8546729f4 100644
--- a/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
@@ -28,7 +28,6 @@
#include "HTMLAllCollection.h"
#include "JSDOMBinding.h"
-#include "JSHTMLAllCollection.h"
#include "JSNode.h"
#include "JSNodeList.h"
#include "Node.h"
diff --git a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
index d5fc3ce96..a72af1062 100644
--- a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -21,7 +21,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -31,7 +31,9 @@
#include "HTMLCanvasElement.h"
#include "JSCanvasRenderingContext2D.h"
#if ENABLE(WEBGL)
+#include "InspectorWebGLInstrumentation.h"
#include "JSWebGLRenderingContext.h"
+#include "ScriptObject.h"
#include "WebGLContextAttributes.h"
#endif
#include <wtf/GetPtr.h>
@@ -75,7 +77,16 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
CanvasRenderingContext* context = canvas->getContext(ustringToString(contextId), attrs.get());
if (!context)
return jsNull();
- return toJS(exec, globalObject(), WTF::getPtr(context));
+ JSValue jsValue = toJS(exec, globalObject(), WTF::getPtr(context));
+#if ENABLE(WEBGL)
+ if (context->is3d() && InspectorInstrumentation::hasFrontends()) {
+ ScriptObject glContext(exec, jsValue.getObject());
+ ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(canvas->document(), glContext);
+ if (!wrapped.hasNoValue())
+ return wrapped.jsValue();
+ }
+#endif
+ return jsValue;
}
JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec)
@@ -93,7 +104,7 @@ JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec)
qualityPtr = &quality;
}
}
-
+
JSValue result = jsString(exec, canvas->toDataURL(type, qualityPtr, ec));
setDOMException(exec, ec);
return result;
diff --git a/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp b/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp
index defa656e7..cf545d300 100644
--- a/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp
+++ b/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp
@@ -41,6 +41,7 @@
#include "IDBObjectStore.h"
#include "JSDOMStringList.h"
#include "JSIDBCursor.h"
+#include "JSIDBCursorWithValue.h"
#include "JSIDBDatabase.h"
#include "JSIDBFactory.h"
#include "JSIDBIndex.h"
@@ -68,7 +69,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny)
case IDBAny::IDBCursorType:
return toJS(exec, globalObject, idbAny->idbCursor());
case IDBAny::IDBCursorWithValueType:
- return toJS(exec, globalObject, idbAny->idbCursorWithValue());
+ return wrap<JSIDBCursorWithValue>(exec, globalObject, idbAny->idbCursorWithValue().get());
case IDBAny::IDBDatabaseType:
return toJS(exec, globalObject, idbAny->idbDatabase());
case IDBAny::IDBFactoryType:
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
index 1576d346d..138193bba 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- * Copyright (C) 2010-2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 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
@@ -37,11 +37,11 @@
#include "InjectedScriptManager.h"
#include "ExceptionCode.h"
-#include "InjectedScript.h"
#include "JSDOMWindow.h"
#include "JSDOMWindowCustom.h"
#include "JSInjectedScriptHost.h"
#include "JSMainThreadExecState.h"
+#include "ScriptObject.h"
#include <parser/SourceCode.h>
#include <runtime/JSLock.h>
@@ -72,36 +72,13 @@ ScriptObject InjectedScriptManager::createInjectedScript(const String& source, S
args.append(toJS(scriptState, globalObject, m_injectedScriptHost.get()));
args.append(globalThisValue);
args.append(jsNumber(id));
+
JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
if (result.isObject())
return ScriptObject(scriptState, result.getObject());
return ScriptObject();
}
-void InjectedScriptManager::discardInjectedScript(ScriptState* scriptState)
-{
- JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- globalObject->setInjectedScript(0);
-}
-
-InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* scriptState)
-{
- JSLock lock(SilenceAssertionsOnly);
- JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- JSObject* injectedScript = globalObject->injectedScript();
- if (injectedScript)
- return InjectedScript(ScriptObject(scriptState, injectedScript), m_inspectedStateAccessCheck);
-
- if (!m_inspectedStateAccessCheck(scriptState))
- return InjectedScript();
-
- pair<int, ScriptObject> injectedScriptObject = injectScript(injectedScriptSource(), scriptState);
- globalObject->setInjectedScript(injectedScriptObject.second.jsObject());
- InjectedScript result(injectedScriptObject.second, m_inspectedStateAccessCheck);
- m_idToInjectedScript.set(injectedScriptObject.first, result);
- return result;
-}
-
bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState)
{
JSLock lock(SilenceAssertionsOnly);
diff --git a/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
index 3c7199461..7c4945053 100644
--- a/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
@@ -144,6 +144,8 @@ JSValue JSInspectorFrontendHost::showContextMenu(ExecState* exec)
Vector<ContextMenuItem> items = menu.items();
#endif
impl()->showContextMenu(event, items);
+#else
+ UNUSED_PARAM(exec);
#endif
return jsUndefined();
}
diff --git a/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
index a32546701..40d3a3fb8 100644
--- a/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
+++ b/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
@@ -48,6 +48,12 @@ JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec)
return result;
}
+JSValue JSJavaScriptCallFrame::restart(ExecState*)
+{
+ // FIXME(40300): implement this.
+ return JSValue(JSValue::JSFalse);
+}
+
JSValue JSJavaScriptCallFrame::thisObject(ExecState*) const
{
return impl()->thisObject() ? JSValue(impl()->thisObject()) : jsNull();
diff --git a/Source/WebCore/bindings/js/JSMainThreadExecState.cpp b/Source/WebCore/bindings/js/JSMainThreadExecState.cpp
index 9177a4b10..00bc170d2 100644
--- a/Source/WebCore/bindings/js/JSMainThreadExecState.cpp
+++ b/Source/WebCore/bindings/js/JSMainThreadExecState.cpp
@@ -27,15 +27,23 @@
#include "JSMainThreadExecState.h"
#include "WebKitMutationObserver.h"
+#if ENABLE(INDEXED_DATABASE)
+#include "IDBPendingTransactionMonitor.h"
+#endif
+
namespace WebCore {
JSC::ExecState* JSMainThreadExecState::s_mainThreadState = 0;
-#if ENABLE(MUTATION_OBSERVERS)
void JSMainThreadExecState::didLeaveScriptContext()
{
+#if ENABLE(INDEXED_DATABASE)
+ IDBPendingTransactionMonitor::abortPendingTransactions();
+#endif
+
+#if ENABLE(MUTATION_OBSERVERS)
WebKitMutationObserver::deliverAllMutations();
-}
#endif
+}
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSMainThreadExecState.h b/Source/WebCore/bindings/js/JSMainThreadExecState.h
index 14886f5e1..b9af0669a 100644
--- a/Source/WebCore/bindings/js/JSMainThreadExecState.h
+++ b/Source/WebCore/bindings/js/JSMainThreadExecState.h
@@ -88,25 +88,19 @@ protected:
{
ASSERT(isMainThread());
-#if ENABLE(MUTATION_OBSERVERS)
bool didExitJavaScript = s_mainThreadState && !m_previousState;
-#endif
s_mainThreadState = m_previousState;
-#if ENABLE(MUTATION_OBSERVERS)
if (didExitJavaScript)
didLeaveScriptContext();
-#endif
}
private:
static JSC::ExecState* s_mainThreadState;
JSC::ExecState* m_previousState;
-#if ENABLE(MUTATION_OBSERVERS)
static void didLeaveScriptContext();
-#endif
};
// Null state prevents origin security checks.
diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
index d6cf4ad2f..d6a171fb9 100644
--- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
+++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
@@ -46,6 +46,7 @@
#include "JSUint8Array.h"
#include "JSWebGLBuffer.h"
#include "JSWebGLCompressedTextureS3TC.h"
+#include "JSWebGLDepthTexture.h"
#include "JSWebGLFramebuffer.h"
#include "JSWebGLLoseContext.h"
#include "JSWebGLProgram.h"
@@ -63,6 +64,7 @@
#include "WebGLCompressedTextureS3TC.h"
#include "WebGLDebugRendererInfo.h"
#include "WebGLDebugShaders.h"
+#include "WebGLDepthTexture.h"
#include "WebGLExtension.h"
#include "WebGLFramebuffer.h"
#include "WebGLGetInfo.h"
@@ -204,6 +206,8 @@ static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, WebGLExten
return toJS(exec, globalObject, static_cast<WebGLDebugShaders*>(extension));
case WebGLExtension::WebKitWebGLCompressedTextureS3TCName:
return toJS(exec, globalObject, static_cast<WebGLCompressedTextureS3TC*>(extension));
+ case WebGLExtension::WebKitWebGLDepthTextureName:
+ return toJS(exec, globalObject, static_cast<WebGLDepthTexture*>(extension));
}
ASSERT_NOT_REACHED();
return jsNull();
diff --git a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 82bdec417..13b4c008a 100644
--- a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -71,10 +71,8 @@ void JSXMLHttpRequest::visitChildren(JSCell* cell, SlotVisitor& visitor)
if (ArrayBuffer* responseArrayBuffer = thisObject->m_impl->optionalResponseArrayBuffer())
visitor.addOpaqueRoot(responseArrayBuffer);
-#if ENABLE(XHR_RESPONSE_BLOB)
if (Blob* responseBlob = thisObject->m_impl->optionalResponseBlob())
visitor.addOpaqueRoot(responseBlob);
-#endif
thisObject->m_impl->visitJSEventListeners(visitor);
}
@@ -174,7 +172,6 @@ JSValue JSXMLHttpRequest::response(ExecState* exec) const
}
case XMLHttpRequest::ResponseTypeBlob:
-#if ENABLE(XHR_RESPONSE_BLOB)
{
ExceptionCode ec = 0;
Blob* blob = impl()->responseBlob(ec);
@@ -184,9 +181,6 @@ JSValue JSXMLHttpRequest::response(ExecState* exec) const
}
return toJS(exec, globalObject(), blob);
}
-#else
- return jsUndefined();
-#endif
case XMLHttpRequest::ResponseTypeArrayBuffer:
{
diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp
index fd80a467f..7999502bd 100644
--- a/Source/WebCore/bindings/js/ScriptController.cpp
+++ b/Source/WebCore/bindings/js/ScriptController.cpp
@@ -233,6 +233,14 @@ TextPosition ScriptController::eventHandlerPosition() const
return TextPosition::minimumPosition();
}
+void ScriptController::enableEval()
+{
+ JSDOMWindowShell* windowShell = existingWindowShell(mainThreadNormalWorld());
+ if (!windowShell)
+ return; // Eval is enabled by default.
+ windowShell->window()->setEvalEnabled(true);
+}
+
void ScriptController::disableEval()
{
windowShell(mainThreadNormalWorld())->window()->setEvalEnabled(false);
diff --git a/Source/WebCore/bindings/js/ScriptController.h b/Source/WebCore/bindings/js/ScriptController.h
index 9e8c28d6a..0ed986969 100644
--- a/Source/WebCore/bindings/js/ScriptController.h
+++ b/Source/WebCore/bindings/js/ScriptController.h
@@ -104,6 +104,7 @@ public:
WTF::TextPosition eventHandlerPosition() const;
+ void enableEval();
void disableEval();
static bool processingUserGesture();
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
index 4dec15ed8..2d91d8a5e 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -152,7 +152,11 @@ void ScriptDebugServer::setPauseOnNextStatement(bool pause)
void ScriptDebugServer::breakProgram()
{
- // FIXME(WK43332): implement this.
+ if (m_paused || !m_currentCallFrame)
+ return;
+
+ m_pauseOnNextStatement = true;
+ pauseIfNeeded(m_currentCallFrame->dynamicGlobalObject());
}
void ScriptDebugServer::continueProgram()
@@ -202,6 +206,13 @@ bool ScriptDebugServer::setScriptSource(const String&, const String&, bool, Stri
return false;
}
+
+void ScriptDebugServer::updateCallStack(ScriptValue*)
+{
+ // This method is used for restart frame feature that is not implemented yet.
+ // FIXME(40300): implement this.
+}
+
void ScriptDebugServer::dispatchDidPause(ScriptDebugListener* listener)
{
ASSERT(m_paused);
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.h b/Source/WebCore/bindings/js/ScriptDebugServer.h
index fd0a8bc34..fad261174 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.h
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.h
@@ -83,9 +83,9 @@ public:
bool canSetScriptSource();
bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result);
+ void updateCallStack(ScriptValue* callFrame);
bool causesRecompilation() { return true; }
- bool supportsNativeBreakpoints() { return false; }
void recompileAllJSFunctionsSoon();
virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) = 0;
diff --git a/Source/WebCore/bindings/js/ScriptFunctionCall.cpp b/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
index 5c9ebc096..83b0e45b1 100644
--- a/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -191,7 +191,7 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept
return ScriptObject(m_exec, asObject(result));
}
-ScriptCallback::ScriptCallback(ScriptState* state, ScriptValue function)
+ScriptCallback::ScriptCallback(ScriptState* state, const ScriptValue& function)
: ScriptCallArgumentHandler(state)
, m_function(function)
{
diff --git a/Source/WebCore/bindings/js/ScriptFunctionCall.h b/Source/WebCore/bindings/js/ScriptFunctionCall.h
index c7da85835..69b5e28db 100644
--- a/Source/WebCore/bindings/js/ScriptFunctionCall.h
+++ b/Source/WebCore/bindings/js/ScriptFunctionCall.h
@@ -87,7 +87,7 @@ namespace WebCore {
class ScriptCallback : public ScriptCallArgumentHandler {
public:
- ScriptCallback(ScriptState*, ScriptValue);
+ ScriptCallback(ScriptState*, const ScriptValue&);
ScriptValue call();
ScriptValue call(bool& hadException);
diff --git a/Source/WebCore/bindings/js/ScriptProfiler.cpp b/Source/WebCore/bindings/js/ScriptProfiler.cpp
index c4c4d74d1..d6afd8966 100644
--- a/Source/WebCore/bindings/js/ScriptProfiler.cpp
+++ b/Source/WebCore/bindings/js/ScriptProfiler.cpp
@@ -51,7 +51,7 @@ ScriptObject ScriptProfiler::objectByHeapObjectId(unsigned)
return ScriptObject();
}
-unsigned ScriptProfiler::getHeapObjectId(ScriptValue)
+unsigned ScriptProfiler::getHeapObjectId(const ScriptValue&)
{
return 0;
}
diff --git a/Source/WebCore/bindings/js/ScriptProfiler.h b/Source/WebCore/bindings/js/ScriptProfiler.h
index ce4468e77..04a615ddb 100644
--- a/Source/WebCore/bindings/js/ScriptProfiler.h
+++ b/Source/WebCore/bindings/js/ScriptProfiler.h
@@ -56,7 +56,7 @@ public:
static void collectGarbage();
static ScriptObject objectByHeapObjectId(unsigned id);
- static unsigned getHeapObjectId(ScriptValue);
+ static unsigned getHeapObjectId(const ScriptValue&);
static void start(ScriptState* state, const String& title);
static void startForPage(Page*, const String& title);
#if ENABLE(WORKERS)
@@ -74,6 +74,7 @@ public:
// FIXME: Implement this counter for JSC. See bug 73936 for more details.
static void visitJSDOMWrappers(DOMWrapperVisitor*) { }
static void visitExternalJSStrings(DOMWrapperVisitor*) { }
+ static size_t profilerSnapshotsSize() { return 0; }
};
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
index c25f76834..2b47d4b62 100644
--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -351,6 +351,18 @@ public:
writeLittleEndian<uint8_t>(out, value ? TrueTag : FalseTag);
}
+ static void serializeNumber(double value, Vector<uint8_t>& out)
+ {
+ writeLittleEndian(out, CurrentVersion);
+ writeLittleEndian<uint8_t>(out, DoubleTag);
+ union {
+ double d;
+ int64_t i;
+ } u;
+ u.d = value;
+ writeLittleEndian(out, u.i);
+ }
+
private:
typedef HashMap<JSObject*, uint32_t> ObjectPool;
@@ -976,6 +988,18 @@ typedef Vector<WTF::ArrayBufferContents> ArrayBufferContentsArray;
class CloneDeserializer : CloneBase {
public:
+ static String toWireString(const Vector<unsigned char>& value)
+ {
+ const uint8_t* start = value.begin();
+ const uint8_t* end = value.end();
+ const uint32_t length = value.size() / sizeof(UChar);
+ UString str;
+ if (!CloneDeserializer::readString(start, end, str, length))
+ return String();
+
+ return String(str.impl());
+ }
+
static String deserializeString(const Vector<uint8_t>& buffer)
{
const uint8_t* ptr = buffer.begin();
@@ -1763,33 +1787,34 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(const String& st
}
#if ENABLE(INDEXED_DATABASE)
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(JSC::ExecState*, JSC::JSValue)
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(JSC::ExecState* exec, JSC::JSValue value)
{
- notImplemented();
- return PassRefPtr<SerializedScriptValue>();
+ return SerializedScriptValue::create(exec, value, 0, 0);
}
String SerializedScriptValue::toWireString() const
{
- notImplemented();
- return String();
+ return CloneDeserializer::toWireString(m_data);
}
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(const String&)
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(const String& value)
{
- notImplemented();
- return PassRefPtr<SerializedScriptValue>();
+ Vector<uint8_t> buffer;
+ if (!writeLittleEndian(buffer, value.impl()->characters(), value.length()))
+ return 0;
+ return adoptRef(new SerializedScriptValue(buffer));
}
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::numberValue(double)
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::numberValue(double value)
{
- notImplemented();
- return PassRefPtr<SerializedScriptValue>();
+ Vector<uint8_t> buffer;
+ CloneSerializer::serializeNumber(value, buffer);
+ return adoptRef(new SerializedScriptValue(buffer));
}
-JSValue SerializedScriptValue::deserialize(JSC::ExecState*, JSC::JSGlobalObject*)
+JSValue SerializedScriptValue::deserialize(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject)
{
- notImplemented();
- return JSValue();
+ return deserialize(exec, globalObject, 0);
}
#endif
diff --git a/Source/WebCore/bindings/js/WorkerScriptController.cpp b/Source/WebCore/bindings/js/WorkerScriptController.cpp
index b11544981..e2e607d95 100644
--- a/Source/WebCore/bindings/js/WorkerScriptController.cpp
+++ b/Source/WebCore/bindings/js/WorkerScriptController.cpp
@@ -155,7 +155,7 @@ void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, Script
}
}
-void WorkerScriptController::setException(ScriptValue exception)
+void WorkerScriptController::setException(const ScriptValue& exception)
{
throwError(m_workerContextWrapper->globalExec(), exception.jsValue());
}
diff --git a/Source/WebCore/bindings/js/WorkerScriptController.h b/Source/WebCore/bindings/js/WorkerScriptController.h
index 59727f6dc..3b2acd4b6 100644
--- a/Source/WebCore/bindings/js/WorkerScriptController.h
+++ b/Source/WebCore/bindings/js/WorkerScriptController.h
@@ -60,7 +60,7 @@ namespace WebCore {
void evaluate(const ScriptSourceCode&);
void evaluate(const ScriptSourceCode&, ScriptValue* exception);
- void setException(ScriptValue);
+ void setException(const ScriptValue&);
// Async request to terminate a JS run execution. Eventually causes termination
// exception raised during JS execution, if the worker thread happens to run JS.