Title: [200316] trunk/Source/WebCore
Revision
200316
Author
[email protected]
Date
2016-05-01 21:21:19 -0700 (Sun, 01 May 2016)

Log Message

Pass reference instead of pointer to IDL attribute setters if not nullable
https://bugs.webkit.org/show_bug.cgi?id=157250

Reviewed by Darin Adler.

Update the bindings generator so that we pass wrapper types by reference
to attribute setters instead of by raw pointer when the attribute is not
marked as nullable in the IDL.

There is no intended Web-exposed behavior change.

* Modules/speech/SpeechSynthesisUtterance.idl:
* Modules/webaudio/ConvolverNode.idl:
* bindings/js/JSDataCueCustom.cpp:
(WebCore::constructJSDataCue):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/CodeGeneratorObjC.pm:
(GenerateImplementation):

* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/ObjC/DOMTestInterface.mm:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
Rebaseline bindings tests.

* dom/Document.cpp:
(WebCore::Document::moveNodeIteratorsToNewDocument):
* dom/NodeIterator.cpp:
(WebCore::NodeIterator::NodePointer::NodePointer):
(WebCore::NodeIterator::NodePointer::moveToNext):
(WebCore::NodeIterator::NodePointer::moveToPrevious):
(WebCore::NodeIterator::NodeIterator):
(WebCore::NodeIterator::~NodeIterator):
(WebCore::NodeIterator::updateForNodeRemoval):
(WebCore::NodeIterator::NodePointer::clear): Deleted.
(WebCore::NodeIterator::nextNode): Deleted.
* dom/NodeIterator.h:
* dom/Traversal.cpp:
(WebCore::NodeIteratorBase::NodeIteratorBase):
* dom/Traversal.h:
(WebCore::NodeIteratorBase::root):
* dom/TreeWalker.cpp:
(WebCore::TreeWalker::setCurrentNode):
(WebCore::TreeWalker::setCurrent):
(WebCore::TreeWalker::parentNode):
(WebCore::TreeWalker::firstChild):
(WebCore::TreeWalker::lastChild):
(WebCore::TreeWalker::traverseSiblings):
(WebCore::TreeWalker::previousNode):
(WebCore::TreeWalker::nextNode):
* dom/TreeWalker.h:
(WebCore::TreeWalker::currentNode):
* dom/TreeWalker.idl:
* html/HTMLAttachmentElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLTableElement.idl:
* html/track/DataCue.cpp:
(WebCore::DataCue::DataCue):
(WebCore::DataCue::setData):
(WebCore::toDataCue): Deleted.
* html/track/DataCue.h:
* html/track/DataCue.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200315 => 200316)


--- trunk/Source/WebCore/ChangeLog	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/ChangeLog	2016-05-02 04:21:19 UTC (rev 200316)
@@ -1,3 +1,69 @@
+2016-05-01  Chris Dumez  <[email protected]>
+
+        Pass reference instead of pointer to IDL attribute setters if not nullable
+        https://bugs.webkit.org/show_bug.cgi?id=157250
+
+        Reviewed by Darin Adler.
+
+        Update the bindings generator so that we pass wrapper types by reference
+        to attribute setters instead of by raw pointer when the attribute is not
+        marked as nullable in the IDL.
+
+        There is no intended Web-exposed behavior change.
+
+        * Modules/speech/SpeechSynthesisUtterance.idl:
+        * Modules/webaudio/ConvolverNode.idl:
+        * bindings/js/JSDataCueCustom.cpp:
+        (WebCore::constructJSDataCue):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        (GenerateImplementation):
+
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        Rebaseline bindings tests.
+
+        * dom/Document.cpp:
+        (WebCore::Document::moveNodeIteratorsToNewDocument):
+        * dom/NodeIterator.cpp:
+        (WebCore::NodeIterator::NodePointer::NodePointer):
+        (WebCore::NodeIterator::NodePointer::moveToNext):
+        (WebCore::NodeIterator::NodePointer::moveToPrevious):
+        (WebCore::NodeIterator::NodeIterator):
+        (WebCore::NodeIterator::~NodeIterator):
+        (WebCore::NodeIterator::updateForNodeRemoval):
+        (WebCore::NodeIterator::NodePointer::clear): Deleted.
+        (WebCore::NodeIterator::nextNode): Deleted.
+        * dom/NodeIterator.h:
+        * dom/Traversal.cpp:
+        (WebCore::NodeIteratorBase::NodeIteratorBase):
+        * dom/Traversal.h:
+        (WebCore::NodeIteratorBase::root):
+        * dom/TreeWalker.cpp:
+        (WebCore::TreeWalker::setCurrentNode):
+        (WebCore::TreeWalker::setCurrent):
+        (WebCore::TreeWalker::parentNode):
+        (WebCore::TreeWalker::firstChild):
+        (WebCore::TreeWalker::lastChild):
+        (WebCore::TreeWalker::traverseSiblings):
+        (WebCore::TreeWalker::previousNode):
+        (WebCore::TreeWalker::nextNode):
+        * dom/TreeWalker.h:
+        (WebCore::TreeWalker::currentNode):
+        * dom/TreeWalker.idl:
+        * html/HTMLAttachmentElement.idl:
+        * html/HTMLInputElement.idl:
+        * html/HTMLTableElement.idl:
+        * html/track/DataCue.cpp:
+        (WebCore::DataCue::DataCue):
+        (WebCore::DataCue::setData):
+        (WebCore::toDataCue): Deleted.
+        * html/track/DataCue.h:
+        * html/track/DataCue.idl:
+
 2016-05-01  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r200264 and r200266.

Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl (200315 => 200316)


--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -30,7 +30,7 @@
 ] interface SpeechSynthesisUtterance : EventTarget {
     attribute DOMString text;
     attribute DOMString lang;
-    attribute SpeechSynthesisVoice voice;
+    attribute SpeechSynthesisVoice? voice; // FIXME: should not be nullable.
     attribute unrestricted float volume;
     attribute unrestricted float rate;
     attribute unrestricted float pitch;

Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl (200315 => 200316)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -27,6 +27,6 @@
     Conditional=WEB_AUDIO,
     JSGenerateToJSObject
 ] interface ConvolverNode : AudioNode {
-    [SetterRaisesException] attribute AudioBuffer buffer;
+    [SetterRaisesException] attribute AudioBuffer? buffer;
     attribute boolean normalize;
 };

Modified: trunk/Source/WebCore/bindings/js/JSDataCueCustom.cpp (200315 => 200316)


--- trunk/Source/WebCore/bindings/js/JSDataCueCustom.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/js/JSDataCueCustom.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -53,7 +53,6 @@
     if (exec->argumentCount() < 3)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
 
-    ExceptionCode ec = 0;
     double startTime(exec->argument(0).toNumber(exec));
     if (UNLIKELY(exec->hadException()))
         return JSValue::encode(jsUndefined());
@@ -84,16 +83,17 @@
     RefPtr<DataCue> object;
     if (valueArgument.isCell() && valueArgument.asCell()->inherits(std::remove_pointer<JSArrayBuffer*>::type::info())) {
 
-        ArrayBuffer* data(toArrayBuffer(valueArgument));
+        ArrayBuffer* data = ""
         if (UNLIKELY(exec->hadException()))
             return JSValue::encode(jsUndefined());
 
-        object = DataCue::create(*context, MediaTime::createWithDouble(startTime), MediaTime::createWithDouble(endTime), data, type, ec);
-        if (ec) {
-            setDOMException(exec, ec);
-            return JSValue::encode(JSValue());
+        if (UNLIKELY(!data)) {
+            setDOMException(exec, TypeError);
+            return JSValue::encode(jsUndefined());
         }
 
+        object = DataCue::create(*context, MediaTime::createWithDouble(startTime), MediaTime::createWithDouble(endTime), *data, type);
+
         return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
     }
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (200315 => 200316)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2016-05-02 04:21:19 UTC (rev 200316)
@@ -1110,9 +1110,7 @@
         }
         if ($paramIsGDOMType || ($paramIDLType eq "DOMString")) {
             $paramName = "converted" . $codeGenerator->WK_ucfirst($paramName);
-            if ($prefix ne "set_" && $codeGenerator->ShouldPassWrapperByReference($param, $parentNode)) {
-                $paramName = "*$paramName";
-            }
+            $paramName = "*$paramName" if $codeGenerator->ShouldPassWrapperByReference($param, $parentNode);
         }
         if ($paramIDLType eq "NodeFilter" || $paramIDLType eq "XPathNSResolver") {
             $paramName = "WTF::getPtr(" . $paramName . ")";
@@ -1497,6 +1495,7 @@
         my $param = new domSignature();
         $param->name("value");
         $param->type($attribute->signature->type);
+        $param->isNullable($attribute->signature->isNullable);
         my %attributes = ();
         $param->extendedAttributes(\%attributes);
         my $arrayRef = $function->parameters;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200315 => 200316)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-05-02 04:21:19 UTC (rev 200316)
@@ -2860,6 +2860,14 @@
                     push (@implContent, "        return false;\n");
                 }
 
+                my $shouldPassByReference = ShouldPassWrapperByReference($attribute->signature, $interface);
+                if ($shouldPassByReference) {
+                    push(@implContent, "    if (UNLIKELY(!nativeValue)) {\n");
+                    push(@implContent, "        throwVMTypeError(state);\n");
+                    push(@implContent, "        return false;\n");
+                    push(@implContent, "    }\n");
+                }
+
                 if ($type eq "double" or $type eq "float") {
                     push(@implContent, "    if (UNLIKELY(!std::isfinite(nativeValue))) {\n");
                     push(@implContent, "        throwVMTypeError(state);\n");
@@ -2903,7 +2911,7 @@
                     } elsif ($codeGenerator->IsEnumType($type) and not $codeGenerator->IsStringBasedEnumType($type)) {
                         push(@arguments, "nativeValue.value()");
                     } else {
-                        push(@arguments, "nativeValue");
+                        push(@arguments, $shouldPassByReference ? "*nativeValue" : "nativeValue");
                     }
                     if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) {
                         my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"};

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (200315 => 200316)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2016-05-02 04:21:19 UTC (rev 200316)
@@ -1417,6 +1417,12 @@
                     $arg = "core(" . $arg . ")";
                 }
 
+                if ($codeGenerator->ShouldPassWrapperByReference($attribute->signature, $interface)) {
+                    push(@implContent, "    if (!$arg)\n");
+                    push(@implContent, "        WebCore::raiseTypeErrorException();\n");
+                    $arg = "*$arg";
+                }
+
                 my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute);
                 push(@arguments, $arg);
                 push(@arguments, "ec") if $hasSetterException;

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp (200315 => 200316)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -450,7 +450,7 @@
     g_return_if_fail(WEBKIT_DOM_IS_NODE(value));
     WebCore::TestInterface* item = WebKit::core(self);
     WebCore::Node* convertedValue = WebKit::core(value);
-    item->setImplementsNode(convertedValue);
+    item->setImplementsNode(*convertedValue);
 #else
     UNUSED_PARAM(self);
     UNUSED_PARAM(value);
@@ -567,7 +567,7 @@
     g_return_if_fail(WEBKIT_DOM_IS_NODE(value));
     WebCore::TestInterface* item = WebKit::core(self);
     WebCore::Node* convertedValue = WebKit::core(value);
-    WebCore::TestSupplemental::setSupplementalNode(*item, convertedValue);
+    WebCore::TestSupplemental::setSupplementalNode(*item, *convertedValue);
 #else
     UNUSED_PARAM(self);
     UNUSED_PARAM(value);

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


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -92,6 +92,7 @@
     PROP_UNSIGNED_LONG_LONG_ATTR,
     PROP_STRING_ATTR,
     PROP_TEST_OBJ_ATTR,
+    PROP_TEST_NULLABLE_OBJ_ATTR,
     PROP_LENIENT_TEST_OBJ_ATTR,
     PROP_UNFORGEABLE_ATTR,
     PROP_STRING_ATTR_TREATING_NULL_AS_EMPTY_STRING,
@@ -327,6 +328,9 @@
     case PROP_TEST_OBJ_ATTR:
         g_value_set_object(value, webkit_dom_test_obj_get_test_obj_attr(self));
         break;
+    case PROP_TEST_NULLABLE_OBJ_ATTR:
+        g_value_set_object(value, webkit_dom_test_obj_get_test_nullable_obj_attr(self));
+        break;
     case PROP_LENIENT_TEST_OBJ_ATTR:
         g_value_set_object(value, webkit_dom_test_obj_get_lenient_test_obj_attr(self));
         break;
@@ -657,6 +661,16 @@
 
     g_object_class_install_property(
         gobjectClass,
+        PROP_TEST_NULLABLE_OBJ_ATTR,
+        g_param_spec_object(
+            "test-nullable-obj-attr",
+            "TestObj:test-nullable-obj-attr",
+            "read-only WebKitDOMTestObj* TestObj:test-nullable-obj-attr",
+            WEBKIT_DOM_TYPE_TEST_OBJ,
+            WEBKIT_PARAM_READABLE));
+
+    g_object_class_install_property(
+        gobjectClass,
         PROP_LENIENT_TEST_OBJ_ATTR,
         g_param_spec_object(
             "lenient-test-obj-attr",
@@ -2202,9 +2216,28 @@
     g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(value));
     WebCore::TestObj* item = WebKit::core(self);
     WebCore::TestObj* convertedValue = WebKit::core(value);
-    item->setTestObjAttr(convertedValue);
+    item->setTestObjAttr(*convertedValue);
 }
 
+WebKitDOMTestObj* webkit_dom_test_obj_get_test_nullable_obj_attr(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->testNullableObjAttr());
+    return WebKit::kit(gobjectResult.get());
+}
+
+void webkit_dom_test_obj_set_test_nullable_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(value));
+    WebCore::TestObj* item = WebKit::core(self);
+    WebCore::TestObj* convertedValue = WebKit::core(value);
+    item->setTestNullableObjAttr(convertedValue);
+}
+
 WebKitDOMTestObj* webkit_dom_test_obj_get_lenient_test_obj_attr(WebKitDOMTestObj* self)
 {
     WebCore::JSMainThreadNullState state;
@@ -2221,7 +2254,7 @@
     g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(value));
     WebCore::TestObj* item = WebKit::core(self);
     WebCore::TestObj* convertedValue = WebKit::core(value);
-    item->setLenientTestObjAttr(convertedValue);
+    item->setLenientTestObjAttr(*convertedValue);
 }
 
 gchar* webkit_dom_test_obj_get_unforgeable_attr(WebKitDOMTestObj* self)
@@ -2268,7 +2301,7 @@
     g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(value));
     WebCore::TestObj* item = WebKit::core(self);
     WebCore::TestObj* convertedValue = WebKit::core(value);
-    item->setXMLObjAttr(convertedValue);
+    item->setXMLObjAttr(*convertedValue);
 }
 
 gboolean webkit_dom_test_obj_get_create(WebKitDOMTestObj* self)
@@ -2622,7 +2655,7 @@
     g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(value));
     WebCore::TestObj* item = WebKit::core(self);
     WebCore::TestObj* convertedValue = WebKit::core(value);
-    item->setStrictTypeCheckingAttribute(convertedValue);
+    item->setStrictTypeCheckingAttribute(*convertedValue);
 }
 
 glong webkit_dom_test_obj_get_with_script_state_attribute(WebKitDOMTestObj* self)

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


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-05-02 04:21:19 UTC (rev 200316)
@@ -1177,6 +1177,27 @@
 webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value);
 
 /**
+ * webkit_dom_test_obj_get_test_nullable_obj_attr:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: (transfer none): A #WebKitDOMTestObj
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API WebKitDOMTestObj*
+webkit_dom_test_obj_get_test_nullable_obj_attr(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_set_test_nullable_obj_attr:
+ * @self: A #WebKitDOMTestObj
+ * @value: A #WebKitDOMTestObj
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_set_test_nullable_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value);
+
+/**
  * webkit_dom_test_obj_get_lenient_test_obj_attr:
  * @self: A #WebKitDOMTestObj
  *

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (200315 => 200316)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -686,7 +686,11 @@
     Node* nativeValue = JSNode::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setImplementsNode(nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setImplementsNode(*nativeValue);
     return true;
 }
 
@@ -752,7 +756,11 @@
     Node* nativeValue = JSNode::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    WebCore::TestSupplemental::setSupplementalNode(impl, nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    WebCore::TestSupplemental::setSupplementalNode(impl, *nativeValue);
     return true;
 }
 

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -430,6 +430,8 @@
 bool setJSTestObjStringAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 bool setJSTestObjTestObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjTestNullableObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjTestNullableObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjLenientTestObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 bool setJSTestObjLenientTestObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjUnforgeableAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -743,6 +745,7 @@
     { "unsignedLongLongAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjUnsignedLongLongAttr) } },
     { "stringAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringAttr) } },
     { "testObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTestObjAttr) } },
+    { "testNullableObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestNullableObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTestNullableObjAttr) } },
     { "lenientTestObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLenientTestObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjLenientTestObjAttr) } },
     { "stringAttrTreatingNullAsEmptyString", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrTreatingNullAsEmptyString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringAttrTreatingNullAsEmptyString) } },
     { "XMLObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjXMLObjAttr) } },
@@ -1329,6 +1332,21 @@
 }
 
 
+EncodedJSValue jsTestObjTestNullableObjAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(thisValue);
+    JSValue decodedThisValue = JSValue::decode(thisValue);
+    auto* castedThis = jsDynamicCast<JSTestObj*>(decodedThisValue);
+    if (UNLIKELY(!castedThis)) {
+        return throwGetterTypeError(*state, "TestObj", "testNullableObjAttr");
+    }
+    auto& impl = castedThis->wrapped();
+    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.testNullableObjAttr()));
+    return JSValue::encode(result);
+}
+
+
 EncodedJSValue jsTestObjLenientTestObjAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
 {
     UNUSED_PARAM(state);
@@ -2572,11 +2590,32 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setTestObjAttr(nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setTestObjAttr(*nativeValue);
     return true;
 }
 
 
+bool setJSTestObjTestNullableObjAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    JSValue value = JSValue::decode(encodedValue);
+    UNUSED_PARAM(thisValue);
+    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!castedThis)) {
+        return throwSetterTypeError(*state, "TestObj", "testNullableObjAttr");
+    }
+    auto& impl = castedThis->wrapped();
+    TestObj* nativeValue = JSTestObj::toWrapped(value);
+    if (UNLIKELY(state->hadException()))
+        return false;
+    impl.setTestNullableObjAttr(nativeValue);
+    return true;
+}
+
+
 bool setJSTestObjLenientTestObjAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
 {
     JSValue value = JSValue::decode(encodedValue);
@@ -2589,7 +2628,11 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setLenientTestObjAttr(nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setLenientTestObjAttr(*nativeValue);
     return true;
 }
 
@@ -2623,7 +2666,11 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setXMLObjAttr(nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setXMLObjAttr(*nativeValue);
     return true;
 }
 
@@ -2829,6 +2876,10 @@
     RefPtr<Float32Array> nativeValue = toFloat32Array(value);
     if (UNLIKELY(state->hadException()))
         return false;
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
     impl.setTypedArrayAttr(nativeValue.get());
     return true;
 }
@@ -2958,7 +3009,11 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setStrictTypeCheckingAttribute(nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setStrictTypeCheckingAttribute(*nativeValue);
     return true;
 }
 
@@ -3048,10 +3103,14 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     if (!context)
         return false;
-    impl.setWithScriptExecutionContextAttribute(*context, nativeValue);
+    impl.setWithScriptExecutionContextAttribute(*context, *nativeValue);
     return true;
 }
 
@@ -3068,7 +3127,11 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setWithScriptStateAttributeRaises(*state, nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setWithScriptStateAttributeRaises(*state, *nativeValue);
     return true;
 }
 
@@ -3085,10 +3148,14 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     if (!context)
         return false;
-    impl.setWithScriptExecutionContextAttributeRaises(*context, nativeValue);
+    impl.setWithScriptExecutionContextAttributeRaises(*context, *nativeValue);
     return true;
 }
 
@@ -3105,10 +3172,14 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     if (!context)
         return false;
-    impl.setWithScriptExecutionContextAndScriptStateAttribute(*state, *context, nativeValue);
+    impl.setWithScriptExecutionContextAndScriptStateAttribute(*state, *context, *nativeValue);
     return true;
 }
 
@@ -3125,10 +3196,14 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     if (!context)
         return false;
-    impl.setWithScriptExecutionContextAndScriptStateAttributeRaises(*state, *context, nativeValue);
+    impl.setWithScriptExecutionContextAndScriptStateAttributeRaises(*state, *context, *nativeValue);
     return true;
 }
 
@@ -3145,10 +3220,14 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
     auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     if (!context)
         return false;
-    impl.setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(*state, *context, nativeValue);
+    impl.setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(*state, *context, *nativeValue);
     return true;
 }
 
@@ -3165,7 +3244,11 @@
     TestObj* nativeValue = JSTestObj::toWrapped(value);
     if (UNLIKELY(state->hadException()))
         return false;
-    impl.setWithScriptArgumentsAndCallStackAttribute(nativeValue);
+    if (UNLIKELY(!nativeValue)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    impl.setWithScriptArgumentsAndCallStackAttribute(*nativeValue);
     return true;
 }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm (200315 => 200316)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm	2016-05-02 04:21:19 UTC (rev 200316)
@@ -109,7 +109,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newImplementsNode);
 
-    IMPL->setImplementsNode(core(newImplementsNode));
+    if (!core(newImplementsNode))
+        WebCore::raiseTypeErrorException();
+    IMPL->setImplementsNode(*core(newImplementsNode));
 }
 #endif
 
@@ -161,7 +163,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newSupplementalNode);
 
-    WebCore::TestSupplemental::setSupplementalNode(*IMPL, core(newSupplementalNode));
+    if (!core(newSupplementalNode))
+        WebCore::raiseTypeErrorException();
+    WebCore::TestSupplemental::setSupplementalNode(*IMPL, *core(newSupplementalNode));
 }
 #endif
 

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


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-05-02 04:21:19 UTC (rev 200316)
@@ -75,6 +75,7 @@
 @property unsigned long long unsignedLongLongAttr;
 @property (copy) NSString *stringAttr;
 @property (strong) DOMTestObj *testObjAttr;
+@property (strong) DOMTestObj *testNullableObjAttr;
 @property (strong) DOMTestObj *lenientTestObjAttr;
 @property (readonly, copy) NSString *unforgeableAttr;
 @property (copy) NSString *stringAttrTreatingNullAsEmptyString;

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


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-05-02 04:21:19 UTC (rev 200316)
@@ -112,7 +112,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newTestSubObjEnabledBySetting);
 
-    IMPL->setTestSubObjEnabledBySetting(core(newTestSubObjEnabledBySetting));
+    if (!core(newTestSubObjEnabledBySetting))
+        WebCore::raiseTypeErrorException();
+    IMPL->setTestSubObjEnabledBySetting(*core(newTestSubObjEnabledBySetting));
 }
 
 - (char)byteAttr
@@ -246,9 +248,25 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newTestObjAttr);
 
-    IMPL->setTestObjAttr(core(newTestObjAttr));
+    if (!core(newTestObjAttr))
+        WebCore::raiseTypeErrorException();
+    IMPL->setTestObjAttr(*core(newTestObjAttr));
 }
 
+- (DOMTestObj *)testNullableObjAttr
+{
+    WebCore::JSMainThreadNullState state;
+    return kit(WTF::getPtr(IMPL->testNullableObjAttr()));
+}
+
+- (void)setTestNullableObjAttr:(DOMTestObj *)newTestNullableObjAttr
+{
+    WebCore::JSMainThreadNullState state;
+    ASSERT(newTestNullableObjAttr);
+
+    IMPL->setTestNullableObjAttr(core(newTestNullableObjAttr));
+}
+
 - (DOMTestObj *)lenientTestObjAttr
 {
     WebCore::JSMainThreadNullState state;
@@ -260,7 +278,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newLenientTestObjAttr);
 
-    IMPL->setLenientTestObjAttr(core(newLenientTestObjAttr));
+    if (!core(newLenientTestObjAttr))
+        WebCore::raiseTypeErrorException();
+    IMPL->setLenientTestObjAttr(*core(newLenientTestObjAttr));
 }
 
 - (NSString *)unforgeableAttr
@@ -292,7 +312,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newXMLObjAttr);
 
-    IMPL->setXMLObjAttr(core(newXMLObjAttr));
+    if (!core(newXMLObjAttr))
+        WebCore::raiseTypeErrorException();
+    IMPL->setXMLObjAttr(*core(newXMLObjAttr));
 }
 
 - (BOOL)create
@@ -522,7 +544,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newStrictTypeCheckingAttribute);
 
-    IMPL->setStrictTypeCheckingAttribute(core(newStrictTypeCheckingAttribute));
+    if (!core(newStrictTypeCheckingAttribute))
+        WebCore::raiseTypeErrorException();
+    IMPL->setStrictTypeCheckingAttribute(*core(newStrictTypeCheckingAttribute));
 }
 
 - (int)customAttr
@@ -549,7 +573,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newJsBuiltinAttribute);
 
-    IMPL->setJsBuiltinAttribute(core(newJsBuiltinAttribute));
+    if (!core(newJsBuiltinAttribute))
+        WebCore::raiseTypeErrorException();
+    IMPL->setJsBuiltinAttribute(*core(newJsBuiltinAttribute));
 }
 #endif
 
@@ -596,7 +622,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptExecutionContextAttribute);
 
-    IMPL->setWithScriptExecutionContextAttribute(core(newWithScriptExecutionContextAttribute));
+    if (!core(newWithScriptExecutionContextAttribute))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptExecutionContextAttribute(*core(newWithScriptExecutionContextAttribute));
 }
 
 - (DOMTestObj *)withScriptStateAttributeRaises
@@ -613,7 +641,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptStateAttributeRaises);
 
-    IMPL->setWithScriptStateAttributeRaises(core(newWithScriptStateAttributeRaises));
+    if (!core(newWithScriptStateAttributeRaises))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptStateAttributeRaises(*core(newWithScriptStateAttributeRaises));
 }
 
 - (DOMTestObj *)withScriptExecutionContextAttributeRaises
@@ -630,7 +660,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptExecutionContextAttributeRaises);
 
-    IMPL->setWithScriptExecutionContextAttributeRaises(core(newWithScriptExecutionContextAttributeRaises));
+    if (!core(newWithScriptExecutionContextAttributeRaises))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptExecutionContextAttributeRaises(*core(newWithScriptExecutionContextAttributeRaises));
 }
 
 - (DOMTestObj *)withScriptExecutionContextAndScriptStateAttribute
@@ -644,7 +676,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptExecutionContextAndScriptStateAttribute);
 
-    IMPL->setWithScriptExecutionContextAndScriptStateAttribute(core(newWithScriptExecutionContextAndScriptStateAttribute));
+    if (!core(newWithScriptExecutionContextAndScriptStateAttribute))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptExecutionContextAndScriptStateAttribute(*core(newWithScriptExecutionContextAndScriptStateAttribute));
 }
 
 - (DOMTestObj *)withScriptExecutionContextAndScriptStateAttributeRaises
@@ -661,7 +695,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptExecutionContextAndScriptStateAttributeRaises);
 
-    IMPL->setWithScriptExecutionContextAndScriptStateAttributeRaises(core(newWithScriptExecutionContextAndScriptStateAttributeRaises));
+    if (!core(newWithScriptExecutionContextAndScriptStateAttributeRaises))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptExecutionContextAndScriptStateAttributeRaises(*core(newWithScriptExecutionContextAndScriptStateAttributeRaises));
 }
 
 - (DOMTestObj *)withScriptExecutionContextAndScriptStateWithSpacesAttribute
@@ -675,7 +711,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptExecutionContextAndScriptStateWithSpacesAttribute);
 
-    IMPL->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(core(newWithScriptExecutionContextAndScriptStateWithSpacesAttribute));
+    if (!core(newWithScriptExecutionContextAndScriptStateWithSpacesAttribute))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(*core(newWithScriptExecutionContextAndScriptStateWithSpacesAttribute));
 }
 
 - (DOMTestObj *)withScriptArgumentsAndCallStackAttribute
@@ -689,7 +727,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newWithScriptArgumentsAndCallStackAttribute);
 
-    IMPL->setWithScriptArgumentsAndCallStackAttribute(core(newWithScriptArgumentsAndCallStackAttribute));
+    if (!core(newWithScriptArgumentsAndCallStackAttribute))
+        WebCore::raiseTypeErrorException();
+    IMPL->setWithScriptArgumentsAndCallStackAttribute(*core(newWithScriptArgumentsAndCallStackAttribute));
 }
 
 #if ENABLE(Condition1)
@@ -746,7 +786,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newConditionalAttr4);
 
-    IMPL->setConditionalAttr4(core(newConditionalAttr4));
+    if (!core(newConditionalAttr4))
+        WebCore::raiseTypeErrorException();
+    IMPL->setConditionalAttr4(*core(newConditionalAttr4));
 }
 #endif
 
@@ -762,7 +804,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newConditionalAttr5);
 
-    IMPL->setConditionalAttr5(core(newConditionalAttr5));
+    if (!core(newConditionalAttr5))
+        WebCore::raiseTypeErrorException();
+    IMPL->setConditionalAttr5(*core(newConditionalAttr5));
 }
 #endif
 
@@ -778,7 +822,9 @@
     WebCore::JSMainThreadNullState state;
     ASSERT(newConditionalAttr6);
 
-    IMPL->setConditionalAttr6(core(newConditionalAttr6));
+    if (!core(newConditionalAttr6))
+        WebCore::raiseTypeErrorException();
+    IMPL->setConditionalAttr6(*core(newConditionalAttr6));
 }
 #endif
 

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


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -63,6 +63,7 @@
     attribute unsigned long long       unsignedLongLongAttr;
     attribute DOMString                stringAttr;
     attribute TestObj                  testObjAttr;
+    attribute TestObj?                 testNullableObjAttr;
     [LenientThis] attribute TestObj    lenientTestObjAttr;
     [Unforgeable] readonly attribute DOMString unforgeableAttr;
     [TreatNullAs=EmptyString] attribute DOMString stringAttrTreatingNullAsEmptyString;

Modified: trunk/Source/WebCore/dom/Document.cpp (200315 => 200316)


--- trunk/Source/WebCore/dom/Document.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -3964,7 +3964,7 @@
     Vector<NodeIterator*> nodeIterators;
     copyToVector(m_nodeIterators, nodeIterators);
     for (auto* it : nodeIterators) {
-        if (it->root() == node) {
+        if (&it->root() == node) {
             detachNodeIterator(it);
             newDocument->attachNodeIterator(it);
         }

Modified: trunk/Source/WebCore/dom/NodeIterator.cpp (200315 => 200316)


--- trunk/Source/WebCore/dom/NodeIterator.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/NodeIterator.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -33,22 +33,18 @@
 
 namespace WebCore {
 
-NodeIterator::NodePointer::NodePointer()
+NodeIterator::NodePointer::NodePointer(Node& node, bool isPointerBeforeNode)
+    : node(&node)
+    , isPointerBeforeNode(isPointerBeforeNode)
 {
 }
 
-NodeIterator::NodePointer::NodePointer(Node* n, bool b)
-    : node(n)
-    , isPointerBeforeNode(b)
-{
-}
-
 void NodeIterator::NodePointer::clear()
 {
     node = nullptr;
 }
 
-bool NodeIterator::NodePointer::moveToNext(Node* root)
+bool NodeIterator::NodePointer::moveToNext(Node& root)
 {
     if (!node)
         return false;
@@ -56,11 +52,11 @@
         isPointerBeforeNode = false;
         return true;
     }
-    node = NodeTraversal::next(*node, root);
+    node = NodeTraversal::next(*node, &root);
     return node;
 }
 
-bool NodeIterator::NodePointer::moveToPrevious(Node* root)
+bool NodeIterator::NodePointer::moveToPrevious(Node& root)
 {
     if (!node)
         return false;
@@ -68,7 +64,7 @@
         isPointerBeforeNode = true;
         return true;
     }
-    if (node == root) {
+    if (node == &root) {
         node = nullptr;
         return false;
     }
@@ -80,12 +76,12 @@
     : NodeIteratorBase(rootNode, whatToShow, WTFMove(filter))
     , m_referenceNode(root(), true)
 {
-    root()->document().attachNodeIterator(this);
+    root().document().attachNodeIterator(this);
 }
 
 NodeIterator::~NodeIterator()
 {
-    root()->document().detachNodeIterator(this);
+    root().document().detachNodeIterator(this);
 }
 
 RefPtr<Node> NodeIterator::nextNode()
@@ -145,11 +141,11 @@
 
 void NodeIterator::updateForNodeRemoval(Node& removedNode, NodePointer& referenceNode) const
 {
-    ASSERT(&root()->document() == &removedNode.document());
+    ASSERT(&root().document() == &removedNode.document());
 
     // Iterator is not affected if the removed node is the reference node and is the root.
     // or if removed node is not the reference node, or the ancestor of the reference node.
-    if (!removedNode.isDescendantOf(root()))
+    if (!removedNode.isDescendantOf(&root()))
         return;
     bool willRemoveReferenceNode = &removedNode == referenceNode.node;
     bool willRemoveReferenceNodeAncestor = referenceNode.node && referenceNode.node->isDescendantOf(&removedNode);
@@ -157,12 +153,12 @@
         return;
 
     if (referenceNode.isPointerBeforeNode) {
-        Node* node = NodeTraversal::next(removedNode, root());
+        Node* node = NodeTraversal::next(removedNode, &root());
         if (node) {
             // Move out from under the node being removed if the new reference
             // node is a descendant of the node being removed.
             while (node && node->isDescendantOf(&removedNode))
-                node = NodeTraversal::next(*node, root());
+                node = NodeTraversal::next(*node, &root());
             if (node)
                 referenceNode.node = node;
         } else {
@@ -196,7 +192,7 @@
                 referenceNode.node = node;
         } else {
             // FIXME: This branch doesn't appear to have any LayoutTests.
-            node = NodeTraversal::next(removedNode, root());
+            node = NodeTraversal::next(removedNode, &root());
             // Move out from under the node being removed if the reference node is
             // a descendant of the node being removed.
             if (willRemoveReferenceNodeAncestor) {

Modified: trunk/Source/WebCore/dom/NodeIterator.h (200315 => 200316)


--- trunk/Source/WebCore/dom/NodeIterator.h	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/NodeIterator.h	2016-05-02 04:21:19 UTC (rev 200316)
@@ -57,12 +57,14 @@
 
         struct NodePointer {
             RefPtr<Node> node;
-            bool isPointerBeforeNode;
-            NodePointer();
-            NodePointer(Node*, bool);
+            bool isPointerBeforeNode { true };
+
+            NodePointer() = default;
+            NodePointer(Node&, bool);
+
             void clear();
-            bool moveToNext(Node* root);
-            bool moveToPrevious(Node* root);
+            bool moveToNext(Node& root);
+            bool moveToPrevious(Node& root);
         };
 
         void updateForNodeRemoval(Node& nodeToBeRemoved, NodePointer&) const;

Modified: trunk/Source/WebCore/dom/Traversal.cpp (200315 => 200316)


--- trunk/Source/WebCore/dom/Traversal.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/Traversal.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -31,7 +31,7 @@
 namespace WebCore {
 
 NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned whatToShow, RefPtr<NodeFilter>&& nodeFilter)
-    : m_root(&rootNode)
+    : m_root(rootNode)
     , m_whatToShow(whatToShow)
     , m_filter(WTFMove(nodeFilter))
 {

Modified: trunk/Source/WebCore/dom/Traversal.h (200315 => 200316)


--- trunk/Source/WebCore/dom/Traversal.h	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/Traversal.h	2016-05-02 04:21:19 UTC (rev 200316)
@@ -33,7 +33,9 @@
 
 class NodeIteratorBase {
 public:
-    Node* root() const { return m_root.get(); }
+    Node& root() { return m_root.get(); }
+    const Node& root() const { return m_root.get(); }
+
     unsigned whatToShow() const { return m_whatToShow; }
     NodeFilter* filter() const { return m_filter.get(); }
     bool expandEntityReferences() const { return false; }
@@ -43,7 +45,7 @@
     short acceptNode(Node*) const;
 
 private:
-    RefPtr<Node> m_root;
+    Ref<Node> m_root;
     unsigned m_whatToShow;
     RefPtr<NodeFilter> m_filter;
 };

Modified: trunk/Source/WebCore/dom/TreeWalker.cpp (200315 => 200316)


--- trunk/Source/WebCore/dom/TreeWalker.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/TreeWalker.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -39,31 +39,27 @@
 {
 }
 
-void TreeWalker::setCurrentNode(Node* node, ExceptionCode& ec)
+void TreeWalker::setCurrentNode(Node& node)
 {
-    if (!node) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
     m_current = node;
 }
 
-inline Node* TreeWalker::setCurrent(RefPtr<Node>&& node)
+inline Node* TreeWalker::setCurrent(Ref<Node>&& node)
 {
-    m_current = node;
-    return m_current.get();
+    m_current = WTFMove(node);
+    return m_current.ptr();
 }
 
 Node* TreeWalker::parentNode()
 {
-    RefPtr<Node> node = m_current;
-    while (node != root()) {
+    RefPtr<Node> node = m_current.ptr();
+    while (node != &root()) {
         node = node->parentNode();
         if (!node)
             return nullptr;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(WTFMove(node));
+            return setCurrent(node.releaseNonNull());
     }
     return nullptr;
 }
@@ -74,8 +70,8 @@
         short acceptNodeResult = acceptNode(node.get());
         switch (acceptNodeResult) {
             case NodeFilter::FILTER_ACCEPT:
-                m_current = node.release();
-                return m_current.get();
+                m_current = node.releaseNonNull();
+                return m_current.ptr();
             case NodeFilter::FILTER_SKIP:
                 if (node->firstChild()) {
                     node = node->firstChild();
@@ -91,7 +87,7 @@
                 break;
             }
             ContainerNode* parent = node->parentNode();
-            if (!parent || parent == root() || parent == m_current)
+            if (!parent || parent == &root() || parent == m_current.ptr())
                 return nullptr;
             node = parent;
         } while (node);
@@ -105,8 +101,8 @@
         short acceptNodeResult = acceptNode(node.get());
         switch (acceptNodeResult) {
             case NodeFilter::FILTER_ACCEPT:
-                m_current = node.release();
-                return m_current.get();
+                m_current = node.releaseNonNull();
+                return m_current.ptr();
             case NodeFilter::FILTER_SKIP:
                 if (node->lastChild()) {
                     node = node->lastChild();
@@ -122,7 +118,7 @@
                 break;
             }
             ContainerNode* parent = node->parentNode();
-            if (!parent || parent == root() || parent == m_current)
+            if (!parent || parent == &root() || parent == m_current.ptr())
                 return nullptr;
             node = parent;
         } while (node);
@@ -132,8 +128,8 @@
 
 template<TreeWalker::SiblingTraversalType type> Node* TreeWalker::traverseSiblings()
 {
-    RefPtr<Node> node = m_current;
-    if (node == root())
+    RefPtr<Node> node = m_current.ptr();
+    if (node == &root())
         return nullptr;
 
     auto isNext = type == SiblingTraversalType::Next;
@@ -141,8 +137,8 @@
         for (RefPtr<Node> sibling = isNext ? node->nextSibling() : node->previousSibling(); sibling; ) {
             short acceptNodeResult = acceptNode(sibling.get());
             if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) {
-                m_current = WTFMove(sibling);
-                return m_current.get();
+                m_current = sibling.releaseNonNull();
+                return m_current.ptr();
             }
             node = sibling;
             sibling = isNext ? sibling->firstChild() : sibling->lastChild();
@@ -150,7 +146,7 @@
                 sibling = isNext ? node->nextSibling() : node->previousSibling();
         }
         node = node->parentNode();
-        if (!node || node == root())
+        if (!node || node == &root())
             return nullptr;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
@@ -170,8 +166,8 @@
 
 Node* TreeWalker::previousNode()
 {
-    RefPtr<Node> node = m_current;
-    while (node != root()) {
+    RefPtr<Node> node = m_current.ptr();
+    while (node != &root()) {
         while (Node* previousSibling = node->previousSibling()) {
             node = previousSibling;
             short acceptNodeResult = acceptNode(node.get());
@@ -184,11 +180,11 @@
                     break;
             }
             if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) {
-                m_current = node.release();
-                return m_current.get();
+                m_current = node.releaseNonNull();
+                return m_current.ptr();
             }
         }
-        if (node == root())
+        if (node == &root())
             return nullptr;
         ContainerNode* parent = node->parentNode();
         if (!parent)
@@ -196,28 +192,28 @@
         node = parent;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(WTFMove(node));
+            return setCurrent(node.releaseNonNull());
     }
     return nullptr;
 }
 
 Node* TreeWalker::nextNode()
 {
-    RefPtr<Node> node = m_current;
+    RefPtr<Node> node = m_current.ptr();
 Children:
     while (Node* firstChild = node->firstChild()) {
         node = firstChild;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(WTFMove(node));
+            return setCurrent(node.releaseNonNull());
         if (acceptNodeResult == NodeFilter::FILTER_REJECT)
             break;
     }
-    while (Node* nextSibling = NodeTraversal::nextSkippingChildren(*node, root())) {
+    while (Node* nextSibling = NodeTraversal::nextSkippingChildren(*node, &root())) {
         node = nextSibling;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(WTFMove(node));
+            return setCurrent(node.releaseNonNull());
         if (acceptNodeResult == NodeFilter::FILTER_SKIP)
             goto Children;
     }

Modified: trunk/Source/WebCore/dom/TreeWalker.h (200315 => 200316)


--- trunk/Source/WebCore/dom/TreeWalker.h	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/TreeWalker.h	2016-05-02 04:21:19 UTC (rev 200316)
@@ -41,9 +41,11 @@
             return adoptRef(*new TreeWalker(rootNode, whatToShow, WTFMove(filter)));
         }                            
 
-        Node* currentNode() const { return m_current.get(); }
-        void setCurrentNode(Node*, ExceptionCode&);
+        Node& currentNode() { return m_current.get(); }
+        const Node& currentNode() const { return m_current.get(); }
 
+        void setCurrentNode(Node&);
+
         Node* parentNode();
         Node* firstChild();
         Node* lastChild();
@@ -57,9 +59,9 @@
         enum class SiblingTraversalType { Previous, Next };
         template<SiblingTraversalType> Node* traverseSiblings();
         
-        Node* setCurrent(RefPtr<Node>&&);
+        Node* setCurrent(Ref<Node>&&);
 
-        RefPtr<Node> m_current;
+        Ref<Node> m_current;
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/TreeWalker.idl (200315 => 200316)


--- trunk/Source/WebCore/dom/TreeWalker.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/dom/TreeWalker.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -29,7 +29,7 @@
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     readonly attribute boolean expandEntityReferences;
 #endif
-    [SetterRaisesException] attribute Node currentNode;
+    attribute Node currentNode;
 
     Node parentNode();
     Node firstChild();

Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.idl (200315 => 200316)


--- trunk/Source/WebCore/html/HTMLAttachmentElement.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -26,5 +26,5 @@
 [
     Conditional=ATTACHMENT_ELEMENT
 ] interface HTMLAttachmentElement : HTMLElement {
-    attribute File file;
+    attribute File? file;
 };

Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (200315 => 200316)


--- trunk/Source/WebCore/html/HTMLInputElement.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -32,7 +32,7 @@
     [Reflect] attribute DOMString dirName;
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
-    attribute FileList files;
+    attribute FileList? files;
     attribute DOMString formAction;
 
     // FIXME: These should not use [TreatNullAs=LegacyNullString].

Modified: trunk/Source/WebCore/html/HTMLTableElement.idl (200315 => 200316)


--- trunk/Source/WebCore/html/HTMLTableElement.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/html/HTMLTableElement.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -19,9 +19,9 @@
  */
 
 interface HTMLTableElement : HTMLElement {
-    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableCaptionElement caption;
-    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableSectionElement tHead;
-    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableSectionElement tFoot;
+    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableCaptionElement? caption;
+    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableSectionElement? tHead;
+    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableSectionElement? tFoot;
 
     readonly attribute HTMLCollection rows;
     readonly attribute HTMLCollection tBodies;

Modified: trunk/Source/WebCore/html/track/DataCue.cpp (200315 => 200316)


--- trunk/Source/WebCore/html/track/DataCue.cpp	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/html/track/DataCue.cpp	2016-05-02 04:21:19 UTC (rev 200316)
@@ -36,11 +36,11 @@
 
 namespace WebCore {
 
-DataCue::DataCue(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, ArrayBuffer* data, const String& type, ExceptionCode& ec)
+DataCue::DataCue(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, ArrayBuffer& data, const String& type)
     : TextTrackCue(context, start, end)
     , m_type(type)
 {
-    setData(data, ec);
+    setData(data);
 }
 
 DataCue::DataCue(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, const void* data, unsigned length)
@@ -88,13 +88,8 @@
     return ArrayBuffer::create(*m_data);
 }
 
-void DataCue::setData(ArrayBuffer* data, ExceptionCode& ec)
+void DataCue::setData(ArrayBuffer& data)
 {
-    if (!data) {
-        ec = TypeError;
-        return;
-    }
-
 #if ENABLE(DATACUE_VALUE)
     m_platformValue = nullptr;
     if (m_value)
@@ -102,7 +97,7 @@
     m_value = JSC::JSValue();
 #endif
 
-    m_data = ArrayBuffer::create(*data);
+    m_data = ArrayBuffer::create(data);
 }
 
 DataCue* toDataCue(TextTrackCue* cue)

Modified: trunk/Source/WebCore/html/track/DataCue.h (200315 => 200316)


--- trunk/Source/WebCore/html/track/DataCue.h	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/html/track/DataCue.h	2016-05-02 04:21:19 UTC (rev 200316)
@@ -45,9 +45,9 @@
 
 class DataCue final : public TextTrackCue {
 public:
-    static Ref<DataCue> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, ArrayBuffer* data, ExceptionCode& ec)
+    static Ref<DataCue> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, ArrayBuffer& data)
     {
-        return adoptRef(*new DataCue(context, start, end, data, emptyString(), ec));
+        return adoptRef(*new DataCue(context, start, end, data, emptyString()));
     }
 
     static Ref<DataCue> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, const void* data, unsigned length)
@@ -55,9 +55,9 @@
         return adoptRef(*new DataCue(context, start, end, data, length));
     }
 
-    static Ref<DataCue> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, ArrayBuffer* data, const String& type, ExceptionCode& ec)
+    static Ref<DataCue> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, ArrayBuffer& data, const String& type)
     {
-        return adoptRef(*new DataCue(context, start, end, data, type, ec));
+        return adoptRef(*new DataCue(context, start, end, data, type));
     }
 
 #if ENABLE(DATACUE_VALUE)
@@ -76,7 +76,7 @@
     CueType cueType() const override { return Data; }
 
     RefPtr<ArrayBuffer> data() const;
-    void setData(ArrayBuffer*, ExceptionCode&);
+    void setData(ArrayBuffer&);
 
 #if ENABLE(DATACUE_VALUE)
     const SerializedPlatformRepresentation* platformValue() const { return m_platformValue.get(); }
@@ -93,7 +93,7 @@
     bool doesExtendCue(const TextTrackCue&) const override;
 
 protected:
-    DataCue(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, ArrayBuffer*, const String&, ExceptionCode&);
+    DataCue(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, ArrayBuffer&, const String&);
     DataCue(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, const void*, unsigned);
 #if ENABLE(DATACUE_VALUE)
     DataCue(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, RefPtr<SerializedPlatformRepresentation>&&, const String&);

Modified: trunk/Source/WebCore/html/track/DataCue.idl (200315 => 200316)


--- trunk/Source/WebCore/html/track/DataCue.idl	2016-05-02 00:32:56 UTC (rev 200315)
+++ trunk/Source/WebCore/html/track/DataCue.idl	2016-05-02 04:21:19 UTC (rev 200316)
@@ -34,7 +34,7 @@
 #endif
     ConstructorRaisesException,
 ] interface DataCue : TextTrackCue {
-    [SetterRaisesException] attribute ArrayBuffer data;
+    attribute ArrayBuffer data;
 
 #if defined(ENABLE_DATACUE_VALUE) && ENABLE_DATACUE_VALUE
     [CustomGetter, CustomSetter] attribute any value;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to