Skip to content
Permalink
Browse files
Drop [UsePointersEvenForNonNullableObjectArguments] from Document
https://bugs.webkit.org/show_bug.cgi?id=156881

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

Drop [UsePointersEvenForNonNullableObjectArguments] from Document. There
is no major Web-exposed behavior change but the type of the exception
being thrown when passing null or not enough parameters has changed for
some of the API (It is now always a TypeError as per the Web IDL
specification).

Tests: fast/dom/Document/adoptNode-null.html
       fast/dom/Document/importNode-null.html

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::takeAllChildrenFrom):
(WebCore::ContainerNode::parserInsertBefore):
(WebCore::ContainerNode::parserAppendChild):
* dom/Document.cpp:
(WebCore::Document::importNode):
(WebCore::Document::adoptNode):
(WebCore::Document::createNodeIterator):
(WebCore::Document::createTreeWalker):
(WebCore::Document::setBodyOrFrameset):
(WebCore::Document::hasValidNamespaceForElements): Deleted.
(WebCore::Document::scheduleForcedStyleRecalc): Deleted.
(WebCore::Document::scheduleStyleRecalc): Deleted.
(WebCore::Document::unscheduleStyleRecalc): Deleted.
(WebCore::Document::hasPendingStyleRecalc): Deleted.
(WebCore::Document::hasPendingForcedStyleRecalc): Deleted.
(WebCore::Document::recalcStyle): Deleted.
(WebCore::Document::explicitClose): Deleted.
* dom/Document.h:
(WebCore::Document::importNode):
* dom/Document.idl:
* dom/NodeIterator.cpp:
(WebCore::NodeIterator::NodeIterator):
* dom/NodeIterator.h:
(WebCore::NodeIterator::create):

LayoutTests:

Add test cases for cases where the type of the exception being thrown
has changed.

* fast/dom/Document/adoptNode-null-expected.txt: Added.
* fast/dom/Document/adoptNode-null.html: Added.
* fast/dom/Document/importNode-null-expected.txt: Added.
* fast/dom/Document/importNode-null.html: Added.
* fast/dom/importNode-null-expected.txt: Removed.
* fast/dom/importNode-null.html: Removed.


Canonical link: https://commits.webkit.org/175001@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Apr 22, 2016
1 parent d80c287 commit a06636ba9eef8efc24f2ea3c596c2b847204e6e9
@@ -1,3 +1,20 @@
2016-04-21 Chris Dumez <cdumez@apple.com>

Drop [UsePointersEvenForNonNullableObjectArguments] from Document
https://bugs.webkit.org/show_bug.cgi?id=156881

Reviewed by Darin Adler.

Add test cases for cases where the type of the exception being thrown
has changed.

* fast/dom/Document/adoptNode-null-expected.txt: Added.
* fast/dom/Document/adoptNode-null.html: Added.
* fast/dom/Document/importNode-null-expected.txt: Added.
* fast/dom/Document/importNode-null.html: Added.
* fast/dom/importNode-null-expected.txt: Removed.
* fast/dom/importNode-null.html: Removed.

2016-04-21 Dean Jackson <dino@apple.com>

Backdrop Filter should not be visible if element has visibility:hidden
@@ -0,0 +1,11 @@
Tests that document.adoptNode(null) throws a TypeError

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS document.adoptNode(null) threw exception TypeError: Type error.
PASS document.adoptNode() threw exception TypeError: Not enough arguments.
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test-pre.js"></script>
<script>
description("Tests that document.adoptNode(null) throws a TypeError");

shouldThrow("document.adoptNode(null)", "'TypeError: Type error'");
shouldThrow("document.adoptNode()", "'TypeError: Not enough arguments'");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,11 @@
Tests that document.importNode(null) throws a TypeError

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS document.importNode(null) threw exception TypeError: Type error.
PASS document.importNode() threw exception TypeError: Not enough arguments.
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test-pre.js"></script>
<script>
description("Tests that document.importNode(null) throws a TypeError");

shouldThrow("document.importNode(null)", "'TypeError: Type error'");
shouldThrow("document.importNode()", "'TypeError: Not enough arguments'");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>

This file was deleted.

This file was deleted.

@@ -1,3 +1,15 @@
2016-04-21 Chris Dumez <cdumez@apple.com>

Drop [UsePointersEvenForNonNullableObjectArguments] from Document
https://bugs.webkit.org/show_bug.cgi?id=156881

Reviewed by Darin Adler.

Rebaseline now that more checks are passing.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/html/dom/interfaces-expected.txt:

2016-04-21 Youenn Fablet <youenn.fablet@crf.canon.fr>

[Fetch API] Improve some fetch response streams tests
@@ -262,8 +262,8 @@ PASS Document interface: operation createDocumentFragment()
FAIL Document interface: operation createTextNode(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation createComment(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation createProcessingInstruction(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL Document interface: operation importNode(Node,boolean) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation adoptNode(Node) assert_equals: property has wrong .length expected 1 but got 0
PASS Document interface: operation importNode(Node,boolean)
PASS Document interface: operation adoptNode(Node)
FAIL Document interface: operation createAttribute(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation createAttributeNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL Document interface: operation createEvent(DOMString) assert_equals: property has wrong .length expected 1 but got 0
@@ -331,13 +331,9 @@ FAIL Document interface: calling createProcessingInstruction(DOMString,DOMString
fn.apply(obj, args);
}" did not throw
PASS Document interface: xmlDoc must inherit property "importNode" with the proper type (20)
FAIL Document interface: calling importNode(Node,boolean) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling importNode(Node,boolean) on xmlDoc with too few arguments must throw TypeError
PASS Document interface: xmlDoc must inherit property "adoptNode" with the proper type (21)
FAIL Document interface: calling adoptNode(Node) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling adoptNode(Node) on xmlDoc with too few arguments must throw TypeError
PASS Document interface: xmlDoc must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -167,13 +167,9 @@ FAIL Document interface: calling createProcessingInstruction(DOMString,DOMString
fn.apply(obj, args);
}" did not throw
PASS Document interface: iframe.contentDocument must inherit property "importNode" with the proper type (20)
FAIL Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "adoptNode" with the proper type (21)
FAIL Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -482,13 +478,9 @@ FAIL Document interface: calling createProcessingInstruction(DOMString,DOMString
fn.apply(obj, args);
}" did not throw
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "importNode" with the proper type (20)
FAIL Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "adoptNode" with the proper type (21)
FAIL Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -167,13 +167,9 @@ FAIL Document interface: calling createProcessingInstruction(DOMString,DOMString
fn.apply(obj, args);
}" did not throw
PASS Document interface: iframe.contentDocument must inherit property "importNode" with the proper type (20)
FAIL Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "adoptNode" with the proper type (21)
FAIL Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -482,13 +478,9 @@ FAIL Document interface: calling createProcessingInstruction(DOMString,DOMString
fn.apply(obj, args);
}" did not throw
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "importNode" with the proper type (20)
FAIL Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "adoptNode" with the proper type (21)
FAIL Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
PASS Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -1,3 +1,45 @@
2016-04-21 Chris Dumez <cdumez@apple.com>

Drop [UsePointersEvenForNonNullableObjectArguments] from Document
https://bugs.webkit.org/show_bug.cgi?id=156881

Reviewed by Darin Adler.

Drop [UsePointersEvenForNonNullableObjectArguments] from Document. There
is no major Web-exposed behavior change but the type of the exception
being thrown when passing null or not enough parameters has changed for
some of the API (It is now always a TypeError as per the Web IDL
specification).

Tests: fast/dom/Document/adoptNode-null.html
fast/dom/Document/importNode-null.html

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::takeAllChildrenFrom):
(WebCore::ContainerNode::parserInsertBefore):
(WebCore::ContainerNode::parserAppendChild):
* dom/Document.cpp:
(WebCore::Document::importNode):
(WebCore::Document::adoptNode):
(WebCore::Document::createNodeIterator):
(WebCore::Document::createTreeWalker):
(WebCore::Document::setBodyOrFrameset):
(WebCore::Document::hasValidNamespaceForElements): Deleted.
(WebCore::Document::scheduleForcedStyleRecalc): Deleted.
(WebCore::Document::scheduleStyleRecalc): Deleted.
(WebCore::Document::unscheduleStyleRecalc): Deleted.
(WebCore::Document::hasPendingStyleRecalc): Deleted.
(WebCore::Document::hasPendingForcedStyleRecalc): Deleted.
(WebCore::Document::recalcStyle): Deleted.
(WebCore::Document::explicitClose): Deleted.
* dom/Document.h:
(WebCore::Document::importNode):
* dom/Document.idl:
* dom/NodeIterator.cpp:
(WebCore::NodeIterator::NodeIterator):
* dom/NodeIterator.h:
(WebCore::NodeIterator::create):

2016-04-21 Frederic Wang <fwang@igalia.com>

More improvements and explanations regarding resetting CSS properties on the <math> element
@@ -130,7 +130,7 @@ void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent)
destroyRenderTreeIfNeeded(child);

// FIXME: We need a no mutation event version of adoptNode.
RefPtr<Node> adoptedChild = document().adoptNode(&child.get(), ASSERT_NO_EXCEPTION);
RefPtr<Node> adoptedChild = document().adoptNode(child, ASSERT_NO_EXCEPTION);
parserAppendChild(*adoptedChild);
// FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
// (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
@@ -376,7 +376,7 @@ void ContainerNode::parserInsertBefore(Ref<Node>&& newChild, Node& nextChild)
return;

if (&document() != &newChild->document())
document().adoptNode(newChild.ptr(), ASSERT_NO_EXCEPTION);
document().adoptNode(newChild, ASSERT_NO_EXCEPTION);

insertBeforeCommon(nextChild, newChild);

@@ -718,7 +718,7 @@ void ContainerNode::parserAppendChild(Ref<Node>&& newChild)
#endif

if (&document() != &newChild->document())
document().adoptNode(newChild.ptr(), ASSERT_NO_EXCEPTION);
document().adoptNode(newChild, ASSERT_NO_EXCEPTION);

{
NoEventDispatchAssertion assertNoEventDispatch;

0 comments on commit a06636b

Please sign in to comment.