Diff
Modified: trunk/Source/WebCore/ChangeLog (139640 => 139641)
--- trunk/Source/WebCore/ChangeLog 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/ChangeLog 2013-01-14 20:25:26 UTC (rev 139641)
@@ -1,3 +1,62 @@
+2013-01-14 Joshua Bell <jsb...@chromium.org>
+
+ Bindings: Remove special cases for DOMString[]
+ https://bugs.webkit.org/show_bug.cgi?id=106506
+
+ Remove special in binding code generators that map DOMString[] to DOMStringList.
+ Array (T[]) and sequence (sequence<T>) are supported enough now that to be used
+ for Internals, which is the only IDL that needed updating.
+
+ Reviewed by Adam Barth.
+
+ Tests: fast/forms/file/selected-files-from-history-state.html
+ fast/forms/state-restore-broken-state.html
+ fast/forms/state-restore-skip-stateless.html
+
+ Bindings test results updated for JS/V8.
+
+ * bindings/scripts/CodeGenerator.pm: Remove redundant IsArrayType (use GetArrayType instead)
+ (IsRefPtrType): Array and Sequence types are not RefPtr types.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (IndexGetterReturnsStrings): Remove special case for DOMString[].
+ (AddIncludesForType): Skip Array types, just like Sequence types. (Should probably recurse
+ for the base type, but not needed for now.)
+ (GenerateParametersCheckExpression): s/IsArrayType/GetArrayType/
+ (GetNativeType): Remove special case for DOMString[].
+ (GetNativeTypeForCallbacks): Ditto.
+ (JSValueToNative): Ditto.
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateParametersCheckExpression): s/IsArrayType/GetArrayType/
+ (GetNativeType): Remove special case for DOMString[].
+ (JSValueToNative): Ditto.
+ (GetV8HeaderName): Ditto.
+ (IsWrapperType):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
+ (WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
+ (WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
+ * bindings/scripts/test/JS/JSTestObj.h:
+ (WebCore):
+ * bindings/scripts/test/TestObj.idl: Added explicit new cases for DOMStringList
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjV8Internal::overloadedMethod7Callback):
+ (WebCore::TestObjV8Internal::overloadedMethod9Callback):
+ (WebCore::TestObjV8Internal::stringArrayFunctionCallback):
+ (TestObjV8Internal):
+ (WebCore::TestObjV8Internal::domStringListFunctionCallback):
+ (WebCore):
+ (WebCore::ConfigureV8TestObjTemplate):
+ * testing/Internals.cpp:
+ (WebCore::Internals::formControlStateOfPreviousHistoryItem):
+ (WebCore::Internals::setFormControlStateOfPreviousHistoryItem):
+ (WebCore::Internals::iconURLs):
+ (WebCore::Internals::getReferencedFilePaths):
+ * testing/Internals.h:
+ (Internals):
+ * testing/Internals.idl: Produce DOMString[], consume sequence<DOMString> to match tests.
+
2013-01-14 Elliott Sprehn <espr...@chromium.org>
Clean up WebVTTNodeType code
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2013-01-14 20:25:26 UTC (rev 139641)
@@ -322,14 +322,6 @@
return 0;
}
-sub IsArrayType
-{
- my $object = shift;
- my $type = shift;
- # FIXME: Add proper support for T[], T[]?, sequence<T>.
- return $type =~ m/\[\]$/;
-}
-
sub IsConstructorTemplate
{
my $object = shift;
@@ -402,6 +394,8 @@
my $type = shift;
return 0 if $object->IsPrimitiveType($type);
+ return 0 if $object->GetArrayType($type);
+ return 0 if $object->GetSequenceType($type);
return 0 if $type eq "DOMString";
return 1;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2013-01-14 20:25:26 UTC (rev 139641)
@@ -185,7 +185,7 @@
{
my $type = shift;
- 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 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "DOMStringList" or $type eq "DOMTokenList" or $type eq "DOMSettableTokenList";
return 0;
}
@@ -241,9 +241,6 @@
} elsif ($type eq "XPathNSResolver") {
$includesRef->{"JSXPathNSResolver.h"} = 1;
$includesRef->{"JSCustomXPathNSResolver.h"} = 1;
- } elsif ($type eq "DOMString[]") {
- # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
- $includesRef->{"JSDOMStringList.h"} = 1;
} elsif ($type eq "SerializedScriptValue") {
$includesRef->{"SerializedScriptValue.h"} = 1;
} elsif ($isCallback) {
@@ -251,6 +248,7 @@
} elsif ($codeGenerator->IsTypedArrayType($type)) {
$includesRef->{"<wtf/${type}.h>"} = 1;
} elsif ($codeGenerator->GetSequenceType($type)) {
+ } elsif ($codeGenerator->GetArrayType($type)) {
} else {
# default, include the same named file
$includesRef->{"${type}.h"} = 1;
@@ -1301,7 +1299,7 @@
# For Callbacks only checks if the value is null or object.
push(@andExpression, "(${value}.isNull() || ${value}.isFunction())");
$usedArguments{$parameterIndex} = 1;
- } elsif ($codeGenerator->IsArrayType($type) || $codeGenerator->GetSequenceType($type)) {
+ } elsif ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) {
# FIXME: Add proper support for T[], T[]?, sequence<T>
if ($parameter->isNullable) {
push(@andExpression, "(${value}.isNull() || (${value}.isObject() && isJSArray(${value})))");
@@ -3045,8 +3043,6 @@
my %nativeType = (
"CompareHow" => "Range::CompareHow",
"DOMString" => "const String&",
- # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
- "DOMString[]" => "RefPtr<DOMStringList>",
"DOMObject" => "ScriptValue",
"NodeFilter" => "RefPtr<NodeFilter>",
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
@@ -3072,7 +3068,7 @@
my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
return "${svgNativeType}*" if $svgNativeType;
- return "RefPtr<DOMStringList>" if $type eq "DOMStringList" or $type eq "DOMString[]";
+ return "RefPtr<DOMStringList>" if $type eq "DOMStringList";
return $nativeType{$type} if exists $nativeType{$type};
my $arrayType = $codeGenerator->GetArrayType($type);
@@ -3098,7 +3094,7 @@
{
my $type = shift;
return "SerializedScriptValue*" if $type eq "SerializedScriptValue";
- return "PassRefPtr<DOMStringList>" if $type eq "DOMStringList" or $type eq "DOMString[]";
+ return "PassRefPtr<DOMStringList>" if $type eq "DOMStringList";
return GetNativeType($type);
}
@@ -3210,7 +3206,7 @@
return "exec, $value";
}
- if ($type eq "DOMString[]" or $type eq "DOMStringList" ) {
+ if ($type eq "DOMStringList" ) {
AddToImplIncludes("JSDOMStringList.h", $conditional);
return "toDOMStringList(exec, $value)";
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2013-01-14 20:25:26 UTC (rev 139641)
@@ -1401,7 +1401,7 @@
} elsif ($parameter->extendedAttributes->{"Callback"}) {
# For Callbacks only checks if the value is null or object.
push(@andExpression, "(${value}->IsNull() || ${value}->IsFunction())");
- } elsif ($codeGenerator->IsArrayType($type) || $codeGenerator->GetSequenceType($type)) {
+ } elsif ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) {
if ($parameter->isNullable) {
push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())");
} else {
@@ -3694,9 +3694,7 @@
return "ScriptValue" if $type eq "DOMObject" or $type eq "any";
return "Dictionary" if $type eq "Dictionary";
- # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
- return "RefPtr<DOMStringList>" if $type eq "DOMString[]" or $type eq "DOMStringList";
-
+ return "RefPtr<DOMStringList>" if $type eq "DOMStringList";
return "RefPtr<IDBKey>" if $type eq "IDBKey";
return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener";
return "RefPtr<NodeFilter>" if $type eq "NodeFilter";
@@ -3766,8 +3764,6 @@
return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
return "toWebCoreDate($value)" if $type eq "Date";
return "toDOMStringList($value, $getIsolate)" if $type eq "DOMStringList";
- # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
- return "toDOMStringList($value, $getIsolate)" if $type eq "DOMString[]";
if ($type eq "DOMString") {
return $value;
@@ -3842,7 +3838,6 @@
return "EventListener.h" if $type eq "EventListener";
return "SerializedScriptValue.h" if $type eq "SerializedScriptValue";
return "ScriptValue.h" if $type eq "DOMObject" or $type eq "any";
- return "V8DOMStringList.h" if $type eq "DOMString[]";
return "V8${type}.h";
}
@@ -3935,7 +3930,6 @@
'CompareHow' => 1,
'DOMObject' => 1,
'DOMString' => 1,
- 'DOMString[]' => 1,
'DOMTimeStamp' => 1,
'Date' => 1,
'Dictionary' => 1,
@@ -3966,6 +3960,7 @@
sub IsWrapperType
{
my $type = shift;
+ # FIXME: Should this return false for Sequence and Array types?
return !($non_wrapper_types{$type});
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2013-01-14 20:25:26 UTC (rev 139641)
@@ -309,6 +309,7 @@
{ "classMethodWithClamp", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithClamp), (intptr_t)2, NoIntrinsic },
{ "methodWithUnsignedLongSequence", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence), (intptr_t)1, NoIntrinsic },
{ "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic },
+ { "domStringListFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionDomStringListFunction), (intptr_t)1, NoIntrinsic },
{ "getSVGDocument", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionGetSVGDocument), (intptr_t)0, NoIntrinsic },
{ "convert1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert1), (intptr_t)1, NoIntrinsic },
{ "convert2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert2), (intptr_t)1, NoIntrinsic },
@@ -2203,7 +2204,7 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- RefPtr<DOMStringList> arrayArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ Vector<String> arrayArg(toNativeArray<String>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl->overloadedMethod(arrayArg);
@@ -2237,7 +2238,7 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- RefPtr<DOMStringList> arrayArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ Vector<String> arrayArg(toNativeArray<String>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl->overloadedMethod(arrayArg);
@@ -2440,7 +2441,7 @@
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
- RefPtr<DOMStringList> values(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ Vector<String> values(toNativeArray<String>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
@@ -2449,6 +2450,26 @@
return JSValue::encode(result);
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionDomStringListFunction(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSTestObj::s_info))
+ return throwVMTypeError(exec);
+ JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
+ ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+ TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+ if (exec->argumentCount() < 1)
+ return throwVMError(exec, createNotEnoughArgumentsError(exec));
+ ExceptionCode ec = 0;
+ RefPtr<DOMStringList> values(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->domStringListFunction(values, ec)));
+ setDOMException(exec, ec);
+ return JSValue::encode(result);
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2013-01-14 20:25:26 UTC (rev 139641)
@@ -207,6 +207,7 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithClamp(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStringArrayFunction(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionDomStringListFunction(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert2(JSC::ExecState*);
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2013-01-14 20:25:26 UTC (rev 139641)
@@ -219,6 +219,7 @@
#endif
#if defined(TESTING_V8) || defined(TESTING_JS)
DOMString[] stringArrayFunction(in DOMString[] values) raises(DOMException);
+ DOMStringList domStringListFunction(in DOMStringList values) raises(DOMException);
#endif
[CheckSecurityForNode] readonly attribute Document contentDocument;
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (139640 => 139641)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2013-01-14 20:25:26 UTC (rev 139641)
@@ -1471,7 +1471,7 @@
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
- V8TRYCATCH(RefPtr<DOMStringList>, arrayArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
+ V8TRYCATCH(Vector<String>, arrayArg, toNativeArray<String>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
imp->overloadedMethod(arrayArg);
return v8Undefined();
}
@@ -1491,7 +1491,7 @@
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
- V8TRYCATCH(RefPtr<DOMStringList>, arrayArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
+ V8TRYCATCH(Vector<String>, arrayArg, toNativeArray<String>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
imp->overloadedMethod(arrayArg);
return v8Undefined();
}
@@ -1665,11 +1665,28 @@
TestObj* imp = V8TestObj::toNative(args.Holder());
ExceptionCode ec = 0;
{
+ V8TRYCATCH(Vector<String>, values, toNativeArray<String>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
+ Vector<String> result = imp->stringArrayFunction(values, ec);
+ if (UNLIKELY(ec))
+ goto fail;
+ return v8Array(result, args.GetIsolate());
+ }
+ fail:
+ return setDOMException(ec, args.GetIsolate());
+}
+
+static v8::Handle<v8::Value> domStringListFunctionCallback(const v8::Arguments& args)
+{
+ if (args.Length() < 1)
+ return throwNotEnoughArgumentsError(args.GetIsolate());
+ TestObj* imp = V8TestObj::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ {
V8TRYCATCH(RefPtr<DOMStringList>, values, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
- RefPtr<DOMStringList> result = imp->stringArrayFunction(values, ec);
+ RefPtr<DOMStringList> result = imp->domStringListFunction(values, ec);
if (UNLIKELY(ec))
goto fail;
- return v8Array(result.release(), args.GetIsolate());
+ return toV8(result.release(), args.Holder(), args.GetIsolate());
}
fail:
return setDOMException(ec, args.GetIsolate());
@@ -1982,7 +1999,6 @@
#endif
{"overloadedMethod", TestObjV8Internal::overloadedMethodCallback},
{"classMethodWithClamp", TestObjV8Internal::classMethodWithClampCallback},
- {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionCallback},
{"getSVGDocument", TestObjV8Internal::getSVGDocumentCallback},
{"mutablePointFunction", TestObjV8Internal::mutablePointFunctionCallback},
{"immutablePointFunction", TestObjV8Internal::immutablePointFunctionCallback},
@@ -2116,6 +2132,18 @@
if (RuntimeEnabledFeatures::featureNameEnabled())
proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod2Callback, v8Undefined(), defaultSignature));
+ // Custom Signature 'stringArrayFunction'
+ const int stringArrayFunctionArgc = 1;
+ v8::Handle<v8::FunctionTemplate> stringArrayFunctionArgv[stringArrayFunctionArgc] = { V8DOMString[]::GetRawTemplate() };
+ v8::Handle<v8::Signature> stringArrayFunctionSignature = v8::Signature::New(desc, stringArrayFunctionArgc, stringArrayFunctionArgv);
+ proto->Set(v8::String::NewSymbol("stringArrayFunction"), v8::FunctionTemplate::New(TestObjV8Internal::stringArrayFunctionCallback, v8Undefined(), stringArrayFunctionSignature));
+
+ // Custom Signature 'domStringListFunction'
+ const int domStringListFunctionArgc = 1;
+ v8::Handle<v8::FunctionTemplate> domStringListFunctionArgv[domStringListFunctionArgc] = { V8DOMStringList::GetRawTemplate() };
+ v8::Handle<v8::Signature> domStringListFunctionSignature = v8::Signature::New(desc, domStringListFunctionArgc, domStringListFunctionArgv);
+ proto->Set(v8::String::NewSymbol("domStringListFunction"), v8::FunctionTemplate::New(TestObjV8Internal::domStringListFunctionCallback, v8Undefined(), domStringListFunctionSignature));
+
// Custom Signature 'convert1'
const int convert1Argc = 1;
v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() };
Modified: trunk/Source/WebCore/testing/Internals.cpp (139640 => 139641)
--- trunk/Source/WebCore/testing/Internals.cpp 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/testing/Internals.cpp 2013-01-14 20:25:26 UTC (rev 139641)
@@ -703,37 +703,33 @@
}
#endif
-PassRefPtr<DOMStringList> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)
+Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)
{
HistoryItem* mainItem = frame()->loader()->history()->previousItem();
if (!mainItem) {
ec = INVALID_ACCESS_ERR;
- return 0;
+ return Vector<String>();
}
String uniqueName = frame()->tree()->uniqueName();
if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) {
ec = INVALID_ACCESS_ERR;
- return 0;
+ return Vector<String>();
}
- const Vector<String>& state = mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState();
- RefPtr<DOMStringList> stringList = DOMStringList::create();
- for (unsigned i = 0; i < state.size(); ++i)
- stringList->append(state[i]);
- return stringList.release();
+ return mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState();
}
-void Internals::setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList> state, ExceptionCode& ec)
+void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& state, ExceptionCode& ec)
{
HistoryItem* mainItem = frame()->loader()->history()->previousItem();
- if (!state || !mainItem) {
+ if (!mainItem) {
ec = INVALID_ACCESS_ERR;
return;
}
String uniqueName = frame()->tree()->uniqueName();
if (mainItem->target() == uniqueName)
- mainItem->setDocumentState(*state.get());
+ mainItem->setDocumentState(state);
else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
- subItem->setDocumentState(*state.get());
+ subItem->setDocumentState(state);
else
ec = INVALID_ACCESS_ERR;
}
@@ -1648,16 +1644,16 @@
return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, pageHeight));
}
-PassRefPtr<DOMStringList> Internals::iconURLs(Document* document) const
+Vector<String> Internals::iconURLs(Document* document) const
{
Vector<IconURL> iconURLs = document->iconURLs();
- RefPtr<DOMStringList> stringList = DOMStringList::create();
+ Vector<String> array;
Vector<IconURL>::const_iterator iter(iconURLs.begin());
for (; iter != iconURLs.end(); ++iter)
- stringList->append(iter->m_iconURL.string());
+ array.append(iter->m_iconURL.string());
- return stringList.release();
+ return array;
}
int Internals::numberOfPages(float pageWidth, float pageHeight)
@@ -1749,14 +1745,10 @@
return TypeConversions::create();
}
-PassRefPtr<DOMStringList> Internals::getReferencedFilePaths() const
+Vector<String> Internals::getReferencedFilePaths() const
{
- RefPtr<DOMStringList> stringList = DOMStringList::create();
frame()->loader()->history()->saveDocumentAndScrollState();
- const Vector<String>& filePaths = FormController::getReferencedFilePaths(frame()->loader()->history()->currentItem()->documentState());
- for (size_t i = 0; i < filePaths.size(); ++i)
- stringList->append(filePaths[i]);
- return stringList.release();
+ return FormController::getReferencedFilePaths(frame()->loader()->history()->currentItem()->documentState());
}
void Internals::startTrackingRepaints(Document* document, ExceptionCode& ec)
Modified: trunk/Source/WebCore/testing/Internals.h (139640 => 139641)
--- trunk/Source/WebCore/testing/Internals.h 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/testing/Internals.h 2013-01-14 20:25:26 UTC (rev 139641)
@@ -120,8 +120,8 @@
#if ENABLE(INPUT_TYPE_COLOR)
void selectColorInColorChooser(Element*, const String& colorValue);
#endif
- PassRefPtr<DOMStringList> formControlStateOfPreviousHistoryItem(ExceptionCode&);
- void setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList>, ExceptionCode&);
+ Vector<String> formControlStateOfPreviousHistoryItem(ExceptionCode&);
+ void setFormControlStateOfPreviousHistoryItem(const Vector<String>&, ExceptionCode&);
void setEnableMockPagePopup(bool, ExceptionCode&);
#if ENABLE(PAGE_POPUP)
PassRefPtr<PagePopupController> pagePopupController();
@@ -240,7 +240,7 @@
String counterValue(Element*);
int pageNumber(Element*, float pageWidth = 800, float pageHeight = 600);
- PassRefPtr<DOMStringList> iconURLs(Document*) const;
+ Vector<String> iconURLs(Document*) const;
int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
String pageProperty(String, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
@@ -261,7 +261,7 @@
PassRefPtr<MallocStatistics> mallocStatistics() const;
PassRefPtr<TypeConversions> typeConversions() const;
- PassRefPtr<DOMStringList> getReferencedFilePaths() const;
+ Vector<String> getReferencedFilePaths() const;
void startTrackingRepaints(Document*, ExceptionCode&);
void stopTrackingRepaints(Document*, ExceptionCode&);
Modified: trunk/Source/WebCore/testing/Internals.idl (139640 => 139641)
--- trunk/Source/WebCore/testing/Internals.idl 2013-01-14 20:23:02 UTC (rev 139640)
+++ trunk/Source/WebCore/testing/Internals.idl 2013-01-14 20:25:26 UTC (rev 139641)
@@ -81,7 +81,7 @@
void selectColorInColorChooser(in Element element, in DOMString colorValue);
#endif
DOMString[] formControlStateOfPreviousHistoryItem() raises(DOMException);
- void setFormControlStateOfPreviousHistoryItem(in DOMString[] values) raises(DOMException);
+ void setFormControlStateOfPreviousHistoryItem(in sequence<DOMString> values) raises(DOMException);
void setEnableMockPagePopup(in boolean enabled) raises(DOMException);
#if defined(ENABLE_PAGE_POPUP) && ENABLE_PAGE_POPUP
readonly attribute PagePopupController pagePopupController;