summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/bindings
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/ScriptControllerBase.h48
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.cpp5
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.h1
-rw-r--r--WebCore/bindings/gobject/GObjectEventListener.h1
-rw-r--r--WebCore/bindings/js/IDBBindingUtilities.cpp4
-rw-r--r--WebCore/bindings/js/IDBBindingUtilities.h6
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp6
-rw-r--r--WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp (renamed from WebCore/bindings/js/JSMimeTypeArrayCustom.cpp)12
-rw-r--r--WebCore/bindings/js/JSDOMPluginArrayCustom.cpp (renamed from WebCore/bindings/js/JSPluginArrayCustom.cpp)12
-rw-r--r--WebCore/bindings/js/JSDOMPluginCustom.cpp (renamed from WebCore/bindings/js/JSPluginCustom.cpp)12
-rw-r--r--WebCore/bindings/js/JSIDBAnyCustom.cpp7
-rw-r--r--WebCore/bindings/js/JSSharedWorkerCustom.cpp5
-rw-r--r--WebCore/bindings/js/ScriptCallStack.cpp2
-rw-r--r--WebCore/bindings/js/ScriptCallStack.h5
-rw-r--r--WebCore/bindings/js/ScriptController.h12
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp6
-rw-r--r--WebCore/bindings/js/ScriptEventListener.cpp8
-rw-r--r--WebCore/bindings/js/ScriptEventListener.h4
-rw-r--r--WebCore/bindings/scripts/CodeGenerator.pm18
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm7
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm10
-rw-r--r--WebCore/bindings/scripts/IDLParser.pm2
-rw-r--r--WebCore/bindings/scripts/InFilesParser.pm4
-rwxr-xr-xWebCore/bindings/scripts/generate-bindings.pl12
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp38
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h8
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp97
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h16
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.cpp44
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.h8
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.h8
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm30
-rw-r--r--WebCore/bindings/scripts/test/TestObj.idl7
-rw-r--r--WebCore/bindings/scripts/test/V8/V8TestObj.cpp50
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.cpp4
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.h6
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.cpp26
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.h5
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp16
-rw-r--r--WebCore/bindings/v8/ScriptController.h12
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.cpp16
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.h6
-rw-r--r--WebCore/bindings/v8/ScriptSourceCode.h8
-rw-r--r--WebCore/bindings/v8/V8AbstractEventListener.h4
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp3
-rw-r--r--WebCore/bindings/v8/V8NodeFilterCondition.h9
-rw-r--r--WebCore/bindings/v8/V8Utilities.cpp25
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp14
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodesCollection.h11
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp24
56 files changed, 544 insertions, 182 deletions
diff --git a/WebCore/bindings/ScriptControllerBase.h b/WebCore/bindings/ScriptControllerBase.h
new file mode 100644
index 0000000..ed6ca62
--- /dev/null
+++ b/WebCore/bindings/ScriptControllerBase.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 Research in Motion Limited. All rights reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 1999 Harri Porten (porten@kde.org)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptControllerBase_h
+#define ScriptControllerBase_h
+
+namespace WebCore {
+
+enum ReasonForCallingCanExecuteScripts {
+ AboutToExecuteScript,
+ NotAboutToExecuteScript
+};
+
+// Whether to call the XSSAuditor to audit a script before passing it to the JavaScript engine.
+enum ShouldAllowXSS {
+ AllowXSS,
+ DoNotAllowXSS
+};
+
+} // namespace WebCore
+
+#endif // ScriptControllerBase_h
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
index 93ce1ee..7d4e5c1 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
@@ -75,6 +75,11 @@ bool RuntimeEnabledFeatures::mediaErrorEnabled()
return MediaPlayer::isAvailable();
}
+bool RuntimeEnabledFeatures::timeRangesEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
#endif
#if ENABLE(SHARED_WORKERS)
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index 2d62a27..73bbf0f 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -63,6 +63,7 @@ public:
static bool htmlAudioElementEnabled();
static bool htmlVideoElementEnabled();
static bool mediaErrorEnabled();
+ static bool timeRangesEnabled();
#endif
#if ENABLE(SHARED_WORKERS)
diff --git a/WebCore/bindings/gobject/GObjectEventListener.h b/WebCore/bindings/gobject/GObjectEventListener.h
index c65b91e..7ca2cc7 100644
--- a/WebCore/bindings/gobject/GObjectEventListener.h
+++ b/WebCore/bindings/gobject/GObjectEventListener.h
@@ -21,6 +21,7 @@
#include "EventListener.h"
+#include "PlatformString.h"
#include <glib-object.h>
#include <glib.h>
#include <wtf/PassRefPtr.h>
diff --git a/WebCore/bindings/js/IDBBindingUtilities.cpp b/WebCore/bindings/js/IDBBindingUtilities.cpp
index faa2370..638a23e 100644
--- a/WebCore/bindings/js/IDBBindingUtilities.cpp
+++ b/WebCore/bindings/js/IDBBindingUtilities.cpp
@@ -26,10 +26,10 @@
#include "config.h"
#include "IDBBindingUtilities.h"
-#include "IDBKey.h"
-
#if ENABLE(INDEXED_DATABASE)
+#include "IDBKey.h"
+
namespace WebCore {
PassRefPtr<IDBKey> createIDBKeyFromValue(JSC::ExecState* exec, JSC::JSValue value)
diff --git a/WebCore/bindings/js/IDBBindingUtilities.h b/WebCore/bindings/js/IDBBindingUtilities.h
index 0a2fb790..f410344 100644
--- a/WebCore/bindings/js/IDBBindingUtilities.h
+++ b/WebCore/bindings/js/IDBBindingUtilities.h
@@ -26,11 +26,11 @@
#ifndef IDBBindingUtilities_h
#define IDBBindingUtilities_h
-#include "ScriptValue.h"
-#include <wtf/PassRefPtr.h>
-
#if ENABLE(INDEXED_DATABASE)
+#include "ScriptValue.h"
+#include <wtf/Forward.h>
+
namespace WebCore {
class IDBKey;
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index c9a77fb..373c0e0 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -97,7 +97,7 @@
#include "JSMessageChannelCustom.cpp"
#include "JSMessageEventCustom.cpp"
#include "JSMessagePortCustom.cpp"
-#include "JSMimeTypeArrayCustom.cpp"
+#include "JSDOMMimeTypeArrayCustom.cpp"
#include "JSNamedNodeMapCustom.cpp"
#include "JSNavigatorCustom.cpp"
#include "JSNodeCustom.cpp"
@@ -106,8 +106,8 @@
#include "JSNodeIteratorCustom.cpp"
#include "JSNodeListCustom.cpp"
#include "JSOptionConstructor.cpp"
-#include "JSPluginArrayCustom.cpp"
-#include "JSPluginCustom.cpp"
+#include "JSDOMPluginArrayCustom.cpp"
+#include "JSDOMPluginCustom.cpp"
#include "JSPluginElementFunctions.cpp"
#include "JSPopStateEventCustom.cpp"
#include "JSSQLResultSetRowListCustom.cpp"
diff --git a/WebCore/bindings/js/JSMimeTypeArrayCustom.cpp b/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp
index bdd6ddb..2d41843 100644
--- a/WebCore/bindings/js/JSMimeTypeArrayCustom.cpp
+++ b/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp
@@ -18,24 +18,24 @@
*/
#include "config.h"
-#include "JSMimeTypeArray.h"
+#include "JSDOMMimeTypeArray.h"
#include "AtomicString.h"
-#include "JSMimeType.h"
-#include "MimeTypeArray.h"
+#include "DOMMimeTypeArray.h"
+#include "JSDOMMimeType.h"
namespace WebCore {
using namespace JSC;
-bool JSMimeTypeArray::canGetItemsForName(ExecState*, MimeTypeArray* mimeTypeArray, const Identifier& propertyName)
+bool JSDOMMimeTypeArray::canGetItemsForName(ExecState*, DOMMimeTypeArray* mimeTypeArray, const Identifier& propertyName)
{
return mimeTypeArray->canGetItemsForName(identifierToAtomicString(propertyName));
}
-JSValue JSMimeTypeArray::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
+JSValue JSDOMMimeTypeArray::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
- JSMimeTypeArray* thisObj = static_cast<JSMimeTypeArray*>(asObject(slotBase));
+ JSDOMMimeTypeArray* thisObj = static_cast<JSDOMMimeTypeArray*>(asObject(slotBase));
return toJS(exec, thisObj->impl()->namedItem(identifierToAtomicString(propertyName)));
}
diff --git a/WebCore/bindings/js/JSPluginArrayCustom.cpp b/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp
index b232f4d..abf3148 100644
--- a/WebCore/bindings/js/JSPluginArrayCustom.cpp
+++ b/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp
@@ -18,24 +18,24 @@
*/
#include "config.h"
-#include "JSPluginArray.h"
+#include "JSDOMPluginArray.h"
#include "AtomicString.h"
-#include "JSPlugin.h"
-#include "PluginArray.h"
+#include "DOMPluginArray.h"
+#include "JSDOMPlugin.h"
namespace WebCore {
using namespace JSC;
-bool JSPluginArray::canGetItemsForName(ExecState*, PluginArray* pluginArray, const Identifier& propertyName)
+bool JSDOMPluginArray::canGetItemsForName(ExecState*, DOMPluginArray* pluginArray, const Identifier& propertyName)
{
return pluginArray->canGetItemsForName(identifierToAtomicString(propertyName));
}
-JSValue JSPluginArray::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
+JSValue JSDOMPluginArray::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
- JSPluginArray* thisObj = static_cast<JSPluginArray*>(asObject(slotBase));
+ JSDOMPluginArray* thisObj = static_cast<JSDOMPluginArray*>(asObject(slotBase));
return toJS(exec, thisObj->impl()->namedItem(identifierToAtomicString(propertyName)));
}
diff --git a/WebCore/bindings/js/JSPluginCustom.cpp b/WebCore/bindings/js/JSDOMPluginCustom.cpp
index 9fa0b76..c8d187e 100644
--- a/WebCore/bindings/js/JSPluginCustom.cpp
+++ b/WebCore/bindings/js/JSDOMPluginCustom.cpp
@@ -17,24 +17,24 @@
*/
#include "config.h"
-#include "JSPlugin.h"
+#include "JSDOMPlugin.h"
#include "AtomicString.h"
-#include "JSMimeType.h"
-#include "Plugin.h"
+#include "DOMPlugin.h"
+#include "JSDOMMimeType.h"
namespace WebCore {
using namespace JSC;
-bool JSPlugin::canGetItemsForName(ExecState*, Plugin* plugin, const Identifier& propertyName)
+bool JSDOMPlugin::canGetItemsForName(ExecState*, DOMPlugin* plugin, const Identifier& propertyName)
{
return plugin->canGetItemsForName(identifierToAtomicString(propertyName));
}
-JSValue JSPlugin::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
+JSValue JSDOMPlugin::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
- JSPlugin* thisObj = static_cast<JSPlugin*>(asObject(slotBase));
+ JSDOMPlugin* thisObj = static_cast<JSDOMPlugin*>(asObject(slotBase));
return toJS(exec, thisObj->impl()->namedItem(identifierToAtomicString(propertyName)));
}
diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp
index 43a79a2..b7c845e 100644
--- a/WebCore/bindings/js/JSIDBAnyCustom.cpp
+++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp
@@ -11,9 +11,6 @@
* 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
@@ -37,10 +34,12 @@
#include "IDBAny.h"
#include "IDBDatabaseRequest.h"
#include "IDBIndexRequest.h"
+#include "IDBKey.h"
#include "IDBObjectStoreRequest.h"
#include "IndexedDatabaseRequest.h"
#include "JSIDBDatabaseRequest.h"
#include "JSIDBIndexRequest.h"
+#include "JSIDBKey.h"
#include "JSIDBObjectStoreRequest.h"
#include "JSIndexedDatabaseRequest.h"
#include "SerializedScriptValue.h"
@@ -63,6 +62,8 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny)
return toJS(exec, globalObject, idbAny->idbDatabaseRequest());
case IDBAny::IDBIndexRequestType:
return toJS(exec, globalObject, idbAny->idbIndexRequest());
+ case IDBAny::IDBKeyType:
+ return toJS(exec, globalObject, idbAny->idbKey());
case IDBAny::IDBObjectStoreRequestType:
return toJS(exec, globalObject, idbAny->idbObjectStoreRequest());
case IDBAny::IndexedDatabaseRequestType:
diff --git a/WebCore/bindings/js/JSSharedWorkerCustom.cpp b/WebCore/bindings/js/JSSharedWorkerCustom.cpp
index 261ae2b..0d576e0 100644
--- a/WebCore/bindings/js/JSSharedWorkerCustom.cpp
+++ b/WebCore/bindings/js/JSSharedWorkerCustom.cpp
@@ -70,7 +70,10 @@ EncodedJSValue JSC_HOST_CALL JSSharedWorkerConstructor::constructJSSharedWorker(
DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl();
ExceptionCode ec = 0;
RefPtr<SharedWorker> worker = SharedWorker::create(ustringToString(scriptURL), ustringToString(name), window->document(), ec);
- setDOMException(exec, ec);
+ if (ec) {
+ setDOMException(exec, ec);
+ return JSValue::encode(JSValue());
+ }
return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release())));
}
diff --git a/WebCore/bindings/js/ScriptCallStack.cpp b/WebCore/bindings/js/ScriptCallStack.cpp
index 86ddcd1..c9bb8b0 100644
--- a/WebCore/bindings/js/ScriptCallStack.cpp
+++ b/WebCore/bindings/js/ScriptCallStack.cpp
@@ -100,7 +100,7 @@ void ScriptCallStack::initialize()
m_initialized = true;
}
-bool ScriptCallStack::stackTrace(int, ScriptState*, ScriptArray&)
+bool ScriptCallStack::stackTrace(int, const RefPtr<InspectorArray>&)
{
return false;
}
diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h
index 6cf7679..e461ac3 100644
--- a/WebCore/bindings/js/ScriptCallStack.h
+++ b/WebCore/bindings/js/ScriptCallStack.h
@@ -36,6 +36,7 @@
#include "ScriptState.h"
#include "ScriptString.h"
#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
namespace JSC {
class ExecState;
@@ -44,6 +45,8 @@ namespace JSC {
namespace WebCore {
+ class InspectorArray;
+
class ScriptCallStack : public Noncopyable {
public:
ScriptCallStack(JSC::ExecState*, unsigned skipArgumentCount = 0);
@@ -54,7 +57,7 @@ namespace WebCore {
// frame retrieval methods
const ScriptCallFrame &at(unsigned);
unsigned size();
- static bool stackTrace(int, ScriptState*, ScriptArray&);
+ static bool stackTrace(int, const RefPtr<InspectorArray>&);
private:
void initialize();
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 0debf39..c382a93 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -23,6 +23,7 @@
#define ScriptController_h
#include "JSDOMWindowShell.h"
+#include "ScriptControllerBase.h"
#include "ScriptInstance.h"
#include <runtime/Protect.h>
#include <wtf/RefPtr.h>
@@ -62,17 +63,6 @@ class XSSAuditor;
typedef HashMap<void*, RefPtr<JSC::Bindings::RootObject> > RootObjectMap;
-enum ReasonForCallingCanExecuteScripts {
- AboutToExecuteScript,
- NotAboutToExecuteScript
-};
-
-// Whether to call the XSSAuditor to audit a script before passing it to the JavaScript engine.
-enum ShouldAllowXSS {
- AllowXSS,
- DoNotAllowXSS
-};
-
class ScriptController {
friend class ScriptCachedFrameData;
typedef WTF::HashMap< RefPtr<DOMWrapperWorld>, JSC::ProtectedPtr<JSDOMWindowShell> > ShellMap;
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
index d1b5112..0a40f13 100644
--- a/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -568,7 +568,11 @@ void ScriptDebugServer::recompileAllJSFunctionsSoon()
void ScriptDebugServer::recompileAllJSFunctions(Timer<ScriptDebugServer>*)
{
JSLock lock(SilenceAssertionsOnly);
- Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData());
+ // If JavaScript stack is not empty postpone recompilation.
+ if (JSDOMWindow::commonJSGlobalData()->dynamicGlobalObject)
+ recompileAllJSFunctionsSoon();
+ else
+ Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData());
}
void ScriptDebugServer::didAddListener(Page* page)
diff --git a/WebCore/bindings/js/ScriptEventListener.cpp b/WebCore/bindings/js/ScriptEventListener.cpp
index 467f16b..d2baf82 100644
--- a/WebCore/bindings/js/ScriptEventListener.cpp
+++ b/WebCore/bindings/js/ScriptEventListener.cpp
@@ -105,18 +105,18 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri
return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, wrapper, mainThreadNormalWorld());
}
-String eventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener)
+String eventListenerHandlerBody(Document* document, EventListener* eventListener)
{
const JSEventListener* jsListener = JSEventListener::cast(eventListener);
if (!jsListener)
return "";
- JSC::JSObject* jsFunction = jsListener->jsFunction(context);
+ JSC::JSObject* jsFunction = jsListener->jsFunction(document);
if (!jsFunction)
return "";
- return ustringToString(jsFunction->toString(scriptState));
+ return ustringToString(jsFunction->toString(scriptStateFromNode(jsListener->isolatedWorld(), document)));
}
-bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String&, int&)
+bool eventListenerHandlerLocation(Document*, EventListener*, String&, int&)
{
// FIXME: Add support for getting function location.
return false;
diff --git a/WebCore/bindings/js/ScriptEventListener.h b/WebCore/bindings/js/ScriptEventListener.h
index f1f203c..f96f31e 100644
--- a/WebCore/bindings/js/ScriptEventListener.h
+++ b/WebCore/bindings/js/ScriptEventListener.h
@@ -45,8 +45,8 @@ namespace WebCore {
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*);
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*);
- String eventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*);
- bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String& sourceName, int& lineNumber);
+ String eventListenerHandlerBody(Document*, EventListener*);
+ bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);
} // namespace WebCore
#endif // ScriptEventListener_h
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index fbcee02..d106920 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -3,7 +3,7 @@
#
# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
# Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
-# Copyright (C) 2007 Apple Inc. All rights reserved.
+# Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
#
# This library is free software; you can redistribute it and/or
@@ -83,6 +83,7 @@ sub new
$useLayerOnTop = shift;
$preprocessor = shift;
$writeDependencies = shift;
+ $verbose = shift;
bless($reference, $object);
return $reference;
@@ -103,10 +104,10 @@ sub ProcessDocument
$defines = shift;
my $ifaceName = "CodeGenerator" . $useGenerator;
+ require $ifaceName . ".pm";
# Dynamically load external code generation perl module
- require $ifaceName . ".pm";
- $codeGenerator = $ifaceName->new($object, $useOutputDir, $useLayerOnTop, $preprocessor, $writeDependencies);
+ $codeGenerator = $ifaceName->new($object, $useOutputDir, $useLayerOnTop, $preprocessor, $writeDependencies, $verbose);
unless (defined($codeGenerator)) {
my $classes = $useDocument->classes;
foreach my $class (@$classes) {
@@ -401,8 +402,7 @@ sub ContentAttributeName
{
my ($generator, $implIncludes, $interfaceName, $attribute) = @_;
- my $contentAttributeName = $attribute->signature->extendedAttributes->{"Reflect"}
- || $attribute->signature->extendedAttributes->{"ReflectURL"};
+ my $contentAttributeName = $attribute->signature->extendedAttributes->{"Reflect"};
return undef if !$contentAttributeName;
$contentAttributeName = lc $generator->AttributeNameForGetterAndSetter($attribute) if $contentAttributeName eq "1";
@@ -424,8 +424,12 @@ sub GetterExpressionPrefix
}
my $functionName;
- if ($attribute->signature->extendedAttributes->{"ReflectURL"}) {
- $functionName = "getURLAttribute";
+ if ($attribute->signature->extendedAttributes->{"URL"}) {
+ if ($attribute->signature->extendedAttributes->{"NonEmpty"}) {
+ $functionName = "getNonEmptyURLAttribute";
+ } else {
+ $functionName = "getURLAttribute";
+ }
} elsif ($attribute->signature->type eq "boolean") {
$functionName = "hasAttribute";
} elsif ($attribute->signature->type eq "long") {
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 4c0cbe1..a0a2098 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -210,6 +210,11 @@ sub GetVisibleClassName
return "DOMException" if $className eq "DOMCoreException";
return "FormData" if $className eq "DOMFormData";
+ return "MimeType" if $className eq "DOMMimeType";
+ return "MimeTypeArray" if $className eq "DOMMimeTypeArray";
+ return "Plugin" if $className eq "DOMPlugin";
+ return "PluginArray" if $className eq "DOMPluginArray";
+
return $className;
}
@@ -2317,7 +2322,7 @@ sub JSValueToNative
return "static_cast<SVGPaint::SVGPaintType>($value.toInt32(exec))" if $type eq "SVGPaintType";
if ($type eq "DOMString") {
- return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"} || $signature->extendedAttributes->{"ReflectURL"};
+ return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"};
return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
return "ustringToString($value.toString(exec))";
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 1ae0f8f..383bb74 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -675,7 +675,8 @@ END
END
} else {
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
- if ($getterStringUsesImp && $reflect && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) {
+ my $url = $attribute->signature->extendedAttributes->{"URL"};
+ if ($getterStringUsesImp && $reflect && !$url && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) {
# Generate super-compact call for regular attribute getter:
my $contentAttributeName = $reflect eq "1" ? lc $attrName : $reflect;
my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
@@ -863,10 +864,9 @@ END
} else {
my $attrType = GetTypeFromSignature($attribute->signature);
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
- my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"};
- if (($reflect || $reflectURL) && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) {
+ if ($reflect && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) {
# Generate super-compact call for regular attribute setter:
- my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? lc $attrName : ($reflect || $reflectURL);
+ my $contentAttributeName = $reflect eq "1" ? lc $attrName : $reflect;
my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
$implIncludes{"${namespace}.h"} = 1;
push(@implContentDecls, " setElementStringAttr(info, ${namespace}::${contentAttributeName}Attr, value);\n");
@@ -2678,7 +2678,7 @@ sub GetNativeTypeFromSignature
my $mode = "";
if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) {
$mode = "WithUndefinedOrNullCheck";
- } elsif ($signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"} || $signature->extendedAttributes->{"ReflectURL"}) {
+ } elsif ($signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"}) {
$mode = "WithNullCheck";
}
$type .= "<$mode>";
diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm
index 3df96ab..e250a4d 100644
--- a/WebCore/bindings/scripts/IDLParser.pm
+++ b/WebCore/bindings/scripts/IDLParser.pm
@@ -259,7 +259,7 @@ sub ParseInterface
my @interfaceMethods = split(/;/, $interfaceData);
foreach my $line (@interfaceMethods) {
- if ($line =~ /attribute/) {
+ if ($line =~ /\Wattribute\W/) {
$line =~ /$IDLStructure::interfaceAttributeSelector/;
my $attributeType = (defined($1) ? $1 : die("Parsing error!\nSource:\n$line\n)"));
diff --git a/WebCore/bindings/scripts/InFilesParser.pm b/WebCore/bindings/scripts/InFilesParser.pm
index c6b3644..6539380 100644
--- a/WebCore/bindings/scripts/InFilesParser.pm
+++ b/WebCore/bindings/scripts/InFilesParser.pm
@@ -85,6 +85,10 @@ sub parse($)
my $perTagHandler = shift;
foreach (<$fileStream>) {
+ # Ignore whitespace, in case the .in files have the wrong EOL
+ # markers and those are getting treated as whitespace.
+ $_ = trimWS($_);
+
# Empty line, change from common parameter part
# to per tag part if we have started parsing.
if (/^$/) {
diff --git a/WebCore/bindings/scripts/generate-bindings.pl b/WebCore/bindings/scripts/generate-bindings.pl
index 44ed4d3..b293b3c 100755
--- a/WebCore/bindings/scripts/generate-bindings.pl
+++ b/WebCore/bindings/scripts/generate-bindings.pl
@@ -41,30 +41,36 @@ my @idlDirectories;
my $outputDirectory;
my $generator;
my $defines;
+my $prefix;
my $preprocessor;
my $writeDependencies;
+my $verbose;
GetOptions('include=s@' => \@idlDirectories,
'outputDir=s' => \$outputDirectory,
'generator=s' => \$generator,
'defines=s' => \$defines,
+ 'prefix=s' => \$prefix,
'preprocessor=s' => \$preprocessor,
+ 'verbose' => \$verbose,
'write-dependencies' => \$writeDependencies);
my $idlFile = $ARGV[0];
die('Must specify input file.') unless defined($idlFile);
-die('Must specify IDL search path.') unless @idlDirectories;
die('Must specify generator') unless defined($generator);
die('Must specify output directory.') unless defined($outputDirectory);
die('Must specify defines') unless defined($defines);
+if ($verbose) {
+ print "$generator: $idlFile\n";
+}
$defines =~ s/^\s+|\s+$//g; # trim whitespace
# Parse the given IDL file.
-my $parser = IDLParser->new(1);
+my $parser = IDLParser->new(!$verbose);
my $document = $parser->Parse($idlFile, $defines, $preprocessor);
# Generate desired output for given IDL file.
-my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, 0, $preprocessor, $writeDependencies);
+my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, 0, $preprocessor, $writeDependencies, $verbose);
$codeGen->ProcessDocument($document, $defines);
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
index ee8afcf..179b301 100644
--- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
@@ -240,6 +240,22 @@ void WebDOMTestObj::setReflectedURLAttr(const WebDOMString& newReflectedURLAttr)
impl()->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, newReflectedURLAttr);
}
+WebDOMString WebDOMTestObj::reflectedNonEmptyURLAttr() const
+{
+ if (!impl())
+ return WebDOMString();
+
+ return static_cast<const WebCore::String&>(impl()->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr));
+}
+
+void WebDOMTestObj::setReflectedNonEmptyURLAttr(const WebDOMString& newReflectedNonEmptyURLAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, newReflectedNonEmptyURLAttr);
+}
+
WebDOMString WebDOMTestObj::reflectedStringAttr() const
{
if (!impl())
@@ -288,7 +304,7 @@ void WebDOMTestObj::setReflectedCustomBooleanAttr(bool newReflectedCustomBoolean
impl()->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, newReflectedCustomBooleanAttr);
}
-WebDOMString WebDOMTestObj::reflectedURLAttr() const
+WebDOMString WebDOMTestObj::reflectedCustomURLAttr() const
{
if (!impl())
return WebDOMString();
@@ -296,12 +312,28 @@ WebDOMString WebDOMTestObj::reflectedURLAttr() const
return static_cast<const WebCore::String&>(impl()->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
}
-void WebDOMTestObj::setReflectedURLAttr(const WebDOMString& newReflectedURLAttr)
+void WebDOMTestObj::setReflectedCustomURLAttr(const WebDOMString& newReflectedCustomURLAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedCustomURLAttr);
+}
+
+WebDOMString WebDOMTestObj::reflectedCustomNonEmptyURLAttr() const
+{
+ if (!impl())
+ return WebDOMString();
+
+ return static_cast<const WebCore::String&>(impl()->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr));
+}
+
+void WebDOMTestObj::setReflectedCustomNonEmptyURLAttr(const WebDOMString& newReflectedCustomNonEmptyURLAttr)
{
if (!impl())
return;
- impl()->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedURLAttr);
+ impl()->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, newReflectedCustomNonEmptyURLAttr);
}
int WebDOMTestObj::attrWithGetterException() const
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
index cdd47ed..1eb5ed3 100644
--- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
@@ -63,14 +63,18 @@ public:
void setReflectedBooleanAttr(bool);
WebDOMString reflectedURLAttr() const;
void setReflectedURLAttr(const WebDOMString&);
+ WebDOMString reflectedNonEmptyURLAttr() const;
+ void setReflectedNonEmptyURLAttr(const WebDOMString&);
WebDOMString reflectedStringAttr() const;
void setReflectedStringAttr(const WebDOMString&);
int reflectedCustomIntegralAttr() const;
void setReflectedCustomIntegralAttr(int);
bool reflectedCustomBooleanAttr() const;
void setReflectedCustomBooleanAttr(bool);
- WebDOMString reflectedURLAttr() const;
- void setReflectedURLAttr(const WebDOMString&);
+ WebDOMString reflectedCustomURLAttr() const;
+ void setReflectedCustomURLAttr(const WebDOMString&);
+ WebDOMString reflectedCustomNonEmptyURLAttr() const;
+ void setReflectedCustomNonEmptyURLAttr(const WebDOMString&);
int attrWithGetterException() const;
void setAttrWithGetterException(int);
int attrWithSetterException() const;
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
index 3fcd3f7..b4b6787 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
@@ -180,6 +180,7 @@ webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerialized
void
webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key)
{
+ WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(key);
@@ -555,6 +556,27 @@ webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value
}
gchar*
+webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(self, 0);
+ WebCore::TestObj * item = WebKit::core(self);
+ gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr));
+ return res;
+}
+
+void
+webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(self);
+ WebCore::TestObj * item = WebKit::core(self);
+ g_return_if_fail(value);
+ WebCore::String converted_value = WebCore::String::fromUTF8(value);
+ item->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, converted_value);
+}
+
+gchar*
webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self)
{
WebCore::JSMainThreadNullState state;
@@ -614,7 +636,7 @@ webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gb
}
gchar*
-webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self)
+webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self)
{
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
@@ -624,7 +646,7 @@ webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self)
}
void
-webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value)
+webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, gchar* value)
{
WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
@@ -634,6 +656,27 @@ webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value
item->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, converted_value);
}
+gchar*
+webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(self, 0);
+ WebCore::TestObj * item = WebKit::core(self);
+ gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr));
+ return res;
+}
+
+void
+webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(self);
+ WebCore::TestObj * item = WebKit::core(self);
+ g_return_if_fail(value);
+ WebCore::String converted_value = WebCore::String::fromUTF8(value);
+ item->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, converted_value);
+}
+
glong
webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error)
{
@@ -893,10 +936,12 @@ enum {
PROP_REFLECTED_INTEGRAL_ATTR,
PROP_REFLECTED_BOOLEAN_ATTR,
PROP_REFLECTED_URL_ATTR,
+ PROP_REFLECTED_NON_EMPTY_URL_ATTR,
PROP_REFLECTED_STRING_ATTR,
PROP_REFLECTED_CUSTOM_INTEGRAL_ATTR,
PROP_REFLECTED_CUSTOM_BOOLEAN_ATTR,
- PROP_REFLECTED_URL_ATTR,
+ PROP_REFLECTED_CUSTOM_URL_ATTR,
+ PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR,
PROP_ATTR_WITH_GETTER_EXCEPTION,
PROP_ATTR_WITH_SETTER_EXCEPTION,
PROP_STRING_ATTR_WITH_GETTER_EXCEPTION,
@@ -975,6 +1020,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
coreSelf->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, WebCore::String::fromUTF8(g_value_get_string(value)));
break;
}
+ case PROP_REFLECTED_NON_EMPTY_URL_ATTR:
+ {
+ coreSelf->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, WebCore::String::fromUTF8(g_value_get_string(value)));
+ break;
+ }
case PROP_REFLECTED_STRING_ATTR:
{
coreSelf->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, WebCore::String::fromUTF8(g_value_get_string(value)));
@@ -990,11 +1040,16 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
coreSelf->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, (g_value_get_boolean(value)));
break;
}
- case PROP_REFLECTED_URL_ATTR:
+ case PROP_REFLECTED_CUSTOM_URL_ATTR:
{
coreSelf->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, WebCore::String::fromUTF8(g_value_get_string(value)));
break;
}
+ case PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR:
+ {
+ coreSelf->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, WebCore::String::fromUTF8(g_value_get_string(value)));
+ break;
+ }
case PROP_ATTR_WITH_GETTER_EXCEPTION:
{
WebCore::ExceptionCode ec = 0;
@@ -1120,6 +1175,11 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa
g_value_take_string(value, convertToUTF8String(coreSelf->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)));
break;
}
+ case PROP_REFLECTED_NON_EMPTY_URL_ATTR:
+ {
+ g_value_take_string(value, convertToUTF8String(coreSelf->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)));
+ break;
+ }
case PROP_REFLECTED_STRING_ATTR:
{
g_value_take_string(value, convertToUTF8String(coreSelf->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)));
@@ -1135,11 +1195,16 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa
g_value_set_boolean(value, coreSelf->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr));
break;
}
- case PROP_REFLECTED_URL_ATTR:
+ case PROP_REFLECTED_CUSTOM_URL_ATTR:
{
g_value_take_string(value, convertToUTF8String(coreSelf->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)));
break;
}
+ case PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR:
+ {
+ g_value_take_string(value, convertToUTF8String(coreSelf->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)));
+ break;
+ }
case PROP_ATTR_WITH_GETTER_EXCEPTION:
{
WebCore::ExceptionCode ec = 0;
@@ -1320,6 +1385,13 @@ G_MAXLONG, /* max */
"", /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
+ PROP_REFLECTED_NON_EMPTY_URL_ATTR,
+ g_param_spec_string("reflected-non-empty-url-attr", /* name */
+ "test_obj_reflected-non-empty-url-attr", /* short description */
+ "read-write gchar* TestObj.reflected-non-empty-url-attr", /* longer - could do with some extra doc stuff here */
+ "", /* default */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
PROP_REFLECTED_STRING_ATTR,
g_param_spec_string("reflected-string-attr", /* name */
"test_obj_reflected-string-attr", /* short description */
@@ -1343,10 +1415,17 @@ G_MAXLONG, /* max */
FALSE, /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
- PROP_REFLECTED_URL_ATTR,
- g_param_spec_string("reflected-url-attr", /* name */
- "test_obj_reflected-url-attr", /* short description */
- "read-write gchar* TestObj.reflected-url-attr", /* longer - could do with some extra doc stuff here */
+ PROP_REFLECTED_CUSTOM_URL_ATTR,
+ g_param_spec_string("reflected-custom-url-attr", /* name */
+ "test_obj_reflected-custom-url-attr", /* short description */
+ "read-write gchar* TestObj.reflected-custom-url-attr", /* longer - could do with some extra doc stuff here */
+ "", /* default */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
+ PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR,
+ g_param_spec_string("reflected-custom-non-empty-url-attr", /* name */
+ "test_obj_reflected-custom-non-empty-url-attr", /* short description */
+ "read-write gchar* TestObj.reflected-custom-non-empty-url-attr", /* longer - could do with some extra doc stuff here */
"", /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
index 61c3d95..baf278c 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
@@ -188,6 +188,12 @@ WEBKIT_API void
webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value);
WEBKIT_API gchar*
+webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self);
+
+WEBKIT_API void
+webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value);
+
+WEBKIT_API gchar*
webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self);
WEBKIT_API void
@@ -206,10 +212,16 @@ WEBKIT_API void
webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gboolean value);
WEBKIT_API gchar*
-webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self);
+webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value);
+webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, gchar* value);
+
+WEBKIT_API gchar*
+webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self);
+
+WEBKIT_API void
+webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value);
WEBKIT_API glong
webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error);
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index 31a3f70..2f561f9 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -49,7 +49,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj);
#define THUNK_GENERATOR(generator)
#endif
-static const HashTableValue JSTestObjTableValues[30] =
+static const HashTableValue JSTestObjTableValues[32] =
{
{ "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) },
@@ -63,10 +63,12 @@ static const HashTableValue JSTestObjTableValues[30] =
{ "reflectedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedIntegralAttr), (intptr_t)setJSTestObjReflectedIntegralAttr THUNK_GENERATOR(0) },
{ "reflectedBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedBooleanAttr), (intptr_t)setJSTestObjReflectedBooleanAttr THUNK_GENERATOR(0) },
{ "reflectedURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedURLAttr), (intptr_t)setJSTestObjReflectedURLAttr THUNK_GENERATOR(0) },
+ { "reflectedNonEmptyURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedNonEmptyURLAttr), (intptr_t)setJSTestObjReflectedNonEmptyURLAttr THUNK_GENERATOR(0) },
{ "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr THUNK_GENERATOR(0) },
{ "reflectedCustomIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomIntegralAttr), (intptr_t)setJSTestObjReflectedCustomIntegralAttr THUNK_GENERATOR(0) },
{ "reflectedCustomBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomBooleanAttr), (intptr_t)setJSTestObjReflectedCustomBooleanAttr THUNK_GENERATOR(0) },
- { "reflectedURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedURLAttr), (intptr_t)setJSTestObjReflectedURLAttr THUNK_GENERATOR(0) },
+ { "reflectedCustomURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomURLAttr), (intptr_t)setJSTestObjReflectedCustomURLAttr THUNK_GENERATOR(0) },
+ { "reflectedCustomNonEmptyURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomNonEmptyURLAttr), (intptr_t)setJSTestObjReflectedCustomNonEmptyURLAttr THUNK_GENERATOR(0) },
{ "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) },
{ "attrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException THUNK_GENERATOR(0) },
{ "stringAttrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithGetterException), (intptr_t)setJSTestObjStringAttrWithGetterException THUNK_GENERATOR(0) },
@@ -90,7 +92,7 @@ static const HashTableValue JSTestObjTableValues[30] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 69, 63, JSTestObjTableValues, 0 };
+static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 68, 63, JSTestObjTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
@@ -336,6 +338,15 @@ JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Ident
return result;
}
+JSValue jsTestObjReflectedNonEmptyURLAttr(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = jsString(exec, imp->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr));
+ return result;
+}
+
JSValue jsTestObjReflectedStringAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
@@ -363,7 +374,7 @@ JSValue jsTestObjReflectedCustomBooleanAttr(ExecState* exec, JSValue slotBase, c
return result;
}
-JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue jsTestObjReflectedCustomURLAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
@@ -372,6 +383,15 @@ JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Ident
return result;
}
+JSValue jsTestObjReflectedCustomNonEmptyURLAttr(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = jsString(exec, imp->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr));
+ return result;
+}
+
JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
@@ -558,6 +578,13 @@ void setJSTestObjReflectedURLAttr(ExecState* exec, JSObject* thisObject, JSValue
imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, valueToStringWithNullCheck(exec, value));
}
+void setJSTestObjReflectedNonEmptyURLAttr(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ imp->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, valueToStringWithNullCheck(exec, value));
+}
+
void setJSTestObjReflectedStringAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
@@ -579,13 +606,20 @@ void setJSTestObjReflectedCustomBooleanAttr(ExecState* exec, JSObject* thisObjec
imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean(exec));
}
-void setJSTestObjReflectedURLAttr(ExecState* exec, JSObject* thisObject, JSValue value)
+void setJSTestObjReflectedCustomURLAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, valueToStringWithNullCheck(exec, value));
}
+void setJSTestObjReflectedCustomNonEmptyURLAttr(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ imp->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, valueToStringWithNullCheck(exec, value));
+}
+
void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h
index 4dea3d2..c83e568 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.h
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h
@@ -139,14 +139,18 @@ JSC::JSValue jsTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSValue, const
void setJSTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsTestObjReflectedNonEmptyURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjReflectedNonEmptyURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjReflectedCustomIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjReflectedCustomIntegralAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjReflectedCustomBooleanAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjReflectedCustomBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
-JSC::JSValue jsTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
-void setJSTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsTestObjReflectedCustomURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjReflectedCustomURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsTestObjReflectedCustomNonEmptyURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjReflectedCustomNonEmptyURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
index d38dece..1eac990 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
@@ -56,14 +56,18 @@
- (void)setReflectedBooleanAttr:(BOOL)newReflectedBooleanAttr;
- (NSString *)reflectedURLAttr;
- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr;
+- (NSString *)reflectedNonEmptyURLAttr;
+- (void)setReflectedNonEmptyURLAttr:(NSString *)newReflectedNonEmptyURLAttr;
- (NSString *)reflectedStringAttr;
- (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr;
- (int)reflectedCustomIntegralAttr;
- (void)setReflectedCustomIntegralAttr:(int)newReflectedCustomIntegralAttr;
- (BOOL)reflectedCustomBooleanAttr;
- (void)setReflectedCustomBooleanAttr:(BOOL)newReflectedCustomBooleanAttr;
-- (NSString *)reflectedURLAttr;
-- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr;
+- (NSString *)reflectedCustomURLAttr;
+- (void)setReflectedCustomURLAttr:(NSString *)newReflectedCustomURLAttr;
+- (NSString *)reflectedCustomNonEmptyURLAttr;
+- (void)setReflectedCustomNonEmptyURLAttr:(NSString *)newReflectedCustomNonEmptyURLAttr;
- (int)attrWithGetterException;
- (void)setAttrWithGetterException:(int)newAttrWithGetterException;
- (int)attrWithSetterException;
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
index d71cb05..99c3cc6 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
@@ -202,6 +202,18 @@
IMPL->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, newReflectedURLAttr);
}
+- (NSString *)reflectedNonEmptyURLAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr);
+}
+
+- (void)setReflectedNonEmptyURLAttr:(NSString *)newReflectedNonEmptyURLAttr
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, newReflectedNonEmptyURLAttr);
+}
+
- (NSString *)reflectedStringAttr
{
WebCore::JSMainThreadNullState state;
@@ -238,16 +250,28 @@
IMPL->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, newReflectedCustomBooleanAttr);
}
-- (NSString *)reflectedURLAttr
+- (NSString *)reflectedCustomURLAttr
{
WebCore::JSMainThreadNullState state;
return IMPL->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr);
}
-- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr
+- (void)setReflectedCustomURLAttr:(NSString *)newReflectedCustomURLAttr
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedCustomURLAttr);
+}
+
+- (NSString *)reflectedCustomNonEmptyURLAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr);
+}
+
+- (void)setReflectedCustomNonEmptyURLAttr:(NSString *)newReflectedCustomNonEmptyURLAttr
{
WebCore::JSMainThreadNullState state;
- IMPL->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedURLAttr);
+ IMPL->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, newReflectedCustomNonEmptyURLAttr);
}
- (int)attrWithGetterException
diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl
index 3467116..43fc211 100644
--- a/WebCore/bindings/scripts/test/TestObj.idl
+++ b/WebCore/bindings/scripts/test/TestObj.idl
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary formstrArg, with or without
* modification, are permitted provided that the following conditions
@@ -44,11 +45,13 @@ module test {
attribute [Reflect] DOMString reflectedStringAttr;
attribute [Reflect] long reflectedIntegralAttr;
attribute [Reflect] boolean reflectedBooleanAttr;
- attribute [ReflectURL] DOMString reflectedURLAttr;
+ attribute [Reflect,URL] DOMString reflectedURLAttr;
+ attribute [Reflect,NonEmpty,URL] DOMString reflectedNonEmptyURLAttr;
attribute [Reflect=customContentStringAttr] DOMString reflectedStringAttr;
attribute [Reflect=customContentIntegralAttr] long reflectedCustomIntegralAttr;
attribute [Reflect=customContentBooleanAttr] boolean reflectedCustomBooleanAttr;
- attribute [ReflectURL=customContentURLAttr] DOMString reflectedURLAttr;
+ attribute [Reflect=customContentURLAttr,URL] DOMString reflectedCustomURLAttr;
+ attribute [Reflect=customContentNonEmptyURLAttr,NonEmpty,URL] DOMString reflectedCustomNonEmptyURLAttr;
// Methods
void voidMethod();
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index 1ad8a41..0b9d034 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -218,6 +218,22 @@ static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8:
return;
}
+static v8::Handle<v8::Value> reflectedNonEmptyURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.reflectedNonEmptyURLAttr._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8String(imp->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr));
+}
+
+static void reflectedNonEmptyURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.reflectedNonEmptyURLAttr._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ V8Parameter<WithNullCheck> v = value;
+ imp->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, v);
+ return;
+}
+
static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.reflectedStringAttr._get");
@@ -266,22 +282,38 @@ static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8:
return;
}
-static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+static v8::Handle<v8::Value> reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.TestObj.reflectedURLAttr._get");
+ INC_STATS("DOM.TestObj.reflectedCustomURLAttr._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
}
-static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.TestObj.reflectedURLAttr._set");
+ INC_STATS("DOM.TestObj.reflectedCustomURLAttr._set");
TestObj* imp = V8TestObj::toNative(info.Holder());
V8Parameter<WithNullCheck> v = value;
imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v);
return;
}
+static v8::Handle<v8::Value> reflectedCustomNonEmptyURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.reflectedCustomNonEmptyURLAttr._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8String(imp->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr));
+}
+
+static void reflectedCustomNonEmptyURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.reflectedCustomNonEmptyURLAttr._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ V8Parameter<WithNullCheck> v = value;
+ imp->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, v);
+ return;
+}
+
static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.attrWithGetterException._get");
@@ -912,16 +944,20 @@ static const BatchedAttribute TestObjAttrs[] = {
{"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
{"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'ReflectURL')
+ // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
{"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'reflectedNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
+ {"reflectedNonEmptyURLAttr", TestObjInternal::reflectedNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect')
{"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect')
{"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect')
{"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'ReflectURL')
- {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect')
+ {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'reflectedCustomNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect')
+ {"reflectedCustomNonEmptyURLAttr", TestObjInternal::reflectedCustomNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedCustomNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
{"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp
index 2f977e0..4b38a61 100644
--- a/WebCore/bindings/v8/IDBBindingUtilities.cpp
+++ b/WebCore/bindings/v8/IDBBindingUtilities.cpp
@@ -26,11 +26,11 @@
#include "config.h"
#include "IDBBindingUtilities.h"
+#if ENABLE(INDEXED_DATABASE)
+
#include "IDBKey.h"
#include "V8Binding.h"
-#if ENABLE(INDEXED_DATABASE)
-
namespace WebCore {
PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value)
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.h b/WebCore/bindings/v8/IDBBindingUtilities.h
index 04e5c29..76f2bba 100644
--- a/WebCore/bindings/v8/IDBBindingUtilities.h
+++ b/WebCore/bindings/v8/IDBBindingUtilities.h
@@ -26,11 +26,11 @@
#ifndef IDBBindingUtilities_h
#define IDBBindingUtilities_h
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
#if ENABLE(INDEXED_DATABASE)
+#include <v8.h>
+#include <wtf/Forward.h>
+
namespace WebCore {
class IDBKey;
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
index 89809b2..cdc9662 100644
--- a/WebCore/bindings/v8/ScriptCallStack.cpp
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#include "ScriptCallStack.h"
+#include "InspectorValues.h"
#include "ScriptScope.h"
#include "ScriptController.h"
#include "ScriptDebugServer.h"
@@ -93,13 +94,30 @@ const ScriptCallFrame& ScriptCallStack::at(unsigned index) const
return m_lastCaller;
}
-bool ScriptCallStack::stackTrace(int frameLimit, ScriptState* state, ScriptArray& stackTrace)
+bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace)
{
- ScriptScope scope(state);
+ if (!v8::Context::InContext())
+ return false;
+ v8::Handle<v8::Context> context = v8::Context::GetCurrent();
+ if (context.IsEmpty())
+ return false;
+ v8::HandleScope scope;
+ v8::Context::Scope contextScope(context);
v8::Handle<v8::StackTrace> trace(v8::StackTrace::CurrentStackTrace(frameLimit));
- if (trace.IsEmpty() || !trace->GetFrameCount())
+ int frameCount = trace->GetFrameCount();
+ if (trace.IsEmpty() || !frameCount)
return false;
- stackTrace = ScriptArray(state, trace->AsArray());
+ for (int i = 0; i < frameCount; ++i) {
+ v8::Handle<v8::StackFrame> frame = trace->GetFrame(i);
+ RefPtr<InspectorObject> frameObject = InspectorObject::create();
+ v8::Local<v8::String> scriptName = frame->GetScriptName();
+ frameObject->setString("scriptName", scriptName.IsEmpty() ? "" : toWebCoreString(scriptName));
+ v8::Local<v8::String> functionName = frame->GetFunctionName();
+ frameObject->setString("functionName", functionName.IsEmpty() ? "" : toWebCoreString(functionName));
+ frameObject->setNumber("lineNumber", frame->GetLineNumber());
+ frameObject->setNumber("column", frame->GetColumn());
+ stackTrace->push(frameObject);
+ }
return true;
}
diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h
index 8b02814..80d5f76 100644
--- a/WebCore/bindings/v8/ScriptCallStack.h
+++ b/WebCore/bindings/v8/ScriptCallStack.h
@@ -36,6 +36,7 @@
#include "ScriptState.h"
#include "ScriptValue.h"
#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
namespace v8 {
class Arguments;
@@ -43,6 +44,8 @@ namespace v8 {
namespace WebCore {
+class InspectorArray;
+
class ScriptCallStack : public Noncopyable {
public:
static ScriptCallStack* create(const v8::Arguments&, unsigned skipArgumentCount = 0);
@@ -57,7 +60,7 @@ public:
// lineNumber: <1 based line number>
// column: <1 based column offset on the line>
// }
- static bool stackTrace(int frameLimit, ScriptState* state, ScriptArray& stackTrace);
+ static bool stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace);
const ScriptCallFrame& at(unsigned) const;
// FIXME: implement retrieving and storing call stack trace
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 889642f..2396de0 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -290,13 +290,19 @@ void ScriptController::bindToWindowObject(Frame* frame, const String& key, NPObj
void ScriptController::collectGarbage()
{
v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_proxy->frame());
+
+ v8::Persistent<v8::Context> v8Context = v8::Context::New();
if (v8Context.IsEmpty())
return;
-
- v8::Context::Scope scope(v8Context);
-
- m_proxy->evaluate(ScriptSourceCode("if (window.gc) void(gc());"), 0);
+ {
+ v8::Context::Scope scope(v8Context);
+ v8::Local<v8::String> source = v8::String::New("if (gc) gc();");
+ v8::Local<v8::String> name = v8::String::New("gc");
+ v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
+ if (!script.IsEmpty())
+ script->Run();
+ }
+ v8Context.Dispose();
}
void ScriptController::lowMemoryNotification()
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 3187180..75ae0bf 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -31,6 +31,7 @@
#ifndef ScriptController_h
#define ScriptController_h
+#include "ScriptControllerBase.h"
#include "ScriptInstance.h"
#include "ScriptValue.h"
@@ -55,17 +56,6 @@ class String;
class Widget;
class XSSAuditor;
-enum ReasonForCallingCanExecuteScripts {
- AboutToExecuteScript,
- NotAboutToExecuteScript
-};
-
-// Whether to call the XSSAuditor to audit a script before passing it to the JavaScript engine.
-enum ShouldAllowXSS {
- AllowXSS,
- DoNotAllowXSS
-};
-
class ScriptController {
public:
ScriptController(Frame*);
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index 8553ee5..138237b 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -356,6 +356,10 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
if (!stackTrace->GetFrameCount())
return;
}
+
+ // Don't allow nested breaks.
+ if (m_pausedPage)
+ return;
m_executionState.set(eventDetails.GetExecutionState());
m_pausedPage = frame->page();
ScriptState* currentCallFrameState = mainWorldScriptState(frame);
diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp
index 63e7dff..72df79d 100644
--- a/WebCore/bindings/v8/ScriptEventListener.cpp
+++ b/WebCore/bindings/v8/ScriptEventListener.cpp
@@ -100,28 +100,32 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri
return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld));
}
-String eventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener)
+String eventListenerHandlerBody(Document* document, EventListener* listener)
{
if (listener->type() != EventListener::JSEventListenerType)
return "";
- ScriptScope scope(scriptState);
+ v8::HandleScope scope;
V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
- v8::Handle<v8::Object> function = v8Listener->getListenerObject(context);
+ v8::Handle<v8::Context> context = toV8Context(document, v8Listener->worldContext());
+ v8::Context::Scope contextScope(context);
+ v8::Handle<v8::Object> function = v8Listener->getListenerObject(document);
if (function.IsEmpty())
return "";
return toWebCoreStringWithNullCheck(function);
}
-bool eventListenerHandlerLocation(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener, String& sourceName, int& lineNumber)
+bool eventListenerHandlerLocation(Document* document, EventListener* listener, String& sourceName, int& lineNumber)
{
if (listener->type() != EventListener::JSEventListenerType)
return false;
- ScriptScope scope(scriptState);
+ v8::HandleScope scope;
V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
- v8::Handle<v8::Object> object = v8Listener->getListenerObject(context);
+ v8::Handle<v8::Context> context = toV8Context(document, v8Listener->worldContext());
+ v8::Context::Scope contextScope(context);
+ v8::Handle<v8::Object> object = v8Listener->getListenerObject(document);
if (object.IsEmpty() || !object->IsFunction())
return false;
diff --git a/WebCore/bindings/v8/ScriptEventListener.h b/WebCore/bindings/v8/ScriptEventListener.h
index 7815e29..0fce088 100644
--- a/WebCore/bindings/v8/ScriptEventListener.h
+++ b/WebCore/bindings/v8/ScriptEventListener.h
@@ -38,15 +38,15 @@
namespace WebCore {
class Attribute;
+ class Document;
class EventListener;
class Frame;
class Node;
- class ScriptState;
PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*);
PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*);
- String eventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*);
- bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String& sourceName, int& lineNumber);
+ String eventListenerHandlerBody(Document*, EventListener*);
+ bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptSourceCode.h b/WebCore/bindings/v8/ScriptSourceCode.h
index dbc9d5e..485daea 100644
--- a/WebCore/bindings/v8/ScriptSourceCode.h
+++ b/WebCore/bindings/v8/ScriptSourceCode.h
@@ -46,6 +46,14 @@ public:
, m_url(url)
, m_startLine(startLine)
{
+ // FIXME: Copying the source to strip BOMs isn't strictly necessary
+ // because V8 treats BOMs as whitespace. However, it is here because it
+ // must be in sync with CachedScript::script() which strips the BOMs. We
+ // should investigate the performance implications.
+ if (m_source.length()) {
+ bool scratch = false;
+ m_source = String(source.impl()->copyStringWithoutBOMs(false, scratch));
+ }
}
// We lose the encoding information from CachedScript.
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.h b/WebCore/bindings/v8/V8AbstractEventListener.h
index 0afbed5..4b36ffb 100644
--- a/WebCore/bindings/v8/V8AbstractEventListener.h
+++ b/WebCore/bindings/v8/V8AbstractEventListener.h
@@ -96,6 +96,8 @@ namespace WebCore {
// Dispose listener object and clear the handle.
void disposeListenerObject();
+ const WorldContextHandle& worldContext() const { return m_worldContext; }
+
protected:
V8AbstractEventListener(bool isAttribute, const WorldContextHandle& worldContext);
@@ -108,8 +110,6 @@ namespace WebCore {
// Get the receiver object to use for event listener call.
v8::Local<v8::Object> getReceiverObject(Event*);
- const WorldContextHandle& worldContext() const { return m_worldContext; }
-
private:
// Implementation of EventListener function.
virtual bool virtualisAttribute() const { return m_isAttribute; }
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 596090d..b5703d2 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -224,8 +224,7 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value>
if (!filter->IsFunction())
return 0;
- NodeFilterCondition* condition = new V8NodeFilterCondition(filter);
- return NodeFilter::create(condition);
+ return NodeFilter::create(V8NodeFilterCondition::create(filter));
}
static bool globalObjectPrototypeIsDOMWindow(v8::Handle<v8::Object> objectPrototype)
diff --git a/WebCore/bindings/v8/V8NodeFilterCondition.h b/WebCore/bindings/v8/V8NodeFilterCondition.h
index 5850b69..b864e5e 100644
--- a/WebCore/bindings/v8/V8NodeFilterCondition.h
+++ b/WebCore/bindings/v8/V8NodeFilterCondition.h
@@ -33,6 +33,7 @@
#include "NodeFilterCondition.h"
#include <v8.h>
+#include <wtf/PassRefPtr.h>
// NodeFilter is a JavaScript function that takes a Node as parameter and returns a short (ACCEPT, SKIP, REJECT) as the result.
namespace WebCore {
@@ -43,12 +44,18 @@ namespace WebCore {
// NodeFilterCondition is a wrapper around a NodeFilter JS function.
class V8NodeFilterCondition : public NodeFilterCondition {
public:
- explicit V8NodeFilterCondition(v8::Handle<v8::Value> filter);
+ static PassRefPtr<V8NodeFilterCondition> create(v8::Handle<v8::Value> filter)
+ {
+ return adoptRef(new V8NodeFilterCondition(filter));
+ }
+
virtual ~V8NodeFilterCondition();
virtual short acceptNode(ScriptState*, Node*) const;
private:
+ explicit V8NodeFilterCondition(v8::Handle<v8::Value> filter);
+
mutable v8::Persistent<v8::Value> m_filter;
};
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index ffccb06..f780218 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -100,10 +100,24 @@ bool processingUserGesture()
return frame && frame->script()->processingUserGesture();
}
+Frame* callingOrEnteredFrame()
+{
+ Frame* frame = V8Proxy::retrieveFrameForCallingContext();
+ if (!frame) {
+ // Unfortunately, when processing script from a plug-in, we might not
+ // have a calling context. In those cases, we fall back to the
+ // entered context for security checks.
+ // FIXME: We need a better API for retrieving frames that abstracts
+ // away this concern.
+ frame = V8Proxy::retrieveFrameForEnteredContext();
+ }
+ return frame;
+}
+
bool shouldAllowNavigation(Frame* frame)
{
- Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
- return callingFrame && callingFrame->loader()->shouldAllowNavigation(frame);
+ Frame* callingOrEntered = callingOrEnteredFrame();
+ return callingOrEntered && callingOrEntered->loader()->shouldAllowNavigation(frame);
}
KURL completeURL(const String& relativeURL)
@@ -117,12 +131,11 @@ KURL completeURL(const String& relativeURL)
void navigateIfAllowed(Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
{
- Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
- if (!callingFrame)
+ Frame* callingOrEntered = callingOrEnteredFrame();
+ if (!callingOrEntered)
return;
-
if (!protocolIsJavaScript(url) || ScriptController::isSafeScript(frame))
- frame->redirectScheduler()->scheduleLocationChange(url.string(), callingFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
+ frame->redirectScheduler()->scheduleLocationChange(url.string(), callingOrEntered->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
}
ScriptExecutionContext* getScriptExecutionContext()
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index 58a85dc..ef428a9 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -52,8 +52,7 @@ static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, Atomic
if (namedItems.size() == 1)
return toV8(namedItems.at(0).release());
- NodeList* list = new V8NamedNodesCollection(namedItems);
- return toV8(list);
+ return toV8(V8NamedNodesCollection::create(namedItems));
}
static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument)
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index a4a0c57..9e89ce8 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -52,8 +52,7 @@ static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicStr
if (namedItems.size() == 1)
return toV8(namedItems.at(0).release());
- NodeList* list = new V8NamedNodesCollection(namedItems);
- return toV8(list);
+ return toV8(V8NamedNodesCollection::create(namedItems));
}
static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument)
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index e6f1b8f..09f0a6f 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -51,20 +51,20 @@ namespace WebCore {
v8::Local<v8::Object> V8HTMLDocument::WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl)
{
- DEFINE_STATIC_LOCAL(v8::Persistent<v8::Function>, shadowConstructor, ());
- if (shadowConstructor.IsEmpty()) {
- v8::Local<v8::FunctionTemplate> shadowTemplate = v8::FunctionTemplate::New();
+ DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, shadowTemplate, ());
+ if (shadowTemplate.IsEmpty()) {
+ shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
if (shadowTemplate.IsEmpty())
return v8::Local<v8::Object>();
shadowTemplate->SetClassName(v8::String::New("HTMLDocument"));
shadowTemplate->Inherit(V8HTMLDocument::GetTemplate());
shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount);
- shadowConstructor = v8::Persistent<v8::Function>::New(shadowTemplate->GetFunction());
- if (shadowConstructor.IsEmpty())
- return v8::Local<v8::Object>();
}
- ASSERT(!shadowConstructor.IsEmpty());
+ v8::Local<v8::Function> shadowConstructor = shadowTemplate->GetFunction();
+ if (shadowConstructor.IsEmpty())
+ return v8::Local<v8::Object>();
+
v8::Local<v8::Object> shadow = shadowConstructor->NewInstance();
if (shadow.IsEmpty())
return v8::Local<v8::Object>();
diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
index 786a96a..9baf78a 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
@@ -77,8 +77,7 @@ v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::Strin
if (elements.size() == 1)
return toV8(elements.at(0).release());
- NodeList* collection = new V8NamedNodesCollection(elements);
- return toV8(collection);
+ return toV8(V8NamedNodesCollection::create(elements));
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
index d0d8dac..13a9d30 100644
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
@@ -70,8 +70,7 @@ v8::Handle<v8::Value> V8HTMLSelectElement::namedPropertyGetter(v8::Local<v8::Str
if (items.size() == 1)
return toV8(items.at(0).release());
- NodeList* list = new V8NamedNodesCollection(items);
- return toV8(list);
+ return toV8(V8NamedNodesCollection::create(items));
}
v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
index 5ef50a6..def1120 100644
--- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
@@ -11,9 +11,6 @@
* 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
@@ -37,6 +34,7 @@
#include "SerializedScriptValue.h"
#include "V8IDBDatabaseRequest.h"
#include "V8IDBIndexRequest.h"
+#include "V8IDBKey.h"
#include "V8IDBObjectStoreRequest.h"
#include "V8IndexedDatabaseRequest.h"
@@ -56,6 +54,8 @@ v8::Handle<v8::Value> toV8(IDBAny* impl)
return toV8(impl->idbDatabaseRequest());
case IDBAny::IDBIndexRequestType:
return toV8(impl->idbIndexRequest());
+ case IDBAny::IDBKeyType:
+ return toV8(impl->idbKey());
case IDBAny::IDBObjectStoreRequestType:
return toV8(impl->idbObjectStoreRequest());
case IDBAny::IndexedDatabaseRequestType:
diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.h b/WebCore/bindings/v8/custom/V8NamedNodesCollection.h
index d13b7a8..0372de1 100644
--- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.h
+++ b/WebCore/bindings/v8/custom/V8NamedNodesCollection.h
@@ -33,6 +33,7 @@
#include "Node.h"
#include "NodeList.h"
+#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -40,13 +41,19 @@ namespace WebCore {
class V8NamedNodesCollection : public NodeList {
public:
- explicit V8NamedNodesCollection(const Vector<RefPtr<Node> >& nodes)
- : m_nodes(nodes) { }
+ static PassRefPtr<NodeList> create(const Vector<RefPtr<Node> >& nodes)
+ {
+ return adoptRef(new V8NamedNodesCollection(nodes));
+ }
+
virtual unsigned length() const { return m_nodes.size(); }
virtual Node* item(unsigned) const;
virtual Node* itemWithName(const AtomicString&) const;
private:
+ explicit V8NamedNodesCollection(const Vector<RefPtr<Node> >& nodes)
+ : m_nodes(nodes) { }
+
Vector<RefPtr<Node> > m_nodes;
};
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index e1a9c0e..fd6e120 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -477,12 +477,12 @@ static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments&
return v8::Undefined();
}
- v8::Handle<v8::Array> array =
- v8::Local<v8::Array>::Cast(args[1]);
- if (array.IsEmpty()) {
- V8Proxy::setDOMException(SYNTAX_ERR);
+ if (args[1].IsEmpty() || !args[1]->IsArray()) {
+ V8Proxy::throwTypeError();
return notHandledByInterceptor();
}
+ v8::Handle<v8::Array> array =
+ v8::Local<v8::Array>::Cast(args[1]);
uint32_t len = array->Length();
float* data = jsArrayToFloatArray(array, len);
if (!data) {
@@ -545,12 +545,12 @@ static v8::Handle<v8::Value> uniformHelperi(const v8::Arguments& args,
return v8::Undefined();
}
- v8::Handle<v8::Array> array =
- v8::Local<v8::Array>::Cast(args[1]);
- if (array.IsEmpty()) {
- V8Proxy::setDOMException(SYNTAX_ERR);
+ if (args[1].IsEmpty() || !args[1]->IsArray()) {
+ V8Proxy::throwTypeError();
return notHandledByInterceptor();
}
+ v8::Handle<v8::Array> array =
+ v8::Local<v8::Array>::Cast(args[1]);
uint32_t len = array->Length();
int* data = jsArrayToIntArray(array, len);
if (!data) {
@@ -658,12 +658,12 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
return v8::Undefined();
}
- v8::Handle<v8::Array> array =
- v8::Local<v8::Array>::Cast(args[2]);
- if (array.IsEmpty()) {
- V8Proxy::setDOMException(SYNTAX_ERR);
+ if (args[2].IsEmpty() || !args[2]->IsArray()) {
+ V8Proxy::throwTypeError();
return notHandledByInterceptor();
}
+ v8::Handle<v8::Array> array =
+ v8::Local<v8::Array>::Cast(args[2]);
uint32_t len = array->Length();
float* data = jsArrayToFloatArray(array, len);
if (!data) {