summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/ScriptControllerBase.cpp6
-rw-r--r--WebCore/bindings/generic/BindingDOMWindow.h10
-rw-r--r--WebCore/bindings/generic/BindingFrame.h2
-rw-r--r--WebCore/bindings/generic/BindingSecurity.h4
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.h33
-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
-rw-r--r--WebCore/bindings/objc/DOM.mm3
-rw-r--r--WebCore/bindings/objc/DOMHTML.mm3
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm12
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm6
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm6
-rw-r--r--WebCore/bindings/v8/DebuggerScript.js4
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.cpp21
-rw-r--r--WebCore/bindings/v8/ScriptCallFrame.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptCallFrame.h9
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.cpp10
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.h1
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptController.h2
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp8
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h2
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.cpp7
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/v8/ScriptProfiler.cpp2
-rw-r--r--WebCore/bindings/v8/ScriptStringImpl.h77
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.cpp8
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.h4
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.cpp22
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp6
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp2
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp72
-rw-r--r--WebCore/bindings/v8/V8Proxy.h30
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp17
-rw-r--r--WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp139
-rw-r--r--WebCore/bindings/v8/custom/V8ElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp (renamed from WebCore/bindings/v8/ScriptStringImpl.cpp)55
-rwxr-xr-x[-rw-r--r--]WebCore/bindings/v8/custom/V8FileReaderCustom.cpp (renamed from WebCore/bindings/v8/ScriptString.h)58
-rw-r--r--WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8LocationCustom.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp8
88 files changed, 648 insertions, 543 deletions
diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp
index 01911d8..a77ff9c 100644
--- a/WebCore/bindings/ScriptControllerBase.cpp
+++ b/WebCore/bindings/ScriptControllerBase.cpp
@@ -46,7 +46,7 @@ bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
ScriptValue ScriptController::executeScript(const String& script, bool forceUserGesture, ShouldAllowXSS shouldAllowXSS)
{
- return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()), shouldAllowXSS);
+ return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->document()->url()), shouldAllowXSS);
}
ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode, ShouldAllowXSS shouldAllowXSS)
@@ -67,7 +67,7 @@ ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode,
return result;
}
-bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)
+bool ScriptController::executeIfJavaScriptURL(const KURL& url, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)
{
if (!protocolIsJavaScript(url))
return false;
@@ -90,7 +90,7 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture,
String decodedURL = decodeURLEscapeSequences(url.string());
ScriptValue result;
if (xssAuditor()->canEvaluateJavaScriptURL(decodedURL))
- result = executeScript(decodedURL.substring(javascriptSchemeLength), userGesture, AllowXSS);
+ result = executeScript(decodedURL.substring(javascriptSchemeLength), processingUserGesture(), AllowXSS);
// If executing script caused this frame to be removed from the page, we
// don't want to try to replace its document!
diff --git a/WebCore/bindings/generic/BindingDOMWindow.h b/WebCore/bindings/generic/BindingDOMWindow.h
index 96b8b9d..3568e6c 100644
--- a/WebCore/bindings/generic/BindingDOMWindow.h
+++ b/WebCore/bindings/generic/BindingDOMWindow.h
@@ -119,12 +119,10 @@ Frame* BindingDOMWindow<Binding>::createWindow(State<Binding>* state,
if (!protocolIsJavaScript(url) || BindingSecurity<Binding>::canAccessFrame(state, newFrame, true)) {
KURL completedUrl =
url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(state, url);
- bool userGesture = state->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, false, false, userGesture);
+ newFrame->navigationScheduler()->scheduleLocationChange(completedUrl.string(), referrer, false, false);
}
return newFrame;
@@ -187,13 +185,11 @@ WebCore::DOMWindow* BindingDOMWindow<Binding>::open(State<Binding>* state,
if (!completedUrl.isEmpty()
&& (!protocolIsJavaScript(completedUrl)
|| BindingSecurity<Binding>::canAccessFrame(state, frame, true))) {
- bool userGesture = state->processingUserGesture();
-
// For whatever reason, Firefox uses the first frame to determine
// the outgoingReferrer. We replicate that behavior here.
String referrer = firstFrame->loader()->outgoingReferrer();
- frame->redirectScheduler()->scheduleLocationChange(completedUrl, referrer, false, false, userGesture);
+ frame->navigationScheduler()->scheduleLocationChange(completedUrl, referrer, false, false);
}
return frame->domWindow();
}
diff --git a/WebCore/bindings/generic/BindingFrame.h b/WebCore/bindings/generic/BindingFrame.h
index f1fdc79..d41206c 100644
--- a/WebCore/bindings/generic/BindingFrame.h
+++ b/WebCore/bindings/generic/BindingFrame.h
@@ -49,7 +49,7 @@ void BindingFrame<Binding>::navigateIfAllowed(State<Binding>* state, Frame* fram
if (!activeFrame)
return;
if (!protocolIsJavaScript(url) || state->allowsAccessFromFrame(frame))
- frame->redirectScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, state->processingUserGesture());
+ frame->navigationScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList);
}
} // namespace WebCore
diff --git a/WebCore/bindings/generic/BindingSecurity.h b/WebCore/bindings/generic/BindingSecurity.h
index 1124f7e..1ce556c 100644
--- a/WebCore/bindings/generic/BindingSecurity.h
+++ b/WebCore/bindings/generic/BindingSecurity.h
@@ -32,12 +32,12 @@
#define BindingSecurity_h
#include "BindingSecurityBase.h"
-#include "CSSHelper.h"
#include "Element.h"
#include "Frame.h"
#include "GenericBinding.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
#include "Settings.h"
namespace WebCore {
@@ -128,7 +128,7 @@ bool BindingSecurity<Binding>::allowPopUp(State<Binding>* state)
template <class Binding>
bool BindingSecurity<Binding>::allowSettingFrameSrcToJavascriptUrl(State<Binding>* state, HTMLFrameElementBase* frame, String value)
{
- if (protocolIsJavaScript(deprecatedParseURL(value))) {
+ if (protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) {
Node* contentDoc = frame->contentDocument();
if (contentDoc && !checkNodeSecurity(state, contentDoc))
return false;
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index 88350c7..1054f64 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -54,21 +54,21 @@ public:
static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
static bool geolocationEnabled() { return isGeolocationEnabled; }
- static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
- static bool indexedDBEnabled() { return isIndexedDBEnabled; }
- static bool iDBCursorEnabled() { return isIndexedDBEnabled; }
- static bool iDBDatabaseEnabled() { return isIndexedDBEnabled; }
- static bool iDBDatabaseErrorEnabled() { return isIndexedDBEnabled; }
- static bool iDBDatabaseExceptionEnabled() { return isIndexedDBEnabled; }
- static bool iDBErrorEventEnabled() { return isIndexedDBEnabled; }
- static bool iDBEventEnabled() { return isIndexedDBEnabled; }
- static bool iDBFactoryEnabled() { return isIndexedDBEnabled; }
- static bool iDBIndexEnabled() { return isIndexedDBEnabled; }
- static bool iDBKeyRangeEnabled() { return isIndexedDBEnabled; }
- static bool iDBObjectStoreEnabled() { return isIndexedDBEnabled; }
- static bool iDBRequestEnabled() { return isIndexedDBEnabled; }
- static bool iDBSuccessEventEnabled() { return isIndexedDBEnabled; }
- static bool iDBTransactionEnabled() { return isIndexedDBEnabled; }
+ static void setWebkitIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
+ static bool webkitIndexedDBEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBCursorEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBDatabaseEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBDatabaseErrorEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBDatabaseExceptionEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBErrorEventEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBEventEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBFactoryEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBIndexEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBKeyRangeEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBObjectStoreEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBRequestEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBSuccessEventEnabled() { return isIndexedDBEnabled; }
+ static bool webkitIDBTransactionEnabled() { return isIndexedDBEnabled; }
#if ENABLE(VIDEO)
static bool audioEnabled();
@@ -138,7 +138,7 @@ public:
static void setSpeechInputEnabled(bool isEnabled) { isSpeechInputEnabled = isEnabled; }
static bool speechInputEnabled() { return isSpeechInputEnabled; }
- static bool webkitspeechEnabled() { return isSpeechInputEnabled; }
+ static bool webkitSpeechEnabled() { return isSpeechInputEnabled; }
#if ENABLE(XHR_RESPONSE_BLOB)
static bool xhrResponseBlobEnabled() { return isXHRResponseBlobEnabled; }
@@ -150,7 +150,6 @@ public:
#if ENABLE(FILE_SYSTEM)
static bool fileSystemEnabled();
static void setFileSystemEnabled(bool isEnabled) { isFileSystemEnabled = isEnabled; }
- static bool requestFileSystemEnabled() { return isFileSystemEnabled; }
#endif
private:
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)
diff --git a/WebCore/bindings/objc/DOM.mm b/WebCore/bindings/objc/DOM.mm
index c526123..44bd653 100644
--- a/WebCore/bindings/objc/DOM.mm
+++ b/WebCore/bindings/objc/DOM.mm
@@ -37,6 +37,7 @@
#import "Frame.h"
#import "HTMLElement.h"
#import "HTMLNames.h"
+#import "HTMLParserIdioms.h"
#import "Image.h"
#import "NodeFilter.h"
#import "RenderImage.h"
@@ -469,7 +470,7 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
ASSERT(name);
WebCore::Element* element = core(self);
ASSERT(element);
- return element->document()->completeURL(deprecatedParseURL(element->getAttribute(name)));
+ return element->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(element->getAttribute(name)));
}
- (BOOL)isFocused
diff --git a/WebCore/bindings/objc/DOMHTML.mm b/WebCore/bindings/objc/DOMHTML.mm
index 884a5b0..a2277d2 100644
--- a/WebCore/bindings/objc/DOMHTML.mm
+++ b/WebCore/bindings/objc/DOMHTML.mm
@@ -40,6 +40,7 @@
#import "HTMLCollection.h"
#import "HTMLDocument.h"
#import "HTMLInputElement.h"
+#import "HTMLParserIdioms.h"
#import "HTMLSelectElement.h"
#import "HTMLTextAreaElement.h"
#import "Page.h"
@@ -70,7 +71,7 @@
- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString
{
- NSURL *baseURL = core(self)->completeURL(WebCore::deprecatedParseURL(baseURLString));
+ NSURL *baseURL = core(self)->completeURL(WebCore::stripLeadingAndTrailingHTMLSpaces(baseURLString));
return [self createDocumentFragmentWithMarkupString:markupString baseURL:baseURL];
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 710ac3f..fe29b80 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1641,6 +1641,12 @@ sub GenerateImplementation
push(@implContent, "JSValue ${constructorFunctionName}(ExecState* exec, JSValue slotBase, const Identifier&)\n");
push(@implContent, "{\n");
push(@implContent, " ${className}* domObject = static_cast<$className*>(asObject(slotBase));\n");
+
+ if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) {
+ push(@implContent, " if (!domObject->allowsAccessFrom(exec))\n");
+ push(@implContent, " return jsUndefined();\n");
+ }
+
push(@implContent, " return ${className}::getConstructor(exec, domObject->globalObject());\n");
push(@implContent, "}\n");
}
@@ -2847,7 +2853,11 @@ sub GenerateConstructorDefinition
push(@$outputArray, "${constructorClassName}::${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)\n");
push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n");
push(@$outputArray, "{\n");
- push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n");
+ if ($interfaceName eq "DOMWindow") {
+ push(@$outputArray, " putDirect(exec->propertyNames().prototype, globalObject->prototype(), DontDelete | ReadOnly);\n");
+ } else {
+ push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n");
+ }
push(@$outputArray, " putDirect(exec->propertyNames().length, jsNumber(exec, ${numberOfconstructParameters}), ReadOnly | DontDelete | DontEnum);\n") if $numberOfconstructParameters;
push(@$outputArray, "}\n\n");
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 7e17008..96f0446 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -588,7 +588,7 @@ sub AddIncludesForType
}
if ($codeGenerator->IsSVGAnimatedType($type)) {
- $implIncludes{"SVGAnimatedTemplate.h"} = 1;
+ $implIncludes{"DeprecatedSVGAnimatedTemplate.h"} = 1;
$implIncludes{"DOM${type}Internal.h"} = 1;
return;
}
@@ -983,7 +983,7 @@ sub GenerateHeader
my $implClassName = GetImplClassName($interfaceName);
if ($codeGenerator->IsSVGAnimatedType($interfaceName)) {
- push(@internalHeaderContent, "#import <WebCore/SVGAnimatedTemplate.h>\n\n");
+ push(@internalHeaderContent, "#import <WebCore/DeprecatedSVGAnimatedTemplate.h>\n\n");
} else {
push(@internalHeaderContent, "namespace WebCore {\n");
$startedNamespace = 1;
@@ -1087,7 +1087,7 @@ sub GenerateImplementation
$implIncludes{"DOMSVGPathSegInternal.h"} = 1 if $interfaceName =~ /^SVGPathSeg.+/;
if ($codeGenerator->IsSVGAnimatedType($interfaceName)) {
- $implIncludes{"SVGAnimatedTemplate.h"} = 1;
+ $implIncludes{"DeprecatedSVGAnimatedTemplate.h"} = 1;
} elsif ($interfaceName =~ /(\w+)(Abs|Rel)$/) {
$implIncludes{"$1.h"} = 1;
} else {
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 3353f0f..91ffeaa 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -187,7 +187,7 @@ sub AddIncludesForSVGAnimatedType
$implIncludes{"PlatformString.h"} = 1;
}
- $implIncludes{"SVGAnimatedTemplate.h"} = 1;
+ $implIncludes{"DeprecatedSVGAnimatedTemplate.h"} = 1;
}
# If the node has a [Conditional=XXX] attribute, returns an "ENABLE(XXX)" string for use in an #if.
@@ -450,7 +450,7 @@ sub GetHeaderClassInclude
$className =~ s/Abs|Rel//;
}
return "" if (AvoidInclusionOfType($className));
- return "SVGAnimatedTemplate.h" if ($codeGenerator->IsSVGAnimatedType($className));
+ return "DeprecatedSVGAnimatedTemplate.h" if ($codeGenerator->IsSVGAnimatedType($className));
return "${className}.h";
}
@@ -2555,6 +2555,8 @@ sub IsActiveDomType
return 1 if $type eq "Worker";
return 1 if $type eq "SharedWorker";
return 1 if $type eq "IDBRequest";
+ return 1 if $type eq "FileReader";
+ return 1 if $type eq "FileWriter";
return 0;
}
diff --git a/WebCore/bindings/v8/DebuggerScript.js b/WebCore/bindings/v8/DebuggerScript.js
index 0222296..6026214 100644
--- a/WebCore/bindings/v8/DebuggerScript.js
+++ b/WebCore/bindings/v8/DebuggerScript.js
@@ -98,7 +98,9 @@ DebuggerScript.setBreakpoint = function(execState, args)
Debug.disableScriptBreakPoint(breakId);
var locations = Debug.findBreakPointActualLocations(breakId);
- var actualLineNumber = locations.length ? locations[0].line : args.lineNumber;
+ if (!locations.length)
+ return undefined;
+ var actualLineNumber = locations[0].line;
var key = args.scriptId + ":" + actualLineNumber;
if (key in DebuggerScript._breakpoints) {
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp
index a000a7d..4a58853 100644
--- a/WebCore/bindings/v8/IDBBindingUtilities.cpp
+++ b/WebCore/bindings/v8/IDBBindingUtilities.cpp
@@ -58,9 +58,28 @@ bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value)
return true;
}
+class LocalContext {
+public:
+ LocalContext()
+ : m_context(v8::Context::New())
+ {
+ m_context->Enter();
+ }
+
+ ~LocalContext()
+ {
+ m_context->Exit();
+ m_context.Dispose();
+ }
+
+private:
+ v8::HandleScope m_scope;
+ v8::Persistent<v8::Context> m_context;
+};
+
PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const Vector<IDBKeyPathElement>& keyPath)
{
- v8::HandleScope scope;
+ LocalContext localContext;
v8::Handle<v8::Value> v8Value(value->deserialize());
for (size_t i = 0; i < keyPath.size(); ++i) {
switch (keyPath[i].type) {
diff --git a/WebCore/bindings/v8/ScriptCallFrame.cpp b/WebCore/bindings/v8/ScriptCallFrame.cpp
index 9554f67..f0c7343 100644
--- a/WebCore/bindings/v8/ScriptCallFrame.cpp
+++ b/WebCore/bindings/v8/ScriptCallFrame.cpp
@@ -42,7 +42,7 @@ namespace WebCore {
ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber, const v8::Arguments& arguments, unsigned skipArgumentCount)
: m_functionName(functionName)
- , m_sourceURL(ParsedURLString, urlString)
+ , m_sourceURL(urlString)
, m_lineNumber(lineNumber)
{
for (int i = skipArgumentCount; i < arguments.Length(); ++i)
@@ -51,7 +51,7 @@ ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlSt
ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber)
: m_functionName(functionName)
- , m_sourceURL(ParsedURLString, urlString)
+ , m_sourceURL(urlString)
, m_lineNumber(lineNumber)
{
}
diff --git a/WebCore/bindings/v8/ScriptCallFrame.h b/WebCore/bindings/v8/ScriptCallFrame.h
index 8d1972f..ff77d4a 100644
--- a/WebCore/bindings/v8/ScriptCallFrame.h
+++ b/WebCore/bindings/v8/ScriptCallFrame.h
@@ -32,7 +32,6 @@
#define ScriptCallFrame_h
#include "KURL.h"
-#include "ScriptString.h"
#include <wtf/Vector.h>
@@ -53,8 +52,8 @@ namespace WebCore {
ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber);
~ScriptCallFrame();
- const ScriptString& functionName() const { return m_functionName; }
- const KURL& sourceURL() const { return m_sourceURL; }
+ const String& functionName() const { return m_functionName; }
+ const String& sourceURL() const { return m_sourceURL; }
unsigned lineNumber() const { return m_lineNumber; }
// argument retrieval methods
@@ -62,8 +61,8 @@ namespace WebCore {
unsigned argumentCount() const { return m_arguments.size(); }
private:
- ScriptString m_functionName;
- KURL m_sourceURL;
+ String m_functionName;
+ String m_sourceURL;
unsigned m_lineNumber;
Vector<ScriptValue> m_arguments;
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
index 7c07829..3e29c7a 100644
--- a/WebCore/bindings/v8/ScriptCallStack.cpp
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -44,7 +44,7 @@ namespace WebCore {
static void getFrameLocation(v8::Handle<v8::StackFrame> frame, String* sourceName, int* sourceLineNumber, String* functionName)
{
ASSERT(!frame.IsEmpty());
- v8::Local<v8::String> sourceNameValue(frame->GetScriptName());
+ v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
*sourceName = sourceNameValue.IsEmpty() ? "" : toWebCoreString(sourceNameValue);
*functionName = functionNameValue.IsEmpty() ? "" : toWebCoreString(functionNameValue);
@@ -85,13 +85,19 @@ static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<
}
const int ScriptCallStack::maxCallStackSizeToCapture = 200;
+const v8::StackTrace::StackTraceOptions ScriptCallStack::stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
+ v8::StackTrace::kLineNumber
+ | v8::StackTrace::kColumnOffset
+ | v8::StackTrace::kScriptNameOrSourceURL
+ | v8::StackTrace::kFunctionName);
+
PassOwnPtr<ScriptCallStack> ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount, int framCountLimit)
{
v8::HandleScope scope;
v8::Local<v8::Context> context = v8::Context::GetCurrent();
v8::Context::Scope contextScope(context);
- v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(framCountLimit));
+ v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(framCountLimit, ScriptCallStack::stackTraceOptions));
if (stackTrace.IsEmpty())
return 0;
diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h
index 215cdec..98e5195 100644
--- a/WebCore/bindings/v8/ScriptCallStack.h
+++ b/WebCore/bindings/v8/ScriptCallStack.h
@@ -48,6 +48,7 @@ class InspectorArray;
class ScriptCallStack : public Noncopyable {
public:
static const int maxCallStackSizeToCapture;
+ static const v8::StackTrace::StackTraceOptions stackTraceOptions;
static PassOwnPtr<ScriptCallStack> create(const v8::Arguments&, unsigned skipArgumentCount = 0, int framCountLimit = 1);
static PassOwnPtr<ScriptCallStack> create(ScriptState*, v8::Handle<v8::StackTrace>);
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 8018a18..913a892 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -479,9 +479,9 @@ void ScriptController::clearWindowShell(bool)
}
#if ENABLE(INSPECTOR)
-void ScriptController::setCaptureCallStackForUncaughtExceptions(bool)
+void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value)
{
- v8::V8::SetCaptureStackTraceForUncaughtExceptions(true, ScriptCallStack::maxCallStackSizeToCapture);
+ v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
}
#endif
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 8ac9064..63f1c17 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -76,7 +76,7 @@ public:
ScriptValue executeScript(const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
// Returns true if argument is a JavaScript URL.
- bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
+ bool executeIfJavaScriptURL(const KURL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
// This function must be called from the main thread. It is safe to call it repeatedly.
static void initializeThreading();
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index 3f1a0c5..7a8dbf7 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -225,10 +225,14 @@ void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOn
setPauseOnExceptionsFunction->Call(m_debuggerScript.get(), 1, argv);
}
-void ScriptDebugServer::pause()
+void ScriptDebugServer::setPauseOnNextStatement(bool pause)
{
- if (!m_pausedPage)
+ if (m_pausedPage)
+ return;
+ if (pause)
v8::Debug::DebugBreak();
+ else
+ v8::Debug::CancelDebugBreak();
}
void ScriptDebugServer::breakProgram()
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
index d1fd71f..5c5d6c6 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.h
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -70,7 +70,7 @@ public:
PauseOnExceptionsState pauseOnExceptionsState();
void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState);
- void pause();
+ void setPauseOnNextStatement(bool pause);
void breakProgram();
void continueProgram();
void stepIntoStatement();
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp
index 29dbb02..3ea536e 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/v8/ScriptFunctionCall.cpp
@@ -33,7 +33,6 @@
#include "ScriptScope.h"
#include "ScriptState.h"
-#include "ScriptString.h"
#include "ScriptValue.h"
#include "V8Binding.h"
@@ -54,12 +53,6 @@ void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument)
m_arguments.append(argument);
}
-void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8String(argument));
-}
-
void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument)
{
m_arguments.append(argument);
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h
index 04dddc8..d4f63ac 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.h
+++ b/WebCore/bindings/v8/ScriptFunctionCall.h
@@ -39,14 +39,12 @@
namespace WebCore {
class ScriptValue;
class ScriptState;
- class ScriptString;
class ScriptCallArgumentHandler {
public:
ScriptCallArgumentHandler(ScriptState* scriptState) : m_scriptState(scriptState) { }
void appendArgument(const ScriptObject&);
- void appendArgument(const ScriptString&);
void appendArgument(const ScriptValue&);
void appendArgument(const String&);
void appendArgument(const char*);
diff --git a/WebCore/bindings/v8/ScriptProfiler.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp
index ab7cfa7..02dea14 100644
--- a/WebCore/bindings/v8/ScriptProfiler.cpp
+++ b/WebCore/bindings/v8/ScriptProfiler.cpp
@@ -32,9 +32,9 @@
#include "ScriptProfiler.h"
#include "InspectorValues.h"
-#include "ScriptString.h"
#include <v8-profiler.h>
+#include <V8Binding.h>
namespace WebCore {
diff --git a/WebCore/bindings/v8/ScriptStringImpl.h b/WebCore/bindings/v8/ScriptStringImpl.h
deleted file mode 100644
index 84a25c4..0000000
--- a/WebCore/bindings/v8/ScriptStringImpl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptStringImpl_h
-#define ScriptStringImpl_h
-
-#include "OwnHandle.h"
-#include "PlatformString.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-// This class is used for strings that tend to be shared with JavaScript frequently. The JSC implementation uses wtf::UString - see bindings/js/ScriptString.h
-// Currently XMLHttpRequest uses a ScriptString to build up the responseText attribute. As data arrives from the network, it is appended to the ScriptString
-// via operator+= and a JavaScript readystatechange event is fired. JavaScript can access the responseText attribute of the XMLHttpRequest object. JavaScript
-// may also query the responseXML attribute of the XMLHttpRequest object which results in the responseText attribute being coerced into a WTF::String and
-// then parsed as an XML document.
-// This implementation optimizes for the common case where the responseText is built up with many calls to operator+= before the actual text is queried.
-class ScriptStringImpl : public RefCounted<ScriptStringImpl> {
-public:
- static PassRefPtr<ScriptStringImpl> create(const String& s)
- {
- return adoptRef(new ScriptStringImpl(s));
- }
-
- static PassRefPtr<ScriptStringImpl> create(const char* s)
- {
- return adoptRef(new ScriptStringImpl(s));
- }
-
- String toString() const;
-
- bool isNull() const;
- size_t size() const;
-
- void append(const String& s);
-
- v8::Handle<v8::String> v8StringHandle() { return m_handle.get(); }
-
-private:
- ScriptStringImpl(const String& s);
- ScriptStringImpl(const char* s);
-
- OwnHandle<v8::String> m_handle;
-};
-
-} // namespace WebCore
-
-#endif // ScriptStringImpl_h
diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp
index 4e5354e..ff92167 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.cpp
+++ b/WebCore/bindings/v8/SerializedScriptValue.cpp
@@ -1105,7 +1105,7 @@ SerializedScriptValue* SerializedScriptValue::nullValue()
PassRefPtr<SerializedScriptValue> SerializedScriptValue::release()
{
RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData));
- m_data = String();
+ m_data = String().crossThreadString();
return result.release();
}
@@ -1123,18 +1123,18 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, bool&
didThrow = true;
return;
}
- m_data = StringImpl::adopt(writer.data());
+ m_data = String(StringImpl::adopt(writer.data())).crossThreadString();
}
SerializedScriptValue::SerializedScriptValue(String data, StringDataMode mode)
{
if (mode == WireData)
- m_data = data;
+ m_data = data.crossThreadString();
else {
ASSERT(mode == StringValue);
Writer writer;
writer.writeWebCoreString(data);
- m_data = StringImpl::adopt(writer.data());
+ m_data = String(StringImpl::adopt(writer.data())).crossThreadString();
}
}
diff --git a/WebCore/bindings/v8/SerializedScriptValue.h b/WebCore/bindings/v8/SerializedScriptValue.h
index 275e5f2..b534a57 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.h
+++ b/WebCore/bindings/v8/SerializedScriptValue.h
@@ -33,11 +33,11 @@
#include "ScriptValue.h"
#include <v8.h>
-#include <wtf/RefCounted.h>
+#include <wtf/Threading.h>
namespace WebCore {
-class SerializedScriptValue : public RefCounted<SerializedScriptValue> {
+class SerializedScriptValue : public ThreadSafeShared<SerializedScriptValue> {
public:
static void deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName,
v8::PropertyAttribute, SerializedScriptValue*);
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index bea1eb8..1a39a15 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -37,7 +37,6 @@
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
-#include "InspectorTimelineAgent.h"
#include "Page.h"
#include "PageGroup.h"
#include "ScriptController.h"
@@ -342,30 +341,19 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob
// Used to avoid sleep calls in unload handlers.
if (!V8Proxy::registeredExtensionWithV8(DateExtension::get()))
- V8Proxy::registerExtension(DateExtension::get(), String());
+ V8Proxy::registerExtension(DateExtension::get());
// Dynamically tell v8 about our extensions now.
const V8Extensions& extensions = V8Proxy::extensions();
OwnArrayPtr<const char*> extensionNames(new const char*[extensions.size()]);
int index = 0;
for (size_t i = 0; i < extensions.size(); ++i) {
- if (extensions[i].group && extensions[i].group != extensionGroup)
+ // Ensure our date extension is always allowed.
+ if (extensions[i] != DateExtension::get()
+ && !m_frame->loader()->client()->allowScriptExtension(extensions[i]->name(), extensionGroup))
continue;
- if (extensions[i].useCallback) {
- // Ensure our date extension is always allowed.
- if (extensions[i].extension != DateExtension::get()
- && !m_frame->loader()->client()->allowScriptExtension(extensions[i].extension->name(), extensionGroup))
- continue;
- } else {
- // Note: we check the loader URL here instead of the document URL
- // because we might be currently loading an URL into a blank page.
- // See http://code.google.com/p/chromium/issues/detail?id=10924
- if (extensions[i].scheme.length() > 0 && (extensions[i].scheme != m_frame->loader()->activeDocumentLoader()->url().protocol()))
- continue;
- }
-
- extensionNames[index++] = extensions[i].extension->name();
+ extensionNames[index++] = extensions[i]->name();
}
v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get());
result = v8::Context::New(&extensionConfiguration, globalTemplate, global);
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index e7a8142..dd0446c 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -48,6 +48,7 @@
#include "V8EventListenerList.h"
#include "V8EventSource.h"
#include "V8FileReader.h"
+#include "V8FileWriter.h"
#include "V8HTMLCollection.h"
#include "V8HTMLDocument.h"
#include "V8IDBRequest.h"
@@ -428,6 +429,11 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
return toV8(fileReader);
#endif
+#if ENABLE(FILE_SYSTEM)
+ if (FileWriter* fileWriter = target->toFileWriter())
+ return toV8(fileWriter);
+#endif
+
ASSERT(0);
return notHandledByInterceptor();
}
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index 7f2051e..0b1d25e 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -131,7 +131,7 @@ static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, Invok
}
if (!retval)
- throwError("Error calling method on NPObject!", V8Proxy::GeneralError);
+ throwError("Error calling method on NPObject.", V8Proxy::GeneralError);
for (int i = 0; i < numArgs; i++)
_NPN_ReleaseVariantValue(&npArgs[i]);
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index be2be07..e7dca4f 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -39,7 +39,7 @@
#include "FrameLoaderClient.h"
#include "IDBFactoryBackendInterface.h"
#include "IDBPendingTransactionMonitor.h"
-#include "InspectorTimelineAgent.h"
+#include "InspectorInstrumentation.h"
#include "Page.h"
#include "PageGroup.h"
#include "PlatformBridge.h"
@@ -77,7 +77,7 @@
#include <wtf/StdLibExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/UnusedParam.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
#ifdef ANDROID_INSTRUMENT
#include "TimeCounter.h"
@@ -199,11 +199,8 @@ void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay)
// FIXME: This error message should contain more specifics of why the same
// origin check has failed.
- String str = String::format("Unsafe JavaScript attempt to access frame "
- "with URL %s from frame with URL %s. "
- "Domains, protocols and ports must match.\n",
- targetDocument->url().string().utf8().data(),
- sourceDocument->url().string().utf8().data());
+ String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(),
+ " from frame with URL ", sourceDocument->url().string(), ". Domains, protocols and ports must match.\n");
// Build a console message with fake source ID and line number.
const String kSourceID = "";
@@ -394,10 +391,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
V8GCController::checkMemoryUsage();
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
- timelineAgent->willEvaluateScript(source.url().isNull() ? String() : source.url().string(), source.startLine());
-#endif
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine());
v8::Local<v8::Value> result;
{
@@ -432,10 +426,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
PlatformBridge::traceEventEnd("v8.run", node, "");
#endif
-#if ENABLE(INSPECTOR)
- if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
- timelineAgent->didEvaluateScript();
-#endif
+ InspectorInstrumentation::didEvaluateScript(cookie);
return result;
}
@@ -536,33 +527,23 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
// execution finishs before firing the timer.
m_frame->keepAlive();
-#if ENABLE(INSPECTOR)
- Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0;
- if (inspectedPage) {
- if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) {
- v8::ScriptOrigin origin = function->GetScriptOrigin();
- String resourceName("undefined");
- int lineNumber = 1;
- if (!origin.ResourceName().IsEmpty()) {
- resourceName = toWebCoreString(origin.ResourceName());
- lineNumber = function->GetScriptLineNumber() + 1;
- }
- timelineAgent->willCallFunction(resourceName, lineNumber);
- } else
- inspectedPage = 0;
+ InspectorInstrumentationCookie cookie;
+ if (InspectorInstrumentation::hasFrontends()) {
+ v8::ScriptOrigin origin = function->GetScriptOrigin();
+ String resourceName("undefined");
+ int lineNumber = 1;
+ if (!origin.ResourceName().IsEmpty()) {
+ resourceName = toWebCoreString(origin.ResourceName());
+ lineNumber = function->GetScriptLineNumber() + 1;
+ }
+ cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
}
-#endif // !ENABLE(INSPECTOR)
m_recursion++;
result = function->Call(receiver, argc, args);
m_recursion--;
-#if ENABLE(INSPECTOR)
- if (inspectedPage)
- if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent())
- timelineAgent->didCallFunction();
-#endif // !ENABLE(INSPECTOR)
-
+ InspectorInstrumentation::didCallFunction(cookie);
}
// Release the storage mutex if applicable.
@@ -862,32 +843,17 @@ void V8Proxy::registerExtensionWithV8(v8::Extension* extension)
bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension)
{
for (size_t i = 0; i < m_extensions.size(); ++i) {
- if (m_extensions[i].extension == extension)
+ if (m_extensions[i] == extension)
return true;
}
return false;
}
-void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction)
-{
- registerExtensionWithV8(extension);
- V8ExtensionInfo info = {schemeRestriction, 0, extension, false};
- m_extensions.append(info);
-}
-
-void V8Proxy::registerExtension(v8::Extension* extension, int extensionGroup)
-{
- registerExtensionWithV8(extension);
- V8ExtensionInfo info = {String(), extensionGroup, extension, false};
- m_extensions.append(info);
-}
-
void V8Proxy::registerExtension(v8::Extension* extension)
{
registerExtensionWithV8(extension);
- V8ExtensionInfo info = {String(), 0, extension, true};
- m_extensions.append(info);
+ m_extensions.append(extension);
}
bool V8Proxy::setContextDebugId(int debugId)
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 169883b..bc5e526 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -119,18 +119,8 @@ namespace WebCore {
const int kMaxRecursionDepth = 20;
- // Information about an extension that is registered for use with V8. If
- // scheme is non-empty, it contains the URL scheme the extension should be
- // used with. If group is non-zero, the extension will only be loaded into
- // script contexts that belong to that group. Otherwise, the extension is
- // used with all schemes and contexts.
- struct V8ExtensionInfo {
- String scheme;
- int group;
- v8::Extension* extension;
- bool useCallback; // FIXME: remove
- };
- typedef WTF::Vector<V8ExtensionInfo> V8Extensions;
+ // The list of extensions that are registered for use with V8.
+ typedef WTF::Vector<v8::Extension*> V8Extensions;
class V8Proxy {
public:
@@ -328,19 +318,9 @@ namespace WebCore {
bool setContextDebugId(int id);
static int contextDebugId(v8::Handle<v8::Context>);
- // Registers a v8 extension to be available on webpages. The two forms
- // offer various restrictions on what types of contexts the extension is
- // loaded into. If a scheme is provided, only pages whose URL has the given
- // scheme will match. If extensionGroup is provided, the extension will
- // only be loaded into scripts run via evaluateInNewWorld with the
- // matching group. Will only affect v8 contexts initialized after this
- // call. Takes ownership of the v8::Extension object passed.
- static void registerExtension(v8::Extension*, const String& schemeRestriction);
- static void registerExtension(v8::Extension*, int extensionGroup);
-
- // Same as above, but new version.
- // FIXME: remove the other 2 versions in phase 3 of multipart checkin:
- // https://bugs.webkit.org/show_bug.cgi?id=45721
+ // Registers a v8 extension to be available on webpages. Will only
+ // affect v8 contexts initialized after this call. Takes ownership of
+ // the v8::Extension object passed.
static void registerExtension(v8::Extension*);
static void registerExtensionWithV8(v8::Extension*);
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
index 305fb18..99edc8b 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
@@ -78,4 +78,4 @@ v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& ar
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
index 2c89b95..4671c61 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "V8ArrayBufferView.h"
#include "V8Binding.h"
@@ -92,4 +92,4 @@ v8::Handle<v8::Value> V8ArrayBufferView::sliceCallback(const v8::Arguments& args
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index baffbd4..fc83b61 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -64,7 +64,7 @@ v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args)
Console* imp = V8Console::toNative(args.Holder());
v8::HandleScope handleScope;
ScriptState* scriptState = ScriptState::current();
- v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(ScriptCallStack::maxCallStackSizeToCapture);
+ v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(scriptState, stackTrace));
imp->trace(callStack.get());
return v8::Handle<v8::Value>();
diff --git a/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp b/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
index 8a39332..caf2e16 100644
--- a/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
@@ -34,11 +34,28 @@
#include "DOMFormData.h"
#include "V8Binding.h"
#include "V8Blob.h"
+#include "V8HTMLFormElement.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
namespace WebCore {
+v8::Handle<v8::Value> V8DOMFormData::constructorCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.FormData.Constructor");
+
+ if (!args.IsConstructCall())
+ return throwError("DOM object constructor cannot be called as a function.", V8Proxy::SyntaxError);
+
+ HTMLFormElement* form = 0;
+ if (args.Length() > 0 && V8HTMLFormElement::HasInstance(args[0]))
+ form = V8HTMLFormElement::toNative(args[0]->ToObject());
+ RefPtr<DOMFormData> domFormData = DOMFormData::create(form);
+
+ V8DOMWrapper::setDOMWrapper(args.Holder(), &info, domFormData.get());
+ return toV8(domFormData.release(), args.Holder());
+}
+
v8::Handle<v8::Value> V8DOMFormData::appendCallback(const v8::Arguments& args)
{
INC_STATS("DOM.FormData.append()");
diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
index fc8cf98..a44131a 100644
--- a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
@@ -70,8 +70,8 @@ v8::Handle<v8::Value> V8DirectoryEntry::getDirectoryCallback(const v8::Arguments
flags->setExclusive(isExclusive);
}
} else {
- EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
- flags = tmp_flags;
+ EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
+ flags = tmp_flags;
}
RefPtr<EntryCallback> successCallback;
if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
new file mode 100644
index 0000000..90b3d13
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8DirectoryEntrySync.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "DirectoryEntrySync.h"
+#include "ExceptionCode.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8EntryCallback.h"
+#include "V8ErrorCallback.h"
+#include "V8FileEntrySync.h"
+#include "V8Flags.h"
+#include "V8Proxy.h"
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+static bool extractBooleanValue(const v8::Handle<v8::Object>& object, const char* name, ExceptionCode& ec) {
+ ec = 0;
+ v8::Local<v8::Value> value = object->Get(v8::String::New(name));
+ if (!value.IsEmpty() && !isUndefinedOrNull(value)) {
+ v8::TryCatch block;
+ bool nativeValue = value->BooleanValue();
+ if (block.HasCaught()) {
+ ec = TYPE_MISMATCH_ERR;
+ return false;
+ }
+ return nativeValue;
+ }
+ return false;
+}
+
+static PassRefPtr<Flags> getFlags(const v8::Local<v8::Value>& arg, ExceptionCode& ec)
+{
+ ec = 0;
+ if (isUndefinedOrNull(arg) || !arg->IsObject())
+ return 0;
+ if (V8Flags::HasInstance(arg))
+ return V8Flags::toNative(v8::Handle<v8::Object>::Cast(arg));
+
+ v8::Handle<v8::Object> object;
+ {
+ v8::TryCatch block;
+ object = v8::Handle<v8::Object>::Cast(arg);
+ if (block.HasCaught()) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+ }
+
+ bool isCreate = extractBooleanValue(object, "create", ec);
+ if (ec)
+ return 0;
+ bool isExclusive = extractBooleanValue(object, "exclusive", ec);
+ if (ec)
+ return 0;
+
+ RefPtr<Flags> flags = Flags::create();
+ flags->setCreate(isCreate);
+ flags->setExclusive(isExclusive);
+
+ return flags;
+}
+
+v8::Handle<v8::Value> V8DirectoryEntrySync::getDirectoryCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DirectoryEntrySync.getDirectory");
+ DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
+ RefPtr<Flags> flags = getFlags(args[1], ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ RefPtr<DirectoryEntrySync> result = imp->getDirectory(path, flags, ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ return toV8(result.release());
+}
+
+v8::Handle<v8::Value> V8DirectoryEntrySync::getFileCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DirectoryEntrySync.getFile");
+ DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
+ RefPtr<Flags> flags = getFlags(args[1], ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ RefPtr<FileEntrySync> result = imp->getFile(path, flags, ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ return toV8(result.release());
+}
+
+
+
+} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index 3f6cd6a..02fc457 100644
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -32,7 +32,6 @@
#include "V8Element.h"
#include "Attr.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "Element.h"
#include "ExceptionCode.h"
diff --git a/WebCore/bindings/v8/ScriptStringImpl.cpp b/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp
index afe74b1..e98df19 100644
--- a/WebCore/bindings/v8/ScriptStringImpl.cpp
+++ b/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -29,46 +29,33 @@
*/
#include "config.h"
-#include "ScriptStringImpl.h"
+#include "EntrySync.h"
+
+#if ENABLE(FILE_SYSTEM)
+#include "V8Attr.h"
#include "V8Binding.h"
+#include "V8BindingState.h"
+#include "V8DirectoryEntrySync.h"
+#include "V8EntrySync.h"
+#include "V8FileEntrySync.h"
+#include "V8Proxy.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
-ScriptStringImpl::ScriptStringImpl(const String& s)
-{
- v8::HandleScope scope;
- m_handle.set(v8String(s));
-}
-
-ScriptStringImpl::ScriptStringImpl(const char* s)
-{
- v8::HandleScope scope;
- m_handle.set(v8::String::New(s));
-}
-
-String ScriptStringImpl::toString() const
+v8::Handle<v8::Value> toV8(EntrySync* impl)
{
- return v8StringToWebCoreString(m_handle.get());
-}
-
-bool ScriptStringImpl::isNull() const
-{
- return m_handle.get().IsEmpty();
-}
+ if (!impl)
+ return v8::Null();
-size_t ScriptStringImpl::size() const
-{
- return m_handle.get()->Length();
-}
+ if (impl->isFile())
+ return toV8(static_cast<FileEntrySync*>(impl));
-void ScriptStringImpl::append(const String& s)
-{
- v8::HandleScope scope;
- if (m_handle.get().IsEmpty())
- m_handle.set(v8String(s));
- else
- m_handle.set(v8::String::Concat(m_handle.get(), v8String(s)));
+ ASSERT(impl->isDirectory());
+ return toV8(static_cast<DirectoryEntrySync*>(impl));
}
} // namespace WebCore
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/ScriptString.h b/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp
index 414818a..5f4fb57 100644..100755
--- a/WebCore/bindings/v8/ScriptString.h
+++ b/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -28,47 +28,33 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScriptString_h
-#define ScriptString_h
+#include "config.h"
+#include "V8FileReader.h"
-#include "PlatformString.h"
-#include "ScriptStringImpl.h"
+#include "ScriptExecutionContext.h"
#include "V8Binding.h"
namespace WebCore {
-class ScriptString {
-public:
- ScriptString() : m_impl(0) {}
- ScriptString(const String& s) : m_impl(ScriptStringImpl::create(s)) {}
- ScriptString(const char* s) : m_impl(ScriptStringImpl::create(s)) {}
-
- operator String() const { return m_impl->toString(); }
-
- bool isNull() const { return !m_impl.get() || m_impl->isNull(); }
- size_t size() const { return m_impl->size(); }
+v8::Handle<v8::Value> V8FileReader::constructorCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.FileReader.Constructor");
- ScriptString& operator=(const char* s)
- {
- m_impl = ScriptStringImpl::create(s);
- return *this;
- }
+ if (!args.IsConstructCall())
+ return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
- ScriptString& operator+=(const String& s)
- {
- m_impl->append(s);
- return *this;
- }
+ // Expect no parameters.
+ // Allocate a FileReader object as its internal field.
+ ScriptExecutionContext* context = getScriptExecutionContext();
+ if (!context)
+ return throwError("FileReader constructor's associated context is not available", V8Proxy::ReferenceError);
+ RefPtr<FileReader> fileReader = FileReader::create(context);
+ V8DOMWrapper::setDOMWrapper(args.Holder(), &info, fileReader.get());
- v8::Handle<v8::Value> v8StringOrNull() const
- {
- return isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::Value>(m_impl->v8StringHandle());
- }
-
-private:
- RefPtr<ScriptStringImpl> m_impl;
-};
+ // Add object to the wrapper map.
+ fileReader->ref();
+ V8DOMWrapper::setJSWrapperForActiveDOMObject(fileReader.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+ return args.Holder();
+}
} // namespace WebCore
-
-#endif // ScriptString_h
diff --git a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
index 93c5e91..c3dbe3b 100644
--- a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Float32Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Float32Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
index 3dffeb5..fd6f1a5 100644
--- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
@@ -38,6 +38,7 @@
#include "V8IDBIndex.h"
#include "V8IDBKey.h"
#include "V8IDBObjectStore.h"
+#include "V8IDBTransaction.h"
namespace WebCore {
@@ -55,14 +56,16 @@ v8::Handle<v8::Value> toV8(IDBAny* impl)
return toV8(impl->idbCursor());
case IDBAny::IDBDatabaseType:
return toV8(impl->idbDatabase());
+ case IDBAny::IDBFactoryType:
+ return toV8(impl->idbFactory());
case IDBAny::IDBIndexType:
return toV8(impl->idbIndex());
case IDBAny::IDBKeyType:
return toV8(impl->idbKey());
case IDBAny::IDBObjectStoreType:
return toV8(impl->idbObjectStore());
- case IDBAny::IDBFactoryType:
- return toV8(impl->idbFactory());
+ case IDBAny::IDBTransactionType:
+ return toV8(impl->idbTransaction());
case IDBAny::SerializedScriptValueType:
return impl->serializedScriptValue()->deserialize();
}
diff --git a/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
index 515af24..244a231 100644
--- a/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Int16Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Int16Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
index 46087aa..a5001ed 100644
--- a/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Int32Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Int32Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
index f941111..526d83e 100644
--- a/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Int8Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Int8Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index 6068aa2..34c7e28 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#include "V8Location.h"
-#include "CSSHelper.h"
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
@@ -283,7 +282,7 @@ v8::Handle<v8::Value> V8Location::reloadCallback(const v8::Arguments& args)
return v8::Undefined();
if (!protocolIsJavaScript(frame->loader()->url()))
- frame->redirectScheduler()->scheduleRefresh(processingUserGesture());
+ frame->navigationScheduler()->scheduleRefresh();
return v8::Undefined();
}
diff --git a/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
index 5569253..e3ae263 100644
--- a/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Uint16Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Uint16Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
index c1521cf..6c60283 100644
--- a/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Uint32Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Uint32Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
index 73f995c..ea9f421 100644
--- a/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
@@ -30,7 +30,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
#include "Uint8Array.h"
@@ -68,4 +68,4 @@ v8::Handle<v8::Value> toV8(Uint8Array* impl)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index 2355d2a..393e544 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -32,7 +32,7 @@
#include "V8XMLHttpRequest.h"
#include "Frame.h"
-#include "InspectorController.h"
+#include "InspectorInstrumentation.h"
#include "V8Binding.h"
#include "V8Blob.h"
#include "V8DOMFormData.h"
@@ -51,10 +51,10 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8:
INC_STATS("DOM.XMLHttpRequest.responsetext._get");
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
ExceptionCode ec = 0;
- const ScriptString& text = xmlHttpRequest->responseText(ec);
+ const String& text = xmlHttpRequest->responseText(ec);
if (ec)
return throwError(ec);
- return text.v8StringOrNull();
+ return v8String(text);
}
v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
@@ -114,7 +114,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
INC_STATS("DOM.XMLHttpRequest.send()");
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
- InspectorController::instrumentWillSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
+ InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
ExceptionCode ec = 0;
if (args.Length() < 1)