summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/js')
-rw-r--r--WebCore/bindings/js/JSArrayBufferCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSArrayBufferViewCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSAttrCustom.cpp1
-rw-r--r--WebCore/bindings/js/JSConsoleCustom.cpp1
-rw-r--r--WebCore/bindings/js/JSDOMBinding.cpp10
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h1
-rw-r--r--WebCore/bindings/js/JSDOMFormDataCustom.cpp18
-rw-r--r--WebCore/bindings/js/JSDOMWindowBase.cpp11
-rw-r--r--WebCore/bindings/js/JSDOMWindowBase.h3
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp16
-rw-r--r--WebCore/bindings/js/JSDirectoryEntrySyncCustom.cpp101
-rw-r--r--WebCore/bindings/js/JSDocumentCustom.cpp3
-rw-r--r--WebCore/bindings/js/JSElementCustom.cpp1
-rw-r--r--WebCore/bindings/js/JSEntrySyncCustom.cpp (renamed from WebCore/bindings/js/ScriptString.h)75
-rw-r--r--WebCore/bindings/js/JSFloat32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSHTMLFrameElementCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSHTMLInputElementCustom.cpp34
-rw-r--r--WebCore/bindings/js/JSIDBAnyCustom.cpp7
-rw-r--r--WebCore/bindings/js/JSInt16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSInt32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSInt8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSLocationCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSNodeCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSUint16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSUint32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSUint8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSWebSocketCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestCustom.cpp5
-rw-r--r--WebCore/bindings/js/ScriptCallFrame.cpp6
-rw-r--r--WebCore/bindings/js/ScriptCallFrame.h44
-rw-r--r--WebCore/bindings/js/ScriptCallStack.h1
-rw-r--r--WebCore/bindings/js/ScriptController.cpp14
-rw-r--r--WebCore/bindings/js/ScriptController.h2
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp4
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.h2
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.cpp6
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.cpp61
38 files changed, 280 insertions, 199 deletions
diff --git a/WebCore/bindings/js/JSArrayBufferCustom.cpp b/WebCore/bindings/js/JSArrayBufferCustom.cpp
index 3555a60..68edc5c 100644
--- a/WebCore/bindings/js/JSArrayBufferCustom.cpp
+++ b/WebCore/bindings/js/JSArrayBufferCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBuffer.h"
@@ -54,4 +54,4 @@ EncodedJSValue JSC_HOST_CALL JSArrayBufferConstructor::constructJSArrayBuffer(Ex
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
index 1fb6b49..ccbddd2 100644
--- a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
+++ b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "config.h"
#include "JSArrayBufferView.h"
@@ -90,4 +90,4 @@ JSValue JSArrayBufferView::slice(ExecState* exec)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSAttrCustom.cpp b/WebCore/bindings/js/JSAttrCustom.cpp
index 998ecad..227582d 100644
--- a/WebCore/bindings/js/JSAttrCustom.cpp
+++ b/WebCore/bindings/js/JSAttrCustom.cpp
@@ -29,7 +29,6 @@
#include "config.h"
#include "JSAttr.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "Element.h"
#include "HTMLNames.h"
diff --git a/WebCore/bindings/js/JSConsoleCustom.cpp b/WebCore/bindings/js/JSConsoleCustom.cpp
index 3ad34a3..f0419c7 100644
--- a/WebCore/bindings/js/JSConsoleCustom.cpp
+++ b/WebCore/bindings/js/JSConsoleCustom.cpp
@@ -29,7 +29,6 @@
#include "Console.h"
#include "JSScriptProfile.h"
-#include "ScriptCallStack.h"
#include "ScriptProfile.h"
#include <runtime/JSArray.h>
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 74c8131..72e6d03 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -24,7 +24,6 @@
#include "debugger/DebuggerCallFrame.h"
#include "ActiveDOMObject.h"
-#include "CSSHelper.h"
#include "DOMCoreException.h"
#include "DOMObjectHashTableMap.h"
#include "Document.h"
@@ -453,6 +452,13 @@ JSValue jsStringOrNull(ExecState* exec, const String& s)
return jsString(exec, s);
}
+JSValue jsOwnedStringOrNull(ExecState* exec, const String& s)
+{
+ if (s.isNull())
+ return jsNull();
+ return jsOwnedString(exec, stringToUString(s));
+}
+
JSValue jsOwnedStringOrNull(ExecState* exec, const UString& s)
{
if (s.isNull())
@@ -648,7 +654,7 @@ bool shouldAllowNavigation(ExecState* exec, Frame* frame)
bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value)
{
- if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIsJavaScript(deprecatedParseURL(value))) {
+ if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) {
Document* contentDocument = static_cast<HTMLFrameElementBase*>(element)->contentDocument();
if (contentDocument && !checkNodeSecurity(exec, contentDocument))
return false;
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index f0bd2e2..64a3dad 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -254,6 +254,7 @@ namespace WebCore {
// See JavaScriptCore for explanation: Should be used for any UString that is already owned by another
// object, to let the engine know that collecting the JSString wrapper is unlikely to save memory.
+ JSC::JSValue jsOwnedStringOrNull(JSC::ExecState*, const String&);
JSC::JSValue jsOwnedStringOrNull(JSC::ExecState*, const JSC::UString&);
String identifierToString(const JSC::Identifier&);
diff --git a/WebCore/bindings/js/JSDOMFormDataCustom.cpp b/WebCore/bindings/js/JSDOMFormDataCustom.cpp
index f207578..2559e96 100644
--- a/WebCore/bindings/js/JSDOMFormDataCustom.cpp
+++ b/WebCore/bindings/js/JSDOMFormDataCustom.cpp
@@ -32,13 +32,31 @@
#include "JSDOMFormData.h"
#include "DOMFormData.h"
+#include "HTMLFormElement.h"
#include "JSBlob.h"
+#include "JSHTMLFormElement.h"
#include <runtime/Error.h>
using namespace JSC;
namespace WebCore {
+static HTMLFormElement* toHTMLFormElement(JSC::JSValue value)
+{
+ return value.inherits(&JSHTMLFormElement::s_info) ? static_cast<HTMLFormElement*>(static_cast<JSHTMLFormElement*>(asObject(value))->impl()) : 0;
+}
+
+EncodedJSValue JSC_HOST_CALL JSDOMFormDataConstructor::constructJSDOMFormData(ExecState* exec)
+{
+ JSDOMFormDataConstructor* jsConstructor = static_cast<JSDOMFormDataConstructor*>(exec->callee());
+
+ HTMLFormElement* form = 0;
+ if (exec->argumentCount() > 0)
+ form = toHTMLFormElement(exec->argument(0));
+ RefPtr<DOMFormData> domFormData = DOMFormData::create(form);
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), domFormData.get())));
+}
+
JSValue JSDOMFormData::append(ExecState* exec)
{
if (exec->argumentCount() >= 2) {
diff --git a/WebCore/bindings/js/JSDOMWindowBase.cpp b/WebCore/bindings/js/JSDOMWindowBase.cpp
index 82ac1ce..e2b50d0 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -37,7 +37,7 @@
#include "Settings.h"
#include "WebCoreJSClientData.h"
#include <wtf/Threading.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
using namespace JSC;
@@ -83,8 +83,8 @@ String JSDOMWindowBase::crossDomainAccessErrorMessage(const JSGlobalObject* othe
return String();
// FIXME: this error message should contain more specifics of why the same origin check has failed.
- return String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains, protocols and ports must match.\n",
- targetURL.string().utf8().data(), originURL.string().utf8().data());
+ return makeString("Unsafe JavaScript attempt to access frame with URL ", targetURL.string(),
+ " from frame with URL ", originURL.string(), ". Domains, protocols and ports must match.\n");
}
void JSDOMWindowBase::printErrorMessage(const String& message) const
@@ -146,6 +146,11 @@ JSObject* JSDOMWindowBase::toThisObject(ExecState*) const
return shell();
}
+JSValue JSDOMWindowBase::toStrictThisObject(ExecState*) const
+{
+ return shell();
+}
+
JSDOMWindowShell* JSDOMWindowBase::shell() const
{
return d()->shell;
diff --git a/WebCore/bindings/js/JSDOMWindowBase.h b/WebCore/bindings/js/JSDOMWindowBase.h
index f4f1ef9..cafca73 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.h
+++ b/WebCore/bindings/js/JSDOMWindowBase.h
@@ -69,8 +69,9 @@ namespace WebCore {
// Don't call this version of allowsAccessFrom -- it's a slightly incorrect implementation used only by WebScriptObject
virtual bool allowsAccessFrom(const JSC::JSGlobalObject*) const;
-
+
virtual JSC::JSObject* toThisObject(JSC::ExecState*) const;
+ virtual JSC::JSValue toStrictThisObject(JSC::ExecState*) const;
JSDOMWindowShell* shell() const;
static JSC::JSGlobalData* commonJSGlobalData();
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 2ad71f0..ecb37f3 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -51,7 +51,7 @@
#include "JSSharedWorker.h"
#endif
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBuffer.h"
#include "JSInt8Array.h"
#include "JSUint8Array.h"
@@ -512,7 +512,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
if (!protocolIsJavaScript(url) || allowsAccessFrom(exec)) {
// We want a new history item if this JS was called via a user gesture
- frame->redirectScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture());
+ frame->navigationScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false);
}
}
@@ -565,7 +565,7 @@ JSValue JSDOMWindow::webKitCSSMatrix(ExecState* exec) const
return getDOMConstructor<JSWebKitCSSMatrixConstructor>(exec, this);
}
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
JSValue JSDOMWindow::arrayBuffer(ExecState* exec) const
{
return getDOMConstructor<JSArrayBufferConstructor>(exec, this);
@@ -700,12 +700,10 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF
if (!protocolIsJavaScript(url) || newWindow->allowsAccessFrom(exec)) {
KURL completedURL = url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(exec, url);
- bool userGesture = processingUserGesture();
-
if (created)
- newFrame->loader()->changeLocation(completedURL, referrer, false, false, userGesture);
+ newFrame->loader()->changeLocation(completedURL, referrer, false, false);
else if (!url.isEmpty())
- newFrame->redirectScheduler()->scheduleLocationChange(completedURL.string(), referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
+ newFrame->navigationScheduler()->scheduleLocationChange(completedURL.string(), referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false);
}
return newFrame;
@@ -763,14 +761,12 @@ JSValue JSDOMWindow::open(ExecState* exec)
const JSDOMWindow* targetedWindow = toJSDOMWindow(frame, currentWorld(exec));
if (!completedURL.isEmpty() && (!protocolIsJavaScript(completedURL) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
- bool userGesture = processingUserGesture();
-
// For whatever reason, Firefox uses the dynamicGlobalObject to
// determine the outgoingReferrer. We replicate that behavior
// here.
String referrer = dynamicFrame->loader()->outgoingReferrer();
- frame->redirectScheduler()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
+ frame->navigationScheduler()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false);
}
return toJS(exec, frame->domWindow());
}
diff --git a/WebCore/bindings/js/JSDirectoryEntrySyncCustom.cpp b/WebCore/bindings/js/JSDirectoryEntrySyncCustom.cpp
new file mode 100644
index 0000000..ef14b79
--- /dev/null
+++ b/WebCore/bindings/js/JSDirectoryEntrySyncCustom.cpp
@@ -0,0 +1,101 @@
+/*
+ * 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 "JSDirectoryEntrySync.h"
+
+#include "JSDOMBinding.h"
+#include "JSEntryCallback.h"
+#include "JSErrorCallback.h"
+#include "JSFileEntrySync.h"
+#include "JSFlags.h"
+#include <wtf/Assertions.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+static PassRefPtr<Flags> getFlags(ExecState* exec, const JSValue& argument)
+{
+ if (argument.isNull() || argument.isUndefined() || !argument.isObject())
+ return 0;
+ if (argument.inherits(&JSFlags::s_info))
+ return toFlags(argument);
+
+ RefPtr<Flags> flags;
+ JSObject* object = argument.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));
+ return flags;
+}
+
+JSValue JSDirectoryEntrySync::getFile(ExecState* exec)
+{
+ DirectoryEntrySync* imp = static_cast<DirectoryEntrySync*>(impl());
+ const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<Flags> flags = getFlags(exec, exec->argument(1));
+ if (exec->hadException())
+ return jsUndefined();
+
+ ExceptionCode ec = 0;
+ JSC::JSValue result = toJS(exec, this->globalObject(), WTF::getPtr(imp->getFile(path, flags, ec)));
+ setDOMException(exec, ec);
+ return result;
+}
+
+JSValue JSDirectoryEntrySync::getDirectory(ExecState* exec)
+{
+ DirectoryEntrySync* imp = static_cast<DirectoryEntrySync*>(impl());
+ const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<Flags> flags = getFlags(exec, exec->argument(1));
+ if (exec->hadException())
+ return jsUndefined();
+
+ ExceptionCode ec = 0;
+ JSC::JSValue result = toJS(exec, this->globalObject(), WTF::getPtr(imp->getDirectory(path, flags, ec)));
+ setDOMException(exec, ec);
+ return result;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/js/JSDocumentCustom.cpp b/WebCore/bindings/js/JSDocumentCustom.cpp
index ec66cbd..8a107e9 100644
--- a/WebCore/bindings/js/JSDocumentCustom.cpp
+++ b/WebCore/bindings/js/JSDocumentCustom.cpp
@@ -88,8 +88,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue value)
if (activeFrame)
str = activeFrame->document()->completeURL(str).string();
- bool userGesture = ScriptController::processingUserGesture();
- frame->redirectScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
+ frame->navigationScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false);
}
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Document* document)
diff --git a/WebCore/bindings/js/JSElementCustom.cpp b/WebCore/bindings/js/JSElementCustom.cpp
index f691620..3bfe110 100644
--- a/WebCore/bindings/js/JSElementCustom.cpp
+++ b/WebCore/bindings/js/JSElementCustom.cpp
@@ -30,7 +30,6 @@
#include "config.h"
#include "JSElement.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "HTMLFrameElementBase.h"
diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/JSEntrySyncCustom.cpp
index 7401818..22f96ad 100644
--- a/WebCore/bindings/js/ScriptString.h
+++ b/WebCore/bindings/js/JSEntrySyncCustom.cpp
@@ -1,10 +1,10 @@
/*
- * Copyright (c) 2008, 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
* 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
@@ -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,61 +28,34 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScriptString_h
-#define ScriptString_h
+#include "config.h"
-#include "JSDOMBinding.h"
-#include "PlatformString.h"
-#include <runtime/UString.h>
-#include <runtime/StringBuilder.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
+#if ENABLE(FILE_SYSTEM)
-class ScriptString {
-public:
- ScriptString() {}
- ScriptString(const char* s) : m_str(s) {}
- ScriptString(const String& s) : m_str(stringToUString(s)) {}
- ScriptString(const JSC::UString& s) : m_str(s) {}
+#include "JSEntrySync.h"
- operator JSC::UString() const { return m_str; }
- operator String() const { return ustringToString(m_str); }
- const JSC::UString& ustring() const { return m_str; }
-
- bool isNull() const { return m_str.isNull(); }
- size_t size() const { return m_str.length(); }
+#include "EntrySync.h"
+#include "JSDOMBinding.h"
+#include "JSDirectoryEntrySync.h"
+#include "JSFileEntrySync.h"
+#include <wtf/Assertions.h>
- ScriptString& operator=(const char* s)
- {
- m_str = s;
- return *this;
- }
+using namespace JSC;
- ScriptString& operator+=(const String& s)
- {
- JSC::StringBuilder buffer;
- buffer.append(m_str);
- buffer.append(stringToUString(s));
- m_str = buffer.build();
- return *this;
- }
+namespace WebCore {
- bool operator==(const ScriptString& s) const
- {
- return m_str == s.m_str;
- }
+JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EntrySync* entry)
+{
+ if (!entry)
+ return jsNull();
- bool operator!=(const ScriptString& s) const
- {
- // Avoid exporting an extra symbol by re-using "==" operator.
- return !(m_str == s.m_str);
- }
+ if (entry->isFile())
+ return getDOMObjectWrapper<JSFileEntrySync>(exec, globalObject, static_cast<FileEntrySync*>(entry));
-private:
- JSC::UString m_str;
-};
+ ASSERT(entry->isDirectory());
+ return getDOMObjectWrapper<JSDirectoryEntrySync>(exec, globalObject, static_cast<DirectoryEntrySync*>(entry));
+}
} // namespace WebCore
-#endif // ScriptString_h
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
index 3be7458..671ee68 100644
--- a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSFloat32Array.h"
@@ -63,4 +63,4 @@ EncodedJSValue JSC_HOST_CALL JSFloat32ArrayConstructor::constructJSFloat32Array(
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp b/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp
index 345cffe..5994167 100644
--- a/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp
@@ -29,10 +29,10 @@
#include "config.h"
#include "JSHTMLFrameElement.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "HTMLFrameElement.h"
#include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
#include "JSDOMBinding.h"
using namespace JSC;
@@ -43,7 +43,7 @@ using namespace HTMLNames;
static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* imp, const String& value)
{
- if (protocolIsJavaScript(deprecatedParseURL(value))) {
+ if (protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) {
Document* contentDocument = imp->contentDocument();
if (contentDocument && !checkNodeSecurity(exec, contentDocument))
return false;
diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp
index 23db266..412a096 100644
--- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp
@@ -26,47 +26,13 @@
#include "config.h"
#include "JSHTMLInputElement.h"
-#include "Document.h"
#include "HTMLInputElement.h"
-#include "Settings.h"
#include <runtime/Error.h>
using namespace JSC;
namespace WebCore {
-static bool needsGmailQuirk(HTMLInputElement* input)
-{
- Document* document = input->document();
-
- const KURL& url = document->url();
- if (url.host() != "mail.google.com")
- return false;
-
- // As with other site-specific quirks, allow website developers to turn this off.
- // In theory, this allows website developers to check if their fixes are effective.
- Settings* settings = document->settings();
- if (!settings)
- return false;
- if (!settings->needsSiteSpecificQuirks())
- return false;
-
- return true;
-}
-
-JSValue JSHTMLInputElement::type(ExecState* exec) const
-{
- HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
- const AtomicString& type = input->type();
-
- DEFINE_STATIC_LOCAL(const AtomicString, url, ("url"));
- DEFINE_STATIC_LOCAL(const AtomicString, text, ("text"));
-
- if (type == url && needsGmailQuirk(input))
- return jsString(exec, text);
- return jsString(exec, type);
-}
-
JSValue JSHTMLInputElement::selectionStart(ExecState* exec) const
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp
index e428bf6..506f15f 100644
--- a/WebCore/bindings/js/JSIDBAnyCustom.cpp
+++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp
@@ -44,6 +44,7 @@
#include "JSIDBIndex.h"
#include "JSIDBKey.h"
#include "JSIDBObjectStore.h"
+#include "JSIDBTransaction.h"
#include "SerializedScriptValue.h"
using namespace JSC;
@@ -64,14 +65,16 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny)
return toJS(exec, globalObject, idbAny->idbCursor());
case IDBAny::IDBDatabaseType:
return toJS(exec, globalObject, idbAny->idbDatabase());
+ case IDBAny::IDBFactoryType:
+ return toJS(exec, globalObject, idbAny->idbFactory());
case IDBAny::IDBIndexType:
return toJS(exec, globalObject, idbAny->idbIndex());
case IDBAny::IDBKeyType:
return toJS(exec, globalObject, idbAny->idbKey());
case IDBAny::IDBObjectStoreType:
return toJS(exec, globalObject, idbAny->idbObjectStore());
- case IDBAny::IDBFactoryType:
- return toJS(exec, globalObject, idbAny->idbFactory());
+ case IDBAny::IDBTransactionType:
+ return toJS(exec, globalObject, idbAny->idbTransaction());
case IDBAny::SerializedScriptValueType:
return idbAny->serializedScriptValue()->deserialize(exec, globalObject);
}
diff --git a/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/WebCore/bindings/js/JSInt16ArrayCustom.cpp
index e8be4d1..797568c 100644
--- a/WebCore/bindings/js/JSInt16ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt16ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSInt16Array.h"
@@ -63,4 +63,4 @@ EncodedJSValue JSC_HOST_CALL JSInt16ArrayConstructor::constructJSInt16Array(Exec
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/WebCore/bindings/js/JSInt32ArrayCustom.cpp
index ee5712b..53e6ec6 100644
--- a/WebCore/bindings/js/JSInt32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt32ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSInt32Array.h"
@@ -63,4 +63,4 @@ EncodedJSValue JSC_HOST_CALL JSInt32ArrayConstructor::constructJSInt32Array(Exec
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/WebCore/bindings/js/JSInt8ArrayCustom.cpp
index 70f18a5..7556d6a 100644
--- a/WebCore/bindings/js/JSInt8ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt8ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSInt8Array.h"
@@ -64,4 +64,4 @@ EncodedJSValue JSC_HOST_CALL JSInt8ArrayConstructor::constructJSInt8Array(ExecSt
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp
index 09e7294..b00249f 100644
--- a/WebCore/bindings/js/JSLocationCustom.cpp
+++ b/WebCore/bindings/js/JSLocationCustom.cpp
@@ -313,7 +313,7 @@ JSValue JSLocation::reload(ExecState* exec)
return jsUndefined();
if (!protocolIsJavaScript(frame->loader()->url()))
- frame->redirectScheduler()->scheduleRefresh(processingUserGesture());
+ frame->navigationScheduler()->scheduleRefresh();
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp
index b7c50f2..a0963b8 100644
--- a/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/WebCore/bindings/js/JSNodeCustom.cpp
@@ -127,6 +127,8 @@ void JSNode::markChildren(MarkStack& markStack)
// the document, we need to mark the document, but we don't need to explicitly
// mark any other nodes.
if (node->inDocument()) {
+ // FIXME: Do we really want to call a virtual function, ownerDocument here,
+ // when the non-virtual inline function, document, is so much faster?!
if (Document* doc = node->ownerDocument())
markDOMNodeWrapper(markStack, doc, doc);
return;
diff --git a/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/WebCore/bindings/js/JSUint16ArrayCustom.cpp
index ccea62f..9f12fa7 100644
--- a/WebCore/bindings/js/JSUint16ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint16ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSUint16Array.h"
@@ -63,4 +63,4 @@ EncodedJSValue JSC_HOST_CALL JSUint16ArrayConstructor::constructJSUint16Array(Ex
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/WebCore/bindings/js/JSUint32ArrayCustom.cpp
index 31ec8cb..c757786 100644
--- a/WebCore/bindings/js/JSUint32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint32ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSUint32Array.h"
@@ -63,4 +63,4 @@ EncodedJSValue JSC_HOST_CALL JSUint32ArrayConstructor::constructJSUint32Array(Ex
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/WebCore/bindings/js/JSUint8ArrayCustom.cpp
index 7361b08..adf60a9 100644
--- a/WebCore/bindings/js/JSUint8ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint8ArrayCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBufferViewHelper.h"
#include "JSUint8Array.h"
@@ -63,4 +63,4 @@ EncodedJSValue JSC_HOST_CALL JSUint8ArrayConstructor::constructJSUint8Array(Exec
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp
index 3567206..813c0d4 100644
--- a/WebCore/bindings/js/JSWebSocketCustom.cpp
+++ b/WebCore/bindings/js/JSWebSocketCustom.cpp
@@ -54,16 +54,16 @@ EncodedJSValue JSC_HOST_CALL JSWebSocketConstructor::constructJSWebSocket(ExecSt
if (!exec->argumentCount())
return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
- const String& urlString = ustringToString(exec->argument(0).toString(exec));
+ String urlString = ustringToString(exec->argument(0).toString(exec));
if (exec->hadException())
return throwVMError(exec, createSyntaxError(exec, "wrong URL"));
- const KURL& url = context->completeURL(urlString);
+ KURL url = context->completeURL(urlString);
RefPtr<WebSocket> webSocket = WebSocket::create(context);
ExceptionCode ec = 0;
if (exec->argumentCount() < 2)
webSocket->connect(url, ec);
else {
- const String& protocol = ustringToString(exec->argument(1).toString(exec));
+ String protocol = ustringToString(exec->argument(1).toString(exec));
if (exec->hadException())
return JSValue::encode(JSValue());
webSocket->connect(url, protocol, ec);
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 2da3771..58d324d 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -37,6 +37,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
+#include "InspectorInstrumentation.h"
#include "JSBlob.h"
#include "JSDOMFormData.h"
#include "JSDOMWindowCustom.h"
@@ -93,6 +94,8 @@ JSValue JSXMLHttpRequest::open(ExecState* exec)
JSValue JSXMLHttpRequest::send(ExecState* exec)
{
+ InspectorInstrumentation::willSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());
+
ExceptionCode ec = 0;
if (!exec->argumentCount())
impl()->send(ec);
@@ -125,7 +128,7 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
JSValue JSXMLHttpRequest::responseText(ExecState* exec) const
{
ExceptionCode ec = 0;
- const ScriptString& text = impl()->responseText(ec);
+ String text = impl()->responseText(ec);
if (ec) {
setDOMException(exec, ec);
return jsUndefined();
diff --git a/WebCore/bindings/js/ScriptCallFrame.cpp b/WebCore/bindings/js/ScriptCallFrame.cpp
index 8381a4e..2f74b96 100644
--- a/WebCore/bindings/js/ScriptCallFrame.cpp
+++ b/WebCore/bindings/js/ScriptCallFrame.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "ScriptCallFrame.h"
-#include <interpreter/CallFrame.h>
+#include <runtime/ArgList.h>
#include <runtime/UString.h>
using namespace JSC;
@@ -39,8 +39,8 @@ using namespace JSC;
namespace WebCore {
ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, ExecState* exec, unsigned skipArgumentCount)
- : m_functionName(functionName)
- , m_sourceURL(ParsedURLString, ustringToString(urlString))
+ : m_functionName(ustringToString(functionName))
+ , m_sourceURL(ustringToString(urlString))
, m_lineNumber(lineNumber)
{
if (!exec)
diff --git a/WebCore/bindings/js/ScriptCallFrame.h b/WebCore/bindings/js/ScriptCallFrame.h
index 202f4b6..31aec7e 100644
--- a/WebCore/bindings/js/ScriptCallFrame.h
+++ b/WebCore/bindings/js/ScriptCallFrame.h
@@ -31,43 +31,37 @@
#ifndef ScriptCallFrame_h
#define ScriptCallFrame_h
-#include "KURL.h"
-#include <runtime/ArgList.h>
-#include "ScriptString.h"
+#include "PlatformString.h"
#include "ScriptValue.h"
#include <wtf/Vector.h>
namespace JSC {
- class ExecState;
- class InternalFunction;
+class ExecState;
+class UString;
}
namespace WebCore {
- // FIXME: Implement retrieving line number and source URL and storing here
- // for all call frames, not just the first one.
- // See <https://bugs.webkit.org/show_bug.cgi?id=22556> and
- // <https://bugs.webkit.org/show_bug.cgi?id=21180>
- class ScriptCallFrame {
- public:
- ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, JSC::ExecState*, unsigned skipArgumentCount);
- ~ScriptCallFrame();
+class ScriptCallFrame {
+public:
+ ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, JSC::ExecState*, unsigned skipArgumentCount);
+ ~ScriptCallFrame();
- const ScriptString& functionName() const { return m_functionName; }
- const KURL& sourceURL() const { return m_sourceURL; }
- unsigned lineNumber() const { return m_lineNumber; }
+ const String& functionName() const { return m_functionName; }
+ const String& sourceURL() const { return m_sourceURL; }
+ unsigned lineNumber() const { return m_lineNumber; }
- // argument retrieval methods
- const ScriptValue& argumentAt(unsigned) const;
- unsigned argumentCount() const { return m_arguments.size(); }
+ // argument retrieval methods
+ const ScriptValue& argumentAt(unsigned) const;
+ unsigned argumentCount() const { return m_arguments.size(); }
- private:
- ScriptString m_functionName;
- KURL m_sourceURL;
- unsigned m_lineNumber;
+private:
+ String m_functionName;
+ String m_sourceURL;
+ unsigned m_lineNumber;
- Vector<ScriptValue> m_arguments;
- };
+ Vector<ScriptValue> m_arguments;
+};
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h
index a45e65a..17d1c46 100644
--- a/WebCore/bindings/js/ScriptCallStack.h
+++ b/WebCore/bindings/js/ScriptCallStack.h
@@ -33,7 +33,6 @@
#include "ScriptCallFrame.h"
#include "ScriptState.h"
-#include "ScriptString.h"
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index d318cbb..e03c822 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -28,7 +28,7 @@
#include "FrameLoaderClient.h"
#include "GCController.h"
#include "HTMLPlugInElement.h"
-#include "InspectorTimelineAgent.h"
+#include "InspectorInstrumentation.h"
#include "JSDocument.h"
#include "JSMainThreadExecState.h"
#include "NP_jsobject.h"
@@ -142,19 +142,13 @@ ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode
RefPtr<Frame> protect = m_frame;
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
- timelineAgent->willEvaluateScript(sourceURL, sourceCode.startLine());
-#endif
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
exec->globalData().timeoutChecker.start();
Completion comp = JSMainThreadExecState::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell);
exec->globalData().timeoutChecker.stop();
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
- timelineAgent->didEvaluateScript();
-#endif
+ InspectorInstrumentation::didEvaluateScript(cookie);
// Evaluating the JavaScript could cause the frame to be deallocated
// so we start the keep alive timer here.
@@ -500,7 +494,7 @@ void ScriptController::clearScriptObjects()
ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture, ShouldAllowXSS shouldAllowXSS)
{
- ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url());
+ ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->document()->url());
if (!canExecuteScripts(AboutToExecuteScript) || isPaused())
return ScriptValue();
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 2ec71b9..413b88a 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -98,7 +98,7 @@ public:
ScriptValue executeScriptInWorld(DOMWrapperWorld* world, 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.
// Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
index 1decefa..a440b81 100644
--- a/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -200,9 +200,9 @@ void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pause)
m_pauseOnExceptionsState = pause;
}
-void ScriptDebugServer::pause()
+void ScriptDebugServer::setPauseOnNextStatement(bool pause)
{
- m_pauseOnNextStatement = true;
+ m_pauseOnNextStatement = pause;
}
void ScriptDebugServer::breakProgram()
diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h
index 432fe9a..3172c65 100644
--- a/WebCore/bindings/js/ScriptDebugServer.h
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -78,7 +78,7 @@ public:
PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; }
void setPauseOnExceptionsState(PauseOnExceptionsState);
- void pause();
+ void setPauseOnNextStatement(bool pause);
void breakProgram();
void continueProgram();
void stepIntoStatement();
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index 2e4d536..775e3ad 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -33,7 +33,6 @@
#include "JSDOMBinding.h"
#include "JSMainThreadExecState.h"
-#include "ScriptString.h"
#include "ScriptValue.h"
#include <runtime/JSLock.h>
@@ -52,11 +51,6 @@ void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument)
m_arguments.append(argument.jsObject());
}
-void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument)
-{
- m_arguments.append(jsString(m_exec, argument.ustring()));
-}
-
void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument)
{
m_arguments.append(argument.jsValue());
diff --git a/WebCore/bindings/js/ScriptFunctionCall.h b/WebCore/bindings/js/ScriptFunctionCall.h
index 037a336..c7da858 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.h
+++ b/WebCore/bindings/js/ScriptFunctionCall.h
@@ -44,14 +44,12 @@ namespace JSC {
namespace WebCore {
class ScriptValue;
- class ScriptString;
class ScriptCallArgumentHandler {
public:
ScriptCallArgumentHandler(ScriptState* state) : m_exec(state) { }
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/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index 8ccaf9c..c9ad0e6 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -781,6 +781,25 @@ private:
JSValue m_jsString;
};
+ struct CachedStringRef {
+ CachedStringRef()
+ : m_base(0)
+ , m_index(0)
+ {
+ }
+ CachedStringRef(Vector<CachedString>* base, size_t index)
+ : m_base(base)
+ , m_index(index)
+ {
+ }
+
+ CachedString* operator->() { ASSERT(m_base); return &m_base->at(m_index); }
+
+ private:
+ Vector<CachedString>* m_base;
+ size_t m_index;
+ };
+
CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, const Vector<uint8_t>& buffer)
: CloneBase(exec)
, m_globalObject(globalObject)
@@ -819,7 +838,12 @@ private:
if (sizeof(T) == 1)
value = *ptr++;
else {
- value = *reinterpret_cast_ptr<const T*>(ptr);
+#if CPU(ARMV5_OR_LOWER)
+ // To protect misaligned memory access.
+ memcpy(&value, ptr, sizeof(T));
+#else
+ value = *reinterpret_cast<const T*>(ptr);
+#endif
ptr += sizeof(T);
}
return true;
@@ -907,7 +931,14 @@ private:
return false;
#if ASSUME_LITTLE_ENDIAN
- str = UString(reinterpret_cast_ptr<const UChar*>(ptr), length);
+#if CPU(ARMV5_OR_LOWER)
+ // To protect misaligned memory access.
+ Vector<UChar> alignedBuffer(length);
+ memcpy(alignedBuffer.data(), ptr, length * sizeof(UChar));
+ str = UString::adopt(alignedBuffer);
+#else
+ str = UString(reinterpret_cast<const UChar*>(ptr), length);
+#endif
ptr += length * sizeof(UChar);
#else
Vector<UChar> buffer;
@@ -922,13 +953,13 @@ private:
return true;
}
- bool readStringData(CachedString*& cachedString)
+ bool readStringData(CachedStringRef& cachedString)
{
bool scratch;
return readStringData(cachedString, scratch);
}
- bool readStringData(CachedString*& cachedString, bool& wasTerminator)
+ bool readStringData(CachedStringRef& cachedString, bool& wasTerminator)
{
if (m_failed)
return false;
@@ -949,7 +980,7 @@ private:
fail();
return false;
}
- cachedString = &m_constantPool[index];
+ cachedString = CachedStringRef(&m_constantPool, index);
return true;
}
UString str;
@@ -958,7 +989,7 @@ private:
return false;
}
m_constantPool.append(str);
- cachedString = &m_constantPool.last();
+ cachedString = CachedStringRef(&m_constantPool, m_constantPool.size() - 1);
return true;
}
@@ -984,13 +1015,13 @@ private:
bool readFile(RefPtr<File>& file)
{
- CachedString* path = 0;
+ CachedStringRef path;
if (!readStringData(path))
return 0;
- CachedString* url = 0;
+ CachedStringRef url;
if (!readStringData(url))
return 0;
- CachedString* type = 0;
+ CachedStringRef type;
if (!readStringData(type))
return 0;
if (m_isDOMGlobalObject)
@@ -1080,10 +1111,10 @@ private:
return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
}
case BlobTag: {
- CachedString* url = 0;
+ CachedStringRef url;
if (!readStringData(url))
return JSValue();
- CachedString* type = 0;
+ CachedStringRef type;
if (!readStringData(type))
return JSValue();
unsigned long long size = 0;
@@ -1094,7 +1125,7 @@ private:
return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), Blob::create(KURL(KURL(), url->ustring().impl()), String(type->ustring().impl()), size));
}
case StringTag: {
- CachedString* cachedString = 0;
+ CachedStringRef cachedString;
if (!readStringData(cachedString))
return JSValue();
return cachedString->jsString(m_exec);
@@ -1102,10 +1133,10 @@ private:
case EmptyStringTag:
return jsEmptyString(&m_exec->globalData());
case RegExpTag: {
- CachedString* pattern = 0;
+ CachedStringRef pattern;
if (!readStringData(pattern))
return JSValue();
- CachedString* flags = 0;
+ CachedStringRef flags;
if (!readStringData(flags))
return JSValue();
RefPtr<RegExp> regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), flags->ustring());
@@ -1211,7 +1242,7 @@ JSValue CloneDeserializer::deserialize()
tickCount = ticksUntilNextCheck();
}
- CachedString* cachedString = 0;
+ CachedStringRef cachedString;
bool wasTerminator = false;
if (!readStringData(cachedString, wasTerminator)) {
if (!wasTerminator)