Changeset 139641 in webkit


Ignore:
Timestamp:
Jan 14, 2013 12:25:26 PM (11 years ago)
Author:
jsbell@chromium.org
Message:

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.
Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r139639 r139641  
     12013-01-14  Joshua Bell  <jsbell@chromium.org>
     2
     3        Bindings: Remove special cases for DOMString[]
     4        https://bugs.webkit.org/show_bug.cgi?id=106506
     5
     6        Remove special in binding code generators that map DOMString[] to DOMStringList.
     7        Array (T[]) and sequence (sequence<T>) are supported enough now that to be used
     8        for Internals, which is the only IDL that needed updating.
     9
     10        Reviewed by Adam Barth.
     11
     12        Tests: fast/forms/file/selected-files-from-history-state.html
     13               fast/forms/state-restore-broken-state.html
     14               fast/forms/state-restore-skip-stateless.html
     15
     16        Bindings test results updated for JS/V8.
     17
     18        * bindings/scripts/CodeGenerator.pm: Remove redundant IsArrayType (use GetArrayType instead)
     19        (IsRefPtrType): Array and Sequence types are not RefPtr types.
     20        * bindings/scripts/CodeGeneratorJS.pm:
     21        (IndexGetterReturnsStrings): Remove special case for DOMString[].
     22        (AddIncludesForType): Skip Array types, just like Sequence types. (Should probably recurse
     23        for the base type, but not needed for now.)
     24        (GenerateParametersCheckExpression): s/IsArrayType/GetArrayType/
     25        (GetNativeType): Remove special case for DOMString[].
     26        (GetNativeTypeForCallbacks): Ditto.
     27        (JSValueToNative): Ditto.
     28        * bindings/scripts/CodeGeneratorV8.pm:
     29        (GenerateParametersCheckExpression): s/IsArrayType/GetArrayType/
     30        (GetNativeType): Remove special case for DOMString[].
     31        (JSValueToNative): Ditto.
     32        (GetV8HeaderName): Ditto.
     33        (IsWrapperType):
     34        * bindings/scripts/test/JS/JSTestObj.cpp:
     35        (WebCore):
     36        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
     37        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
     38        (WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
     39        (WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
     40        * bindings/scripts/test/JS/JSTestObj.h:
     41        (WebCore):
     42        * bindings/scripts/test/TestObj.idl: Added explicit new cases for DOMStringList
     43        * bindings/scripts/test/V8/V8TestObj.cpp:
     44        (WebCore::TestObjV8Internal::overloadedMethod7Callback):
     45        (WebCore::TestObjV8Internal::overloadedMethod9Callback):
     46        (WebCore::TestObjV8Internal::stringArrayFunctionCallback):
     47        (TestObjV8Internal):
     48        (WebCore::TestObjV8Internal::domStringListFunctionCallback):
     49        (WebCore):
     50        (WebCore::ConfigureV8TestObjTemplate):
     51        * testing/Internals.cpp:
     52        (WebCore::Internals::formControlStateOfPreviousHistoryItem):
     53        (WebCore::Internals::setFormControlStateOfPreviousHistoryItem):
     54        (WebCore::Internals::iconURLs):
     55        (WebCore::Internals::getReferencedFilePaths):
     56        * testing/Internals.h:
     57        (Internals):
     58        * testing/Internals.idl: Produce DOMString[], consume sequence<DOMString> to match tests.
     59
    1602013-01-14  Elliott Sprehn  <esprehn@chromium.org>
    261
  • trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm

    r138727 r139641  
    323323}
    324324
    325 sub IsArrayType
    326 {
    327     my $object = shift;
    328     my $type = shift;
    329     # FIXME: Add proper support for T[], T[]?, sequence<T>.
    330     return $type =~ m/\[\]$/;
    331 }
    332 
    333325sub IsConstructorTemplate
    334326{
     
    403395
    404396    return 0 if $object->IsPrimitiveType($type);
     397    return 0 if $object->GetArrayType($type);
     398    return 0 if $object->GetSequenceType($type);
    405399    return 0 if $type eq "DOMString";
    406400
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r139278 r139641  
    186186    my $type = shift;
    187187
    188     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";
     188    return 1 if $type eq "CSSStyleDeclaration" or $type eq "MediaList" or $type eq "DOMStringList" or $type eq "DOMTokenList" or $type eq "DOMSettableTokenList";
    189189    return 0;
    190190}
     
    242242        $includesRef->{"JSXPathNSResolver.h"} = 1;
    243243        $includesRef->{"JSCustomXPathNSResolver.h"} = 1;
    244     } elsif ($type eq "DOMString[]") {
    245         # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
    246         $includesRef->{"JSDOMStringList.h"} = 1;
    247244    } elsif ($type eq "SerializedScriptValue") {
    248245        $includesRef->{"SerializedScriptValue.h"} = 1;
     
    252249        $includesRef->{"<wtf/${type}.h>"} = 1;
    253250    } elsif ($codeGenerator->GetSequenceType($type)) {
     251    } elsif ($codeGenerator->GetArrayType($type)) {
    254252    } else {
    255253        # default, include the same named file
     
    13021300            push(@andExpression, "(${value}.isNull() || ${value}.isFunction())");
    13031301            $usedArguments{$parameterIndex} = 1;
    1304         } elsif ($codeGenerator->IsArrayType($type) || $codeGenerator->GetSequenceType($type)) {
     1302        } elsif ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) {
    13051303            # FIXME: Add proper support for T[], T[]?, sequence<T>
    13061304            if ($parameter->isNullable) {
     
    30463044    "CompareHow" => "Range::CompareHow",
    30473045    "DOMString" => "const String&",
    3048     # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
    3049     "DOMString[]" => "RefPtr<DOMStringList>",
    30503046    "DOMObject" => "ScriptValue",
    30513047    "NodeFilter" => "RefPtr<NodeFilter>",
     
    30733069    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
    30743070    return "${svgNativeType}*" if $svgNativeType;
    3075     return "RefPtr<DOMStringList>" if $type eq "DOMStringList" or $type eq "DOMString[]";
     3071    return "RefPtr<DOMStringList>" if $type eq "DOMStringList";
    30763072    return $nativeType{$type} if exists $nativeType{$type};
    30773073
     
    30993095    my $type = shift;
    31003096    return "SerializedScriptValue*" if $type eq "SerializedScriptValue";
    3101     return "PassRefPtr<DOMStringList>" if $type eq "DOMStringList" or $type eq "DOMString[]";
     3097    return "PassRefPtr<DOMStringList>" if $type eq "DOMStringList";
    31023098
    31033099    return GetNativeType($type);
     
    32113207    }
    32123208
    3213     if ($type eq "DOMString[]" or $type eq "DOMStringList" ) {
     3209    if ($type eq "DOMStringList" ) {
    32143210        AddToImplIncludes("JSDOMStringList.h", $conditional);
    32153211        return "toDOMStringList(exec, $value)";
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r139619 r139641  
    14021402            # For Callbacks only checks if the value is null or object.
    14031403            push(@andExpression, "(${value}->IsNull() || ${value}->IsFunction())");
    1404         } elsif ($codeGenerator->IsArrayType($type) || $codeGenerator->GetSequenceType($type)) {
     1404        } elsif ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) {
    14051405            if ($parameter->isNullable) {
    14061406                push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())");
     
    36953695    return "Dictionary" if $type eq "Dictionary";
    36963696
    3697     # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
    3698     return "RefPtr<DOMStringList>" if $type eq "DOMString[]" or $type eq "DOMStringList";
    3699 
     3697    return "RefPtr<DOMStringList>" if $type eq "DOMStringList";
    37003698    return "RefPtr<IDBKey>" if $type eq "IDBKey";
    37013699    return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener";
     
    37673765    return "toWebCoreDate($value)" if $type eq "Date";
    37683766    return "toDOMStringList($value, $getIsolate)" if $type eq "DOMStringList";
    3769     # FIXME: Consider replacing DOMStringList with DOMString[] or sequence<DOMString>.
    3770     return "toDOMStringList($value, $getIsolate)" if $type eq "DOMString[]";
    37713767
    37723768    if ($type eq "DOMString") {
     
    38433839    return "SerializedScriptValue.h" if $type eq "SerializedScriptValue";
    38443840    return "ScriptValue.h" if $type eq "DOMObject" or $type eq "any";
    3845     return "V8DOMStringList.h" if $type eq "DOMString[]";
    38463841    return "V8${type}.h";
    38473842}
     
    39363931    'DOMObject' => 1,
    39373932    'DOMString' => 1,
    3938     'DOMString[]' => 1,
    39393933    'DOMTimeStamp' => 1,
    39403934    'Date' => 1,
     
    39673961{
    39683962    my $type = shift;
     3963    # FIXME: Should this return false for Sequence and Array types?
    39693964    return !($non_wrapper_types{$type});
    39703965}
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r138263 r139641  
    310310    { "methodWithUnsignedLongSequence", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence), (intptr_t)1, NoIntrinsic },
    311311    { "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic },
     312    { "domStringListFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionDomStringListFunction), (intptr_t)1, NoIntrinsic },
    312313    { "getSVGDocument", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionGetSVGDocument), (intptr_t)0, NoIntrinsic },
    313314    { "convert1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert1), (intptr_t)1, NoIntrinsic },
     
    22042205    if (exec->argumentCount() < 1)
    22052206        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    2206     RefPtr<DOMStringList> arrayArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
     2207    Vector<String> arrayArg(toNativeArray<String>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
    22072208    if (exec->hadException())
    22082209        return JSValue::encode(jsUndefined());
     
    22382239    if (exec->argumentCount() < 1)
    22392240        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    2240     RefPtr<DOMStringList> arrayArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
     2241    Vector<String> arrayArg(toNativeArray<String>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
    22412242    if (exec->hadException())
    22422243        return JSValue::encode(jsUndefined());
     
    24412442        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    24422443    ExceptionCode ec = 0;
     2444    Vector<String> values(toNativeArray<String>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
     2445    if (exec->hadException())
     2446        return JSValue::encode(jsUndefined());
     2447
     2448    JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl->stringArrayFunction(values, ec));
     2449    setDOMException(exec, ec);
     2450    return JSValue::encode(result);
     2451}
     2452
     2453EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionDomStringListFunction(ExecState* exec)
     2454{
     2455    JSValue thisValue = exec->hostThisValue();
     2456    if (!thisValue.inherits(&JSTestObj::s_info))
     2457        return throwVMTypeError(exec);
     2458    JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
     2459    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
     2460    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     2461    if (exec->argumentCount() < 1)
     2462        return throwVMError(exec, createNotEnoughArgumentsError(exec));
     2463    ExceptionCode ec = 0;
    24432464    RefPtr<DOMStringList> values(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
    24442465    if (exec->hadException())
    24452466        return JSValue::encode(jsUndefined());
    24462467
    2447     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl->stringArrayFunction(values, ec));
     2468    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->domStringListFunction(values, ec)));
    24482469    setDOMException(exec, ec);
    24492470    return JSValue::encode(result);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r135081 r139641  
    208208JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(JSC::ExecState*);
    209209JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStringArrayFunction(JSC::ExecState*);
     210JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionDomStringListFunction(JSC::ExecState*);
    210211JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(JSC::ExecState*);
    211212JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(JSC::ExecState*);
  • trunk/Source/WebCore/bindings/scripts/test/TestObj.idl

    r132667 r139641  
    220220#if defined(TESTING_V8) || defined(TESTING_JS)
    221221    DOMString[] stringArrayFunction(in DOMString[] values) raises(DOMException);
     222    DOMStringList domStringListFunction(in DOMStringList values) raises(DOMException);
    222223#endif
    223224
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r139483 r139641  
    14721472        return throwNotEnoughArgumentsError(args.GetIsolate());
    14731473    TestObj* imp = V8TestObj::toNative(args.Holder());
    1474     V8TRYCATCH(RefPtr<DOMStringList>, arrayArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
     1474    V8TRYCATCH(Vector<String>, arrayArg, toNativeArray<String>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
    14751475    imp->overloadedMethod(arrayArg);
    14761476    return v8Undefined();
     
    14921492        return throwNotEnoughArgumentsError(args.GetIsolate());
    14931493    TestObj* imp = V8TestObj::toNative(args.Holder());
    1494     V8TRYCATCH(RefPtr<DOMStringList>, arrayArg, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
     1494    V8TRYCATCH(Vector<String>, arrayArg, toNativeArray<String>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
    14951495    imp->overloadedMethod(arrayArg);
    14961496    return v8Undefined();
     
    16661666    ExceptionCode ec = 0;
    16671667    {
    1668     V8TRYCATCH(RefPtr<DOMStringList>, values, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
    1669     RefPtr<DOMStringList> result = imp->stringArrayFunction(values, ec);
     1668    V8TRYCATCH(Vector<String>, values, toNativeArray<String>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
     1669    Vector<String> result = imp->stringArrayFunction(values, ec);
    16701670    if (UNLIKELY(ec))
    16711671        goto fail;
    1672     return v8Array(result.release(), args.GetIsolate());
     1672    return v8Array(result, args.GetIsolate());
     1673    }
     1674    fail:
     1675    return setDOMException(ec, args.GetIsolate());
     1676}
     1677
     1678static v8::Handle<v8::Value> domStringListFunctionCallback(const v8::Arguments& args)
     1679{
     1680    if (args.Length() < 1)
     1681        return throwNotEnoughArgumentsError(args.GetIsolate());
     1682    TestObj* imp = V8TestObj::toNative(args.Holder());
     1683    ExceptionCode ec = 0;
     1684    {
     1685    V8TRYCATCH(RefPtr<DOMStringList>, values, toDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
     1686    RefPtr<DOMStringList> result = imp->domStringListFunction(values, ec);
     1687    if (UNLIKELY(ec))
     1688        goto fail;
     1689    return toV8(result.release(), args.Holder(), args.GetIsolate());
    16731690    }
    16741691    fail:
     
    19832000    {"overloadedMethod", TestObjV8Internal::overloadedMethodCallback},
    19842001    {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampCallback},
    1985     {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionCallback},
    19862002    {"getSVGDocument", TestObjV8Internal::getSVGDocumentCallback},
    19872003    {"mutablePointFunction", TestObjV8Internal::mutablePointFunctionCallback},
     
    21172133        proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod2Callback, v8Undefined(), defaultSignature));
    21182134
     2135    // Custom Signature 'stringArrayFunction'
     2136    const int stringArrayFunctionArgc = 1;
     2137    v8::Handle<v8::FunctionTemplate> stringArrayFunctionArgv[stringArrayFunctionArgc] = { V8DOMString[]::GetRawTemplate() };
     2138    v8::Handle<v8::Signature> stringArrayFunctionSignature = v8::Signature::New(desc, stringArrayFunctionArgc, stringArrayFunctionArgv);
     2139    proto->Set(v8::String::NewSymbol("stringArrayFunction"), v8::FunctionTemplate::New(TestObjV8Internal::stringArrayFunctionCallback, v8Undefined(), stringArrayFunctionSignature));
     2140
     2141    // Custom Signature 'domStringListFunction'
     2142    const int domStringListFunctionArgc = 1;
     2143    v8::Handle<v8::FunctionTemplate> domStringListFunctionArgv[domStringListFunctionArgc] = { V8DOMStringList::GetRawTemplate() };
     2144    v8::Handle<v8::Signature> domStringListFunctionSignature = v8::Signature::New(desc, domStringListFunctionArgc, domStringListFunctionArgv);
     2145    proto->Set(v8::String::NewSymbol("domStringListFunction"), v8::FunctionTemplate::New(TestObjV8Internal::domStringListFunctionCallback, v8Undefined(), domStringListFunctionSignature));
     2146
    21192147    // Custom Signature 'convert1'
    21202148    const int convert1Argc = 1;
  • trunk/Source/WebCore/testing/Internals.cpp

    r139410 r139641  
    704704#endif
    705705
    706 PassRefPtr<DOMStringList> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)
     706Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)
    707707{
    708708    HistoryItem* mainItem = frame()->loader()->history()->previousItem();
    709709    if (!mainItem) {
    710710        ec = INVALID_ACCESS_ERR;
    711         return 0;
     711        return Vector<String>();
    712712    }
    713713    String uniqueName = frame()->tree()->uniqueName();
    714714    if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) {
    715715        ec = INVALID_ACCESS_ERR;
    716         return 0;
    717     }
    718     const Vector<String>& state = mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState();
    719     RefPtr<DOMStringList> stringList = DOMStringList::create();
    720     for (unsigned i = 0; i < state.size(); ++i)
    721         stringList->append(state[i]);
    722     return stringList.release();
    723 }
    724 
    725 void Internals::setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList> state, ExceptionCode& ec)
     716        return Vector<String>();
     717    }
     718    return mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState();
     719}
     720
     721void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& state, ExceptionCode& ec)
    726722{
    727723    HistoryItem* mainItem = frame()->loader()->history()->previousItem();
    728     if (!state || !mainItem) {
     724    if (!mainItem) {
    729725        ec = INVALID_ACCESS_ERR;
    730726        return;
     
    732728    String uniqueName = frame()->tree()->uniqueName();
    733729    if (mainItem->target() == uniqueName)
    734         mainItem->setDocumentState(*state.get());
     730        mainItem->setDocumentState(state);
    735731    else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
    736         subItem->setDocumentState(*state.get());
     732        subItem->setDocumentState(state);
    737733    else
    738734        ec = INVALID_ACCESS_ERR;
     
    16491645}
    16501646
    1651 PassRefPtr<DOMStringList> Internals::iconURLs(Document* document) const
     1647Vector<String> Internals::iconURLs(Document* document) const
    16521648{
    16531649    Vector<IconURL> iconURLs = document->iconURLs();
    1654     RefPtr<DOMStringList> stringList = DOMStringList::create();
     1650    Vector<String> array;
    16551651
    16561652    Vector<IconURL>::const_iterator iter(iconURLs.begin());
    16571653    for (; iter != iconURLs.end(); ++iter)
    1658         stringList->append(iter->m_iconURL.string());
    1659 
    1660     return stringList.release();
     1654        array.append(iter->m_iconURL.string());
     1655
     1656    return array;
    16611657}
    16621658
     
    17501746}
    17511747
    1752 PassRefPtr<DOMStringList> Internals::getReferencedFilePaths() const
    1753 {
    1754     RefPtr<DOMStringList> stringList = DOMStringList::create();
     1748Vector<String> Internals::getReferencedFilePaths() const
     1749{
    17551750    frame()->loader()->history()->saveDocumentAndScrollState();
    1756     const Vector<String>& filePaths = FormController::getReferencedFilePaths(frame()->loader()->history()->currentItem()->documentState());
    1757     for (size_t i = 0; i < filePaths.size(); ++i)
    1758         stringList->append(filePaths[i]);
    1759     return stringList.release();
     1751    return FormController::getReferencedFilePaths(frame()->loader()->history()->currentItem()->documentState());
    17601752}
    17611753
  • trunk/Source/WebCore/testing/Internals.h

    r139050 r139641  
    121121    void selectColorInColorChooser(Element*, const String& colorValue);
    122122#endif
    123     PassRefPtr<DOMStringList> formControlStateOfPreviousHistoryItem(ExceptionCode&);
    124     void setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList>, ExceptionCode&);
     123    Vector<String> formControlStateOfPreviousHistoryItem(ExceptionCode&);
     124    void setFormControlStateOfPreviousHistoryItem(const Vector<String>&, ExceptionCode&);
    125125    void setEnableMockPagePopup(bool, ExceptionCode&);
    126126#if ENABLE(PAGE_POPUP)
     
    241241
    242242    int pageNumber(Element*, float pageWidth = 800, float pageHeight = 600);
    243     PassRefPtr<DOMStringList> iconURLs(Document*) const;
     243    Vector<String> iconURLs(Document*) const;
    244244
    245245    int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
     
    262262    PassRefPtr<TypeConversions> typeConversions() const;
    263263
    264     PassRefPtr<DOMStringList> getReferencedFilePaths() const;
     264    Vector<String> getReferencedFilePaths() const;
    265265
    266266    void startTrackingRepaints(Document*, ExceptionCode&);
  • trunk/Source/WebCore/testing/Internals.idl

    r139050 r139641  
    8282#endif
    8383    DOMString[] formControlStateOfPreviousHistoryItem() raises(DOMException);
    84     void setFormControlStateOfPreviousHistoryItem(in DOMString[] values) raises(DOMException);
     84    void setFormControlStateOfPreviousHistoryItem(in sequence<DOMString> values) raises(DOMException);
    8585    void setEnableMockPagePopup(in boolean enabled) raises(DOMException);
    8686#if defined(ENABLE_PAGE_POPUP) && ENABLE_PAGE_POPUP
Note: See TracChangeset for help on using the changeset viewer.