summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-29 17:32:26 +0100
committerSteve Block <steveblock@google.com>2010-09-29 17:35:08 +0100
commit68513a70bcd92384395513322f1b801e7bf9c729 (patch)
tree161b50f75a5921d61731bb25e730005994fcec85 /WebCore/bindings/js
parentfd5c6425ce58eb75211be7718d5dee960842a37e (diff)
downloadexternal_webkit-68513a70bcd92384395513322f1b801e7bf9c729.zip
external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.gz
external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.bz2
Merge WebKit at r67908: Initial merge by Git
Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972
Diffstat (limited to 'WebCore/bindings/js')
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h7
-rw-r--r--WebCore/bindings/js/JSDirectoryEntryCustom.cpp141
-rw-r--r--WebCore/bindings/js/JSEntryCustom.cpp61
-rw-r--r--WebCore/bindings/js/JSEventCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSSVGPODListCustom.h8
-rw-r--r--WebCore/bindings/js/JSSVGPathSegListCustom.cpp8
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp2
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.cpp75
10 files changed, 269 insertions, 41 deletions
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 749b0d7..f0bd2e2 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -267,6 +267,13 @@ namespace WebCore {
String valueToStringWithNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null
String valueToStringWithUndefinedOrNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null or undefined
+ inline int32_t finiteInt32Value(JSC::JSValue value, JSC::ExecState* exec, bool& okay)
+ {
+ double number = value.toNumber(exec);
+ okay = isfinite(number);
+ return JSC::toInt32(number);
+ }
+
// Returns a Date instance for the specified value, or null if the value is NaN or infinity.
JSC::JSValue jsDateOrNull(JSC::ExecState*, double);
// NaN if the value can't be converted to a date.
diff --git a/WebCore/bindings/js/JSDirectoryEntryCustom.cpp b/WebCore/bindings/js/JSDirectoryEntryCustom.cpp
new file mode 100644
index 0000000..35a6c32
--- /dev/null
+++ b/WebCore/bindings/js/JSDirectoryEntryCustom.cpp
@@ -0,0 +1,141 @@
+/*
+ * 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"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "JSDirectoryEntry.h"
+
+#include "JSDOMBinding.h"
+#include "JSEntryCallback.h"
+#include "JSErrorCallback.h"
+#include "JSFlags.h"
+#include <wtf/Assertions.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSDirectoryEntry::getFile(ExecState* exec)
+{
+ DirectoryEntry* imp = static_cast<DirectoryEntry*>(impl());
+ const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
+ if (exec->hadException())
+ return jsUndefined();
+
+ int argsCount = exec->argumentCount();
+ if (argsCount <= 1) {
+ imp->getFile(path);
+ return jsUndefined();
+ }
+
+ RefPtr<Flags> flags;
+ if (!exec->argument(1).isNull() && !exec->argument(1).isUndefined() && exec->argument(1).isObject() && !exec->argument(1).inherits(&JSFlags::s_info)) {
+ JSObject* object = exec->argument(1).getObject();
+ flags = Flags::create();
+ JSValue jsCreate = object->get(exec, Identifier(exec, "create"));
+ flags->setCreate(jsCreate.toBoolean(exec));
+ JSValue jsExclusive = object->get(exec, Identifier(exec, "exclusive"));
+ flags->setExclusive(jsExclusive.toBoolean(exec));
+ } else
+ flags = adoptRef(toFlags(exec->argument(1)));
+ if (exec->hadException())
+ return jsUndefined();
+ RefPtr<EntryCallback> successCallback;
+ if (exec->argumentCount() > 2 && !exec->argument(2).isNull() && !exec->argument(2).isUndefined()) {
+ if (!exec->argument(2).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+ successCallback = JSEntryCallback::create(asObject(exec->argument(2)), globalObject());
+ }
+ RefPtr<ErrorCallback> errorCallback;
+ if (exec->argumentCount() > 3 && !exec->argument(3).isNull() && !exec->argument(3).isUndefined()) {
+ if (!exec->argument(3).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+ errorCallback = JSErrorCallback::create(asObject(exec->argument(3)), globalObject());
+ }
+
+ imp->getFile(path, flags, successCallback, errorCallback);
+ return jsUndefined();
+}
+
+JSValue JSDirectoryEntry::getDirectory(ExecState* exec)
+{
+ DirectoryEntry* imp = static_cast<DirectoryEntry*>(impl());
+ const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
+ if (exec->hadException())
+ return jsUndefined();
+
+ int argsCount = exec->argumentCount();
+ if (argsCount <= 1) {
+ imp->getDirectory(path);
+ return jsUndefined();
+ }
+
+ RefPtr<Flags> flags;
+ if (!exec->argument(1).isNull() && !exec->argument(1).isUndefined() && exec->argument(1).isObject() && !exec->argument(1).inherits(&JSFlags::s_info)) {
+ JSObject* object = exec->argument(1).getObject();
+ flags = Flags::create();
+ JSValue jsCreate = object->get(exec, Identifier(exec, "create"));
+ flags->setCreate(jsCreate.toBoolean(exec));
+ JSValue jsExclusive = object->get(exec, Identifier(exec, "exclusive"));
+ flags->setExclusive(jsExclusive.toBoolean(exec));
+ } else
+ flags = adoptRef(toFlags(exec->argument(1)));
+ if (exec->hadException())
+ return jsUndefined();
+ RefPtr<EntryCallback> successCallback;
+ if (exec->argumentCount() > 2 && !exec->argument(2).isNull() && !exec->argument(2).isUndefined()) {
+ if (!exec->argument(2).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+ successCallback = JSEntryCallback::create(asObject(exec->argument(2)), globalObject());
+ }
+ RefPtr<ErrorCallback> errorCallback;
+ if (exec->argumentCount() > 3 && !exec->argument(3).isNull() && !exec->argument(3).isUndefined()) {
+ if (!exec->argument(3).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+ errorCallback = JSErrorCallback::create(asObject(exec->argument(3)), globalObject());
+ }
+
+ imp->getDirectory(path, flags, successCallback, errorCallback);
+ return jsUndefined();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/js/JSEntryCustom.cpp b/WebCore/bindings/js/JSEntryCustom.cpp
new file mode 100644
index 0000000..59d7e3c
--- /dev/null
+++ b/WebCore/bindings/js/JSEntryCustom.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "JSEntry.h"
+
+#include "Entry.h"
+#include "JSDOMBinding.h"
+#include "JSDirectoryEntry.h"
+#include "JSFileEntry.h"
+#include <wtf/Assertions.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Entry* entry)
+{
+ if (!entry)
+ return jsNull();
+
+ if (entry->isFile())
+ return getDOMObjectWrapper<JSFileEntry>(exec, globalObject, static_cast<FileEntry*>(entry));
+
+ ASSERT(entry->isDirectory());
+ return getDOMObjectWrapper<JSDirectoryEntry>(exec, globalObject, static_cast<DirectoryEntry*>(entry));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index 7479020..d2e9d61 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -42,6 +42,7 @@
#include "JSDeviceMotionEvent.h"
#include "JSDeviceOrientationEvent.h"
#include "JSErrorEvent.h"
+#include "JSHashChangeEvent.h"
#include "JSKeyboardEvent.h"
#include "JSMessageEvent.h"
#include "JSMouseEvent.h"
@@ -58,6 +59,7 @@
#include "JSXMLHttpRequestProgressEvent.h"
#include "BeforeLoadEvent.h"
#include "ErrorEvent.h"
+#include "HashChangeEvent.h"
#include "KeyboardEvent.h"
#include "MessageEvent.h"
#include "MouseEvent.h"
@@ -170,6 +172,8 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
else if (event->isErrorEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, ErrorEvent, event);
#endif
+ else if (event->isHashChangeEvent())
+ wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, HashChangeEvent, event);
else if (event->isPopStateEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, PopStateEvent, event);
else if (event->isCustomEvent())
diff --git a/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
index dc2f7cb..6143c1e 100644
--- a/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
@@ -76,7 +76,7 @@ JSValue JSHTMLOptionsCollection::add(ExecState* exec)
imp->add(option, ec);
else {
bool ok;
- int index = exec->argument(1).toInt32(exec, ok);
+ int index = finiteInt32Value(exec->argument(1), exec, ok);
if (exec->hadException())
return jsUndefined();
if (!ok)
diff --git a/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp b/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
index 2a504d3..e9a97ed 100644
--- a/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
+++ b/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
@@ -42,7 +42,7 @@ namespace WebCore {
JSValue JSSQLResultSetRowList::item(ExecState* exec)
{
bool indexOk;
- int index = exec->argument(0).toInt32(exec, indexOk);
+ int index = finiteInt32Value(exec->argument(0), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
diff --git a/WebCore/bindings/js/JSSVGPODListCustom.h b/WebCore/bindings/js/JSSVGPODListCustom.h
index 9db5618..c2af93f 100644
--- a/WebCore/bindings/js/JSSVGPODListCustom.h
+++ b/WebCore/bindings/js/JSSVGPODListCustom.h
@@ -119,7 +119,7 @@ static JSC::JSValue getItem(JSPODListType* wrapper, JSC::ExecState* exec,
typename JSSVGPODListTraits<PODType>::ConversionCallback)
{
bool indexOk = false;
- unsigned index = exec->argument(0).toUInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return JSC::jsUndefined();
@@ -136,7 +136,7 @@ static JSC::JSValue insertItemBefore(JSPODListType* wrapper, JSC::ExecState* exe
typename JSSVGPODListTraits<PODType>::ConversionCallback conversion)
{
bool indexOk = false;
- unsigned index = exec->argument(1).toUInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return JSC::jsUndefined();
@@ -153,7 +153,7 @@ static JSC::JSValue replaceItem(JSPODListType* wrapper, JSC::ExecState* exec,
typename JSSVGPODListTraits<PODType>::ConversionCallback conversion)
{
bool indexOk = false;
- unsigned index = exec->argument(1).toUInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return JSC::jsUndefined();
@@ -170,7 +170,7 @@ static JSC::JSValue removeItem(JSPODListType* wrapper, JSC::ExecState* exec,
typename JSSVGPODListTraits<PODType>::ConversionCallback)
{
bool indexOk = false;
- unsigned index = exec->argument(0).toUInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return JSC::jsUndefined();
diff --git a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
index 850e533..9767c1a 100644
--- a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
+++ b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
@@ -71,7 +71,7 @@ JSValue JSSVGPathSegList::getItem(ExecState* exec)
ExceptionCode ec = 0;
bool indexOk;
- unsigned index = exec->argument(0).toInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
@@ -92,7 +92,7 @@ JSValue JSSVGPathSegList::insertItemBefore(ExecState* exec)
SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0));
bool indexOk;
- unsigned index = exec->argument(1).toInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
@@ -114,7 +114,7 @@ JSValue JSSVGPathSegList::replaceItem(ExecState* exec)
SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0));
bool indexOk;
- unsigned index = exec->argument(1).toInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
@@ -135,7 +135,7 @@ JSValue JSSVGPathSegList::removeItem(ExecState* exec)
ExceptionCode ec = 0;
bool indexOk;
- unsigned index = exec->argument(0).toInt32(exec, indexOk);
+ unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
index ecb7fa6..1decefa 100644
--- a/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -406,7 +406,7 @@ void ScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)
Document* document = frame->document();
if (paused)
- document->suspendActiveDOMObjects();
+ document->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
else
document->resumeActiveDOMObjects();
diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index fcd3314..8ccaf9c 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -762,6 +762,25 @@ public:
}
private:
+ struct CachedString {
+ CachedString(const UString& string)
+ : m_string(string)
+ {
+ }
+
+ JSValue jsString(ExecState* exec)
+ {
+ if (!m_jsString)
+ m_jsString = JSC::jsString(exec, m_string);
+ return m_jsString;
+ }
+ const UString& ustring() { return m_string; }
+
+ private:
+ UString m_string;
+ JSValue m_jsString;
+ };
+
CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, const Vector<uint8_t>& buffer)
: CloneBase(exec)
, m_globalObject(globalObject)
@@ -903,13 +922,13 @@ private:
return true;
}
- bool readStringData(Identifier& ident)
+ bool readStringData(CachedString*& cachedString)
{
bool scratch;
- return readStringData(ident, scratch);
+ return readStringData(cachedString, scratch);
}
- bool readStringData(Identifier& ident, bool& wasTerminator)
+ bool readStringData(CachedString*& cachedString, bool& wasTerminator)
{
if (m_failed)
return false;
@@ -930,7 +949,7 @@ private:
fail();
return false;
}
- ident = m_constantPool[index];
+ cachedString = &m_constantPool[index];
return true;
}
UString str;
@@ -938,8 +957,8 @@ private:
fail();
return false;
}
- ident = Identifier(m_exec, str);
- m_constantPool.append(ident);
+ m_constantPool.append(str);
+ cachedString = &m_constantPool.last();
return true;
}
@@ -958,26 +977,24 @@ private:
array->put(m_exec, index, value);
}
- void putProperty(JSObject* object, Identifier& property, JSValue value)
+ void putProperty(JSObject* object, const Identifier& property, JSValue value)
{
object->putDirect(property, value);
}
bool readFile(RefPtr<File>& file)
{
- Identifier path;
+ CachedString* path = 0;
if (!readStringData(path))
return 0;
- Identifier url;
+ CachedString* url = 0;
if (!readStringData(url))
return 0;
- Identifier type;
+ CachedString* type = 0;
if (!readStringData(type))
return 0;
- if (m_isDOMGlobalObject) {
- ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext();
- file = File::create(scriptExecutionContext, String(path.ustring().impl()), KURL(KURL(), String(url.ustring().impl())), String(type.ustring().impl()));
- }
+ if (m_isDOMGlobalObject)
+ file = File::create(String(path->ustring().impl()), KURL(KURL(), String(url->ustring().impl())), String(type->ustring().impl()));
return true;
}
@@ -1063,10 +1080,10 @@ private:
return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
}
case BlobTag: {
- Identifier url;
+ CachedString* url = 0;
if (!readStringData(url))
return JSValue();
- Identifier type;
+ CachedString* type = 0;
if (!readStringData(type))
return JSValue();
unsigned long long size = 0;
@@ -1074,26 +1091,24 @@ private:
return JSValue();
if (!m_isDOMGlobalObject)
return jsNull();
- ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext();
- ASSERT(scriptExecutionContext);
- return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), Blob::create(scriptExecutionContext, KURL(KURL(), url.ustring().impl()), String(type.ustring().impl()), size));
+ return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), Blob::create(KURL(KURL(), url->ustring().impl()), String(type->ustring().impl()), size));
}
case StringTag: {
- Identifier ident;
- if (!readStringData(ident))
+ CachedString* cachedString = 0;
+ if (!readStringData(cachedString))
return JSValue();
- return jsString(m_exec, ident.ustring());
+ return cachedString->jsString(m_exec);
}
case EmptyStringTag:
return jsEmptyString(&m_exec->globalData());
case RegExpTag: {
- Identifier pattern;
+ CachedString* pattern = 0;
if (!readStringData(pattern))
return JSValue();
- Identifier flags;
+ CachedString* flags = 0;
if (!readStringData(flags))
return JSValue();
- RefPtr<RegExp> regExp = RegExp::create(&m_exec->globalData(), pattern.ustring(), flags.ustring());
+ RefPtr<RegExp> regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), flags->ustring());
return new (m_exec) RegExpObject(m_exec->lexicalGlobalObject(), m_globalObject->regExpStructure(), regExp);
}
default:
@@ -1107,7 +1122,7 @@ private:
const uint8_t* m_ptr;
const uint8_t* m_end;
unsigned m_version;
- Vector<Identifier> m_constantPool;
+ Vector<CachedString> m_constantPool;
};
JSValue CloneDeserializer::deserialize()
@@ -1196,9 +1211,9 @@ JSValue CloneDeserializer::deserialize()
tickCount = ticksUntilNextCheck();
}
- Identifier ident;
+ CachedString* cachedString = 0;
bool wasTerminator = false;
- if (!readStringData(ident, wasTerminator)) {
+ if (!readStringData(cachedString, wasTerminator)) {
if (!wasTerminator)
goto error;
JSObject* outObject = outputObjectStack.last();
@@ -1209,11 +1224,11 @@ JSValue CloneDeserializer::deserialize()
}
if (JSValue terminal = readTerminal()) {
- putProperty(outputObjectStack.last(), ident, terminal);
+ putProperty(outputObjectStack.last(), Identifier(m_exec, cachedString->ustring()), terminal);
goto objectStartVisitMember;
}
stateStack.append(ObjectEndVisitMember);
- propertyNameStack.append(ident);
+ propertyNameStack.append(Identifier(m_exec, cachedString->ustring()));
goto stateUnknown;
}
case ObjectEndVisitMember: {