Changeset 152569 in webkit


Ignore:
Timestamp:
Jul 11, 2013 7:54:36 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

NamedFlowCollection getters should follow the same pattern as HTMLCollection
https://bugs.webkit.org/show_bug.cgi?id=118561

Patch by Radu Stavila <stavila@adobe.com> on 2013-07-11
Reviewed by Christophe Dumez.

Source/WebCore:

Modified item and namedItem methods from DOMNamedFlowCollection to return null instead of undefined.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=22617
Completely removed the TreatReturnedNullObjectAs attribute as it was only used by the DOMNamedFlowCollection interface.

Test: fast/regions/webkit-named-flow-collection-empty-getters.html

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementationFunctionCall):

  • bindings/scripts/IDLAttributes.txt:
  • bindings/scripts/test/CPP/WebDOMTestObj.cpp:

(WebDOMTestObj::treatReturnedNullObjectAsUndefined):

  • bindings/scripts/test/CPP/WebDOMTestObj.h:
  • bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:

(webkit_dom_test_obj_treat_returned_null_object_as_undefined):

  • bindings/scripts/test/GObject/WebKitDOMTestObj.h:
  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined):

  • bindings/scripts/test/JS/JSTestObj.h:
  • bindings/scripts/test/ObjC/DOMTestObj.h:
  • bindings/scripts/test/ObjC/DOMTestObj.mm:

(-[DOMTestObj treatReturnedNullObjectAsUndefined]):

  • bindings/scripts/test/TestObj.idl:
  • dom/DOMNamedFlowCollection.idl:

LayoutTests:

Updated test for NamedFlowCollection getters when no named flows are created.

  • fast/regions/webkit-named-flow-collection-empty-getters-expected.txt: Renamed from LayoutTests/fast/regions/webkit-named-flow-collection-undefined-expected.txt.
  • fast/regions/webkit-named-flow-collection-empty-getters.html: Renamed from LayoutTests/fast/regions/webkit-named-flow-collection-undefined.html.
Location:
trunk
Files:
2 added
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r152562 r152569  
     12013-07-11  Radu Stavila  <stavila@adobe.com>
     2
     3        NamedFlowCollection getters should follow the same pattern as HTMLCollection
     4        https://bugs.webkit.org/show_bug.cgi?id=118561
     5
     6        Reviewed by Christophe Dumez.
     7
     8        Updated test for NamedFlowCollection getters when no named flows are created.
     9
     10        * fast/regions/webkit-named-flow-collection-empty-getters-expected.txt: Renamed from LayoutTests/fast/regions/webkit-named-flow-collection-undefined-expected.txt.
     11        * fast/regions/webkit-named-flow-collection-empty-getters.html: Renamed from LayoutTests/fast/regions/webkit-named-flow-collection-undefined.html.
     12
    1132013-07-11  Mario Sanchez Prada  <mario.prada@samsung.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r152568 r152569  
     12013-07-11  Radu Stavila  <stavila@adobe.com>
     2
     3        NamedFlowCollection getters should follow the same pattern as HTMLCollection
     4        https://bugs.webkit.org/show_bug.cgi?id=118561
     5
     6        Reviewed by Christophe Dumez.
     7
     8        Modified item and namedItem methods from DOMNamedFlowCollection to return null instead of undefined.
     9        https://www.w3.org/Bugs/Public/show_bug.cgi?id=22617
     10        Completely removed the TreatReturnedNullObjectAs attribute as it was only used by the DOMNamedFlowCollection interface.
     11
     12        Test: fast/regions/webkit-named-flow-collection-empty-getters.html
     13
     14        * bindings/scripts/CodeGeneratorJS.pm:
     15        (GenerateImplementationFunctionCall):
     16        * bindings/scripts/IDLAttributes.txt:
     17        * bindings/scripts/test/CPP/WebDOMTestObj.cpp:
     18        (WebDOMTestObj::treatReturnedNullObjectAsUndefined):
     19        * bindings/scripts/test/CPP/WebDOMTestObj.h:
     20        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
     21        (webkit_dom_test_obj_treat_returned_null_object_as_undefined):
     22        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
     23        * bindings/scripts/test/JS/JSTestObj.cpp:
     24        (WebCore::jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined):
     25        * bindings/scripts/test/JS/JSTestObj.h:
     26        * bindings/scripts/test/ObjC/DOMTestObj.h:
     27        * bindings/scripts/test/ObjC/DOMTestObj.mm:
     28        (-[DOMTestObj treatReturnedNullObjectAsUndefined]):
     29        * bindings/scripts/test/TestObj.idl:
     30        * dom/DOMNamedFlowCollection.idl:
     31
    1322013-07-11  Andreas Kling  <akling@apple.com>
    233
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r152565 r152569  
    33213321        }
    33223322
    3323         if ($function->signature->extendedAttributes->{"TreatReturnedNullObjectAs"} and $function->signature->extendedAttributes->{"TreatReturnedNullObjectAs"} eq "Undefined") {
    3324             push(@implContent, $indent . "if (result == jsNull())\n");
    3325             push(@implContent, $indent . "    result = jsUndefined();\n\n");
    3326         }
    3327 
    33283323        push(@implContent, $indent . "return JSValue::encode(result);\n");
    33293324    }
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt

    r152490 r152569  
    102102SuppressToJSObject
    103103TreatNullAs=NullString
    104 TreatReturnedNullObjectAs=Undefined
    105104TreatReturnedNullStringAs=Null|Undefined
    106105TreatUndefinedAs=NullString
  • trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp

    r152466 r152569  
    991991#endif
    992992
    993 WebDOMTestObj WebDOMTestObj::treatReturnedNullObjectAsUndefined()
    994 {
    995     if (!impl())
    996         return WebDOMTestObj();
    997 
    998     return toWebKit(WTF::getPtr(impl()->treatReturnedNullObjectAsUndefined()));
    999 }
    1000 
    1001993void WebDOMTestObj::classMethod()
    1002994{
  • trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h

    r152466 r152569  
    189189    void conditionalMethod3();
    190190#endif
    191     WebDOMTestObj treatReturnedNullObjectAsUndefined();
    192191    void classMethod();
    193192    int classMethodWithOptional(int arg);
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp

    r152466 r152569  
    14141414}
    14151415
    1416 WebKitDOMTestObj*
    1417 webkit_dom_test_obj_treat_returned_null_object_as_undefined(WebKitDOMTestObj* self)
    1418 {
    1419     WebCore::JSMainThreadNullState state;
    1420     g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
    1421     WebCore::TestObj* item = WebKit::core(self);
    1422     RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->treatReturnedNullObjectAsUndefined());
    1423     return WebKit::kit(gobjectResult.get());
    1424 }
    1425 
    14261416void
    14271417webkit_dom_test_obj_class_method(WebKitDOMTestObj* self)
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h

    r152466 r152569  
    406406
    407407/**
    408  * webkit_dom_test_obj_treat_returned_null_object_as_undefined:
    409  * @self: A #WebKitDOMTestObj
    410  *
    411  * Returns: (transfer none):
    412  *
    413 **/
    414 WEBKIT_API WebKitDOMTestObj*
    415 webkit_dom_test_obj_treat_returned_null_object_as_undefined(WebKitDOMTestObj* self);
    416 
    417 /**
    418408 * webkit_dom_test_obj_class_method:
    419409 * @self: A #WebKitDOMTestObj
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r152466 r152569  
    320320    { "conditionalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod3), (intptr_t)0, NoIntrinsic },
    321321#endif
    322     { "treatReturnedNullObjectAsUndefined", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined), (intptr_t)0, NoIntrinsic },
    323322    { "overloadedMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2, NoIntrinsic },
    324323    { "classMethodWithClamp", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithClamp), (intptr_t)2, NoIntrinsic },
     
    25052504
    25062505#endif
    2507 
    2508 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined(ExecState* exec)
    2509 {
    2510     JSValue thisValue = exec->hostThisValue();
    2511     if (!thisValue.inherits(&JSTestObj::s_info))
    2512         return throwVMTypeError(exec);
    2513     JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
    2514     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
    2515     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    2516 
    2517     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->treatReturnedNullObjectAsUndefined()));
    2518     if (result == jsNull())
    2519         result = jsUndefined();
    2520 
    2521     return JSValue::encode(result);
    2522 }
    25232506
    25242507static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r152466 r152569  
    210210JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(JSC::ExecState*);
    211211#endif
    212 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined(JSC::ExecState*);
    213212JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
    214213JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod(JSC::ExecState*);
  • trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h

    r152466 r152569  
    168168- (void)conditionalMethod3;
    169169#endif
    170 - (DOMTestObj *)treatReturnedNullObjectAsUndefined;
    171170- (void)classMethod;
    172171- (int)classMethodWithOptional:(int)arg;
  • trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm

    r152466 r152569  
    10531053#endif
    10541054
    1055 - (DOMTestObj *)treatReturnedNullObjectAsUndefined
    1056 {
    1057     WebCore::JSMainThreadNullState state;
    1058     return kit(WTF::getPtr(IMPL->treatReturnedNullObjectAsUndefined()));
    1059 }
    1060 
    10611055- (void)classMethod
    10621056{
  • trunk/Source/WebCore/bindings/scripts/test/TestObj.idl

    r152466 r152569  
    168168    [Conditional=Condition1] const unsigned short CONDITIONAL_CONST = 0;
    169169
    170     // 'TreatReturnedNullObjectAs' extended method
    171     [TreatReturnedNullObjectAs=Undefined] TestObj treatReturnedNullObjectAsUndefined();
    172 
    173170#if defined(TESTING_JS)
    174171    [CachedAttribute] readonly attribute any cachedAttribute1;
  • trunk/Source/WebCore/dom/DOMNamedFlowCollection.idl

    r152466 r152569  
    3636] interface DOMNamedFlowCollection {
    3737    readonly attribute unsigned long length;
    38     [TreatReturnedNullObjectAs=Undefined] getter WebKitNamedFlow item(unsigned long index);
    39     [TreatReturnedNullObjectAs=Undefined] getter WebKitNamedFlow namedItem(DOMString name);
     38    getter WebKitNamedFlow item(unsigned long index);
     39    getter WebKitNamedFlow namedItem(DOMString name);
    4040};
Note: See TracChangeset for help on using the changeset viewer.