Diff
Modified: trunk/Source/WebCore/ChangeLog (120259 => 120260)
--- trunk/Source/WebCore/ChangeLog 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/ChangeLog 2012-06-13 23:40:02 UTC (rev 120260)
@@ -1,3 +1,44 @@
+2012-06-13 Charles Wei <[email protected]>
+
+ Need customized toDOMStringList for IndexedDB JSC binding.
+ https://bugs.webkit.org/show_bug.cgi?id=87965
+
+ Reviewed by Kentaro Hara.
+
+ IndexedDB database interface uses DOMStringList as the input parameter.
+ The generated toDOMStringList() can't convert an JSArray of Strings to
+ native DOMStringList. We need a custom function to do this.
+
+ Because this patch adds one new file (JSDOMStringList.cpp), all build systems
+ are updated accordingly to pick up this file.
+
+ Tests: Corresponding bindings/scripts/test/JS files have been updated accordingly.
+
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * UseJSC.cmake:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSDOMStringListCustom.cpp: Added.
+ (WebCore):
+ (WebCore::toDOMStringList):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (IndexGetterReturnsStrings):
+ (GenerateHeader):
+ (GetNativeType):
+ (GetNativeTypeForCallbacks):
+ (JSValueToNative):
+ * bindings/scripts/test/JS/JSTestCallback.cpp:
+ (WebCore::JSTestCallback::callbackWithStringList):
+ * bindings/scripts/test/JS/JSTestCallback.h:
+ (JSTestCallback):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
+ * dom/DOMStringList.idl:
+
2012-06-13 Jeffrey Pfau <[email protected]>
Padding and borders can cause integer overflow in block layouts
Modified: trunk/Source/WebCore/GNUmakefile.list.am (120259 => 120260)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-06-13 23:40:02 UTC (rev 120260)
@@ -1360,6 +1360,7 @@
Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp \
Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp \
Source/WebCore/bindings/js/JSDOMPluginCustom.cpp \
+ Source/WebCore/bindings/js/JSDOMStringListCustom.cpp \
Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp \
Source/WebCore/bindings/js/JSDOMStringMapCustom.h \
Source/WebCore/bindings/js/JSDOMTokenListCustom.cpp \
Modified: trunk/Source/WebCore/Target.pri (120259 => 120260)
--- trunk/Source/WebCore/Target.pri 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/Target.pri 2012-06-13 23:40:02 UTC (rev 120260)
@@ -274,6 +274,7 @@
bindings/js/JSDOMMimeTypeArrayCustom.cpp \
bindings/js/JSDOMPluginArrayCustom.cpp \
bindings/js/JSDOMPluginCustom.cpp \
+ bindings/js/JSDOMStringListCustom.cpp \
bindings/js/JSDOMStringMapCustom.cpp \
bindings/js/JSDOMTokenListCustom.cpp \
bindings/js/JSDOMWindowBase.cpp \
Modified: trunk/Source/WebCore/UseJSC.cmake (120259 => 120260)
--- trunk/Source/WebCore/UseJSC.cmake 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/UseJSC.cmake 2012-06-13 23:40:02 UTC (rev 120260)
@@ -57,6 +57,7 @@
bindings/js/JSDOMMimeTypeArrayCustom.cpp
bindings/js/JSDOMPluginArrayCustom.cpp
bindings/js/JSDOMPluginCustom.cpp
+ bindings/js/JSDOMStringListCustom.cpp
bindings/js/JSDOMStringMapCustom.cpp
bindings/js/JSDOMTokenListCustom.cpp
bindings/js/JSDOMWindowBase.cpp
Modified: trunk/Source/WebCore/WebCore.gypi (120259 => 120260)
--- trunk/Source/WebCore/WebCore.gypi 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/WebCore.gypi 2012-06-13 23:40:02 UTC (rev 120260)
@@ -1922,6 +1922,7 @@
'bindings/js/JSDOMMimeTypeArrayCustom.cpp',
'bindings/js/JSDOMPluginArrayCustom.cpp',
'bindings/js/JSDOMPluginCustom.cpp',
+ 'bindings/js/JSDOMStringListCustom.cpp',
'bindings/js/JSDOMStringMapCustom.cpp',
'bindings/js/JSDOMStringMapCustom.h',
'bindings/js/JSDOMTokenListCustom.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (120259 => 120260)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-06-13 23:40:02 UTC (rev 120260)
@@ -65438,6 +65438,58 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\bindings\js\JSDOMStringListCustom.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\bindings\js\JSDOMStringMapCustom.cpp"
>
<FileConfiguration
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (120259 => 120260)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-06-13 23:40:02 UTC (rev 120260)
@@ -3636,6 +3636,7 @@
98CE4326129E00BD005821DC /* LinkLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 98CE4325129E00BD005821DC /* LinkLoader.cpp */; };
98CE432A129E00E5005821DC /* LinkLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 98CE4329129E00E5005821DC /* LinkLoader.h */; };
98EB1F951313FE0500D0E1EA /* NotImplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 98EB1F941313FE0500D0E1EA /* NotImplemented.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */; };
9B0FB191140DB5790022588F /* HTTPValidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0FB18F140DB5790022588F /* HTTPValidation.cpp */; };
9B0FB192140DB5790022588F /* HTTPValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0FB190140DB5790022588F /* HTTPValidation.h */; };
9B24DE8E15194B9500C59C27 /* HTMLBDIElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */; };
@@ -10728,6 +10729,7 @@
98CE4325129E00BD005821DC /* LinkLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkLoader.cpp; sourceTree = "<group>"; };
98CE4329129E00E5005821DC /* LinkLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkLoader.h; sourceTree = "<group>"; };
98EB1F941313FE0500D0E1EA /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; };
+ 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringListCustom.cpp; sourceTree = "<group>"; };
9B0FB18F140DB5790022588F /* HTTPValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPValidation.cpp; sourceTree = "<group>"; };
9B0FB190140DB5790022588F /* HTTPValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPValidation.h; sourceTree = "<group>"; };
9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLBDIElement.h; sourceTree = "<group>"; };
@@ -19983,6 +19985,7 @@
A9C6E64A0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp */,
A9C6E64B0D7465E7006442E9 /* JSDOMPluginCustom.cpp */,
BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */,
+ 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */,
14E0BC55136148A8002AD12E /* JSDOMTokenListCustom.cpp */,
BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
@@ -28098,6 +28101,7 @@
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
+ 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (120259 => 120260)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2012-06-13 23:40:02 UTC (rev 120260)
@@ -60,6 +60,7 @@
#include "JSDOMMimeTypeArrayCustom.cpp"
#include "JSDOMPluginArrayCustom.cpp"
#include "JSDOMPluginCustom.cpp"
+#include "JSDOMStringListCustom.cpp"
#include "JSDOMStringMapCustom.cpp"
#include "JSDOMTokenListCustom.cpp"
#include "JSDOMWindowBase.cpp"
Added: trunk/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp (0 => 120260)
--- trunk/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp 2012-06-13 23:40:02 UTC (rev 120260)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 Research In Motion Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "JSDOMStringList.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+PassRefPtr<DOMStringList> toDOMStringList(ExecState* exec, JSValue value)
+{
+ if (value.inherits(&JSDOMStringList::s_info))
+ return jsCast<JSDOMStringList*>(asObject(value))->impl();
+
+ if (!isJSArray(value))
+ return 0;
+
+ JSArray* array = asArray(value);
+ RefPtr<DOMStringList> stringList = DOMStringList::create();
+ for (unsigned i = 0; i < array->length(); ++i)
+ stringList->append(ustringToString(array->getIndex(i).toString(exec)->value(exec)));
+
+ return stringList.release();
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (120259 => 120260)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-06-13 23:40:02 UTC (rev 120260)
@@ -201,7 +201,7 @@
{
my $type = shift;
- return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "DOMStringList" or $type eq "DOMTokenList" or $type eq "DOMSettableTokenList";
+ return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "DOMStringList" or $type eq "DOMString[]" or $type eq "DOMTokenList" or $type eq "DOMSettableTokenList";
return 0;
}
@@ -1020,6 +1020,8 @@
if (!$hasParent || $dataNode->extendedAttributes->{"JSGenerateToNativeObject"}) {
if ($interfaceName eq "NodeFilter") {
push(@headerContent, "PassRefPtr<NodeFilter> toNodeFilter(JSC::JSGlobalData&, JSC::JSValue);\n");
+ } elsif ($interfaceName eq "DOMStringList") {
+ push(@headerContent, "PassRefPtr<DOMStringList> toDOMStringList(JSC::ExecState*, JSC::JSValue);\n");
} else {
push(@headerContent, "$implType* to${interfaceName}(JSC::JSValue);\n");
}
@@ -2826,7 +2828,7 @@
"CompareHow" => "Range::CompareHow",
"DOMString" => "const String&",
# FIXME: Add proper support for T[], T[]?, sequence<T>
- "DOMString[]" => "DOMStringList*",
+ "DOMString[]" => "RefPtr<DOMStringList>",
"DOMObject" => "ScriptValue",
"NodeFilter" => "RefPtr<NodeFilter>",
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
@@ -2852,6 +2854,7 @@
my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
return "${svgNativeType}*" if $svgNativeType;
+ return "RefPtr<DOMStringList>" if $type eq "DOMStringList" or $type eq "DOMString[]";
return $nativeType{$type} if exists $nativeType{$type};
my $sequenceType = $codeGenerator->GetSequenceType($type);
@@ -2865,6 +2868,7 @@
{
my $type = shift;
return "SerializedScriptValue*" if $type eq "SerializedScriptValue";
+ return "PassRefPtr<DOMStringList>" if $type eq "DOMStringList" or $type eq "DOMString[]";
return GetNativeType($type);
}
@@ -2983,9 +2987,9 @@
return "exec, $value";
}
- if ($type eq "DOMString[]") {
+ if ($type eq "DOMString[]" or $type eq "DOMStringList" ) {
AddToImplIncludes("JSDOMStringList.h", $conditional);
- return "toDOMStringList($value)";
+ return "toDOMStringList(exec, $value)";
}
if ($type eq "unsigned long[]") {
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (120259 => 120260)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2012-06-13 23:40:02 UTC (rev 120260)
@@ -112,7 +112,7 @@
return !raisedException;
}
-bool JSTestCallback::callbackWithStringList(DOMStringList* listParam)
+bool JSTestCallback::callbackWithStringList(PassRefPtr<DOMStringList> listParam)
{
if (!canInvokeCallback())
return true;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h (120259 => 120260)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h 2012-06-13 23:40:02 UTC (rev 120260)
@@ -45,7 +45,7 @@
virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg);
COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(Class3* class3Param);
virtual int customCallback(Class5* class5Param, Class6* class6Param);
- virtual bool callbackWithStringList(DOMStringList* listParam);
+ virtual bool callbackWithStringList(PassRefPtr<DOMStringList> listParam);
virtual bool callbackWithBoolean(bool boolParam);
virtual bool callbackRequiresThisToPass(Class8* class8Param, ThisClass* thisClassParam);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (120259 => 120260)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-06-13 23:40:02 UTC (rev 120260)
@@ -2117,7 +2117,7 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- DOMStringList* listArg(toDOMStringList(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ RefPtr<DOMStringList> listArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl->overloadedMethod(listArg);
@@ -2134,7 +2134,7 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- DOMStringList* arrayArg(toDOMStringList(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ RefPtr<DOMStringList> arrayArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl->overloadedMethod(arrayArg);
Modified: trunk/Source/WebCore/dom/DOMStringList.idl (120259 => 120260)
--- trunk/Source/WebCore/dom/DOMStringList.idl 2012-06-13 23:33:02 UTC (rev 120259)
+++ trunk/Source/WebCore/dom/DOMStringList.idl 2012-06-13 23:40:02 UTC (rev 120260)
@@ -26,7 +26,8 @@
module core {
interface [
- IndexedGetter
+ IndexedGetter,
+ JSCustomToNativeObject
] DOMStringList {
readonly attribute unsigned long length;
[TreatReturnedNullStringAs=Null] DOMString item(in [IsIndex,Optional=DefaultIsUndefined] unsigned long index);