Title: [152569] trunk
Revision
152569
Author
[email protected]
Date
2013-07-11 07:54:36 -0700 (Thu, 11 Jul 2013)

Log Message

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

Patch by Radu Stavila <[email protected]> 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.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152568 => 152569)


--- trunk/LayoutTests/ChangeLog	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/LayoutTests/ChangeLog	2013-07-11 14:54:36 UTC (rev 152569)
@@ -1,3 +1,15 @@
+2013-07-11  Radu Stavila  <[email protected]>
+
+        NamedFlowCollection getters should follow the same pattern as HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=118561
+
+        Reviewed by Christophe Dumez.
+
+        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.
+
 2013-07-11  Mario Sanchez Prada  <[email protected]>
 
         [GTK] Unreviewed gardening. Added crash expectations in debug builds after r152537

Added: trunk/LayoutTests/fast/regions/webkit-named-flow-collection-empty-getters-expected.txt (0 => 152569)


--- trunk/LayoutTests/fast/regions/webkit-named-flow-collection-empty-getters-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/webkit-named-flow-collection-empty-getters-expected.txt	2013-07-11 14:54:36 UTC (rev 152569)
@@ -0,0 +1,13 @@
+Test for [118561] NamedFlowCollection getters should follow the same pattern as HTMLCollection
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS namedFlowCollection[0] is undefined.
+PASS namedFlowCollection['flow'] is undefined.
+PASS namedFlowCollection.item(0) is null
+PASS namedFlowCollection.namedItem('flow') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/regions/webkit-named-flow-collection-empty-getters.html (0 => 152569)


--- trunk/LayoutTests/fast/regions/webkit-named-flow-collection-empty-getters.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/webkit-named-flow-collection-empty-getters.html	2013-07-11 14:54:36 UTC (rev 152569)
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+    <body>
+        <script src=""
+        <script>
+            description("Test for <a href=''>[118561] NamedFlowCollection getters should follow the same pattern as HTMLCollection</a>");
+
+            var namedFlowCollection = document.webkitGetNamedFlows();
+            shouldBeUndefined("namedFlowCollection[0]");
+            shouldBeUndefined("namedFlowCollection['flow']");
+            shouldBeNull("namedFlowCollection.item(0)");
+            shouldBeNull("namedFlowCollection.namedItem('flow')");
+        </script>
+        <script src="" 
+    </body>
+</html>
\ No newline at end of file

Deleted: trunk/LayoutTests/fast/regions/webkit-named-flow-collection-undefined-expected.txt (152568 => 152569)


--- trunk/LayoutTests/fast/regions/webkit-named-flow-collection-undefined-expected.txt	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/LayoutTests/fast/regions/webkit-named-flow-collection-undefined-expected.txt	2013-07-11 14:54:36 UTC (rev 152569)
@@ -1,11 +0,0 @@
-Test for [118463] NamedFlowCollection getters should return undefined when there's no NamedFlow
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS namedFlowCollection.item(0) is undefined.
-PASS namedFlowCollection.namedItem('flow') is undefined.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/regions/webkit-named-flow-collection-undefined.html (152568 => 152569)


--- trunk/LayoutTests/fast/regions/webkit-named-flow-collection-undefined.html	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/LayoutTests/fast/regions/webkit-named-flow-collection-undefined.html	2013-07-11 14:54:36 UTC (rev 152569)
@@ -1,18 +0,0 @@
-<!doctype html>
-<html>
-    <body>
-
-        <script src=""
-        <script>
-            if (window.testRunner)
-                testRunner.dumpAsText();
-
-            description("Test for <a href=''>[118463] NamedFlowCollection getters should return undefined when there's no NamedFlow</a>");
-
-            var namedFlowCollection = document.webkitGetNamedFlows();
-            shouldBeUndefined("namedFlowCollection.item(0)");
-            shouldBeUndefined("namedFlowCollection.namedItem('flow')");
-        </script>
-    <script src="" 
-    </body>
-</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (152568 => 152569)


--- trunk/Source/WebCore/ChangeLog	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/ChangeLog	2013-07-11 14:54:36 UTC (rev 152569)
@@ -1,3 +1,34 @@
+2013-07-11  Radu Stavila  <[email protected]>
+
+        NamedFlowCollection getters should follow the same pattern as HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=118561
+
+        Reviewed by Christophe Dumez.
+
+        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:
+
 2013-07-11  Andreas Kling  <[email protected]>
 
         Revert r149313: Don't check for @media rules affected by viewport changes in every layout.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-07-11 14:54:36 UTC (rev 152569)
@@ -3320,11 +3320,6 @@
             push(@implContent, $indent . "    return JSValue::encode(jsUndefined());\n");
         }
 
-        if ($function->signature->extendedAttributes->{"TreatReturnedNullObjectAs"} and $function->signature->extendedAttributes->{"TreatReturnedNullObjectAs"} eq "Undefined") {
-            push(@implContent, $indent . "if (result == jsNull())\n");
-            push(@implContent, $indent . "    result = jsUndefined();\n\n");
-        }
-
         push(@implContent, $indent . "return JSValue::encode(result);\n");
     }
 }

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2013-07-11 14:54:36 UTC (rev 152569)
@@ -101,7 +101,6 @@
 StrictTypeChecking
 SuppressToJSObject
 TreatNullAs=NullString
-TreatReturnedNullObjectAs=Undefined
 TreatReturnedNullStringAs=Null|Undefined
 TreatUndefinedAs=NullString
 TypedArray=*

Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp	2013-07-11 14:54:36 UTC (rev 152569)
@@ -990,14 +990,6 @@
 
 #endif
 
-WebDOMTestObj WebDOMTestObj::treatReturnedNullObjectAsUndefined()
-{
-    if (!impl())
-        return WebDOMTestObj();
-
-    return toWebKit(WTF::getPtr(impl()->treatReturnedNullObjectAsUndefined()));
-}
-
 void WebDOMTestObj::classMethod()
 {
     if (!impl())

Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2013-07-11 14:54:36 UTC (rev 152569)
@@ -188,7 +188,6 @@
 #if ENABLE(Condition1) || ENABLE(Condition2)
     void conditionalMethod3();
 #endif
-    WebDOMTestObj treatReturnedNullObjectAsUndefined();
     void classMethod();
     int classMethodWithOptional(int arg);
 #if ENABLE(Condition1)

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2013-07-11 14:54:36 UTC (rev 152569)
@@ -1413,16 +1413,6 @@
 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */
 }
 
-WebKitDOMTestObj*
-webkit_dom_test_obj_treat_returned_null_object_as_undefined(WebKitDOMTestObj* self)
-{
-    WebCore::JSMainThreadNullState state;
-    g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
-    WebCore::TestObj* item = WebKit::core(self);
-    RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->treatReturnedNullObjectAsUndefined());
-    return WebKit::kit(gobjectResult.get());
-}
-
 void
 webkit_dom_test_obj_class_method(WebKitDOMTestObj* self)
 {

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2013-07-11 14:54:36 UTC (rev 152569)
@@ -405,16 +405,6 @@
 webkit_dom_test_obj_conditional_method3(WebKitDOMTestObj* self);
 
 /**
- * webkit_dom_test_obj_treat_returned_null_object_as_undefined:
- * @self: A #WebKitDOMTestObj
- *
- * Returns: (transfer none):
- *
-**/
-WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_treat_returned_null_object_as_undefined(WebKitDOMTestObj* self);
-
-/**
  * webkit_dom_test_obj_class_method:
  * @self: A #WebKitDOMTestObj
  *

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-07-11 14:54:36 UTC (rev 152569)
@@ -319,7 +319,6 @@
 #if ENABLE(Condition1) || ENABLE(Condition2)
     { "conditionalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod3), (intptr_t)0, NoIntrinsic },
 #endif
-    { "treatReturnedNullObjectAsUndefined", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined), (intptr_t)0, NoIntrinsic },
     { "overloadedMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2, NoIntrinsic },
     { "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 },
@@ -2505,22 +2504,6 @@
 
 #endif
 
-EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined(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());
-
-    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->treatReturnedNullObjectAsUndefined()));
-    if (result == jsNull())
-        result = jsUndefined();
-
-    return JSValue::encode(result);
-}
-
 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec)
 {
     JSValue thisValue = exec->hostThisValue();

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2013-07-11 14:54:36 UTC (rev 152569)
@@ -209,7 +209,6 @@
 #if ENABLE(Condition1) || ENABLE(Condition2)
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(JSC::ExecState*);
 #endif
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTreatReturnedNullObjectAsUndefined(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional(JSC::ExecState*);

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2013-07-11 14:54:36 UTC (rev 152569)
@@ -167,7 +167,6 @@
 #if ENABLE(Condition1) || ENABLE(Condition2)
 - (void)conditionalMethod3;
 #endif
-- (DOMTestObj *)treatReturnedNullObjectAsUndefined;
 - (void)classMethod;
 - (int)classMethodWithOptional:(int)arg;
 - (void)classMethod2:(int)arg;

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2013-07-11 14:54:36 UTC (rev 152569)
@@ -1052,12 +1052,6 @@
 
 #endif
 
-- (DOMTestObj *)treatReturnedNullObjectAsUndefined
-{
-    WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->treatReturnedNullObjectAsUndefined()));
-}
-
 - (void)classMethod
 {
     WebCore::JSMainThreadNullState state;

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (152568 => 152569)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2013-07-11 14:54:36 UTC (rev 152569)
@@ -167,9 +167,6 @@
 
     [Conditional=Condition1] const unsigned short CONDITIONAL_CONST = 0;
 
-    // 'TreatReturnedNullObjectAs' extended method
-    [TreatReturnedNullObjectAs=Undefined] TestObj treatReturnedNullObjectAsUndefined();
-
 #if defined(TESTING_JS)
     [CachedAttribute] readonly attribute any cachedAttribute1;
     [CachedAttribute] readonly attribute any cachedAttribute2;

Modified: trunk/Source/WebCore/dom/DOMNamedFlowCollection.idl (152568 => 152569)


--- trunk/Source/WebCore/dom/DOMNamedFlowCollection.idl	2013-07-11 14:45:45 UTC (rev 152568)
+++ trunk/Source/WebCore/dom/DOMNamedFlowCollection.idl	2013-07-11 14:54:36 UTC (rev 152569)
@@ -35,6 +35,6 @@
     ImplementationLacksVTable
 ] interface DOMNamedFlowCollection {
     readonly attribute unsigned long length;
-    [TreatReturnedNullObjectAs=Undefined] getter WebKitNamedFlow item(unsigned long index);
-    [TreatReturnedNullObjectAs=Undefined] getter WebKitNamedFlow namedItem(DOMString name);
+    getter WebKitNamedFlow item(unsigned long index);
+    getter WebKitNamedFlow namedItem(DOMString name);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to