Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 364173005: Document.adoptNode should not throw an exception for DocumentType argument (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/dom/Document/adopt-node-with-doctype-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 ASSERT_NOT_REACHED(); 1001 ASSERT_NOT_REACHED();
1002 return nullptr; 1002 return nullptr;
1003 } 1003 }
1004 1004
1005 PassRefPtrWillBeRawPtr<Node> Document::adoptNode(PassRefPtrWillBeRawPtr<Node> so urce, ExceptionState& exceptionState) 1005 PassRefPtrWillBeRawPtr<Node> Document::adoptNode(PassRefPtrWillBeRawPtr<Node> so urce, ExceptionState& exceptionState)
1006 { 1006 {
1007 EventQueueScope scope; 1007 EventQueueScope scope;
1008 1008
1009 switch (source->nodeType()) { 1009 switch (source->nodeType()) {
1010 case DOCUMENT_NODE: 1010 case DOCUMENT_NODE:
1011 case DOCUMENT_TYPE_NODE:
1012 exceptionState.throwDOMException(NotSupportedError, "The node provided i s of type '" + source->nodeName() + "', which may not be adopted."); 1011 exceptionState.throwDOMException(NotSupportedError, "The node provided i s of type '" + source->nodeName() + "', which may not be adopted.");
1013 return nullptr; 1012 return nullptr;
1014 case ATTRIBUTE_NODE: { 1013 case ATTRIBUTE_NODE: {
1015 Attr* attr = toAttr(source.get()); 1014 Attr* attr = toAttr(source.get());
1016 if (RefPtrWillBeRawPtr<Element> ownerElement = attr->ownerElement()) 1015 if (RefPtrWillBeRawPtr<Element> ownerElement = attr->ownerElement())
1017 ownerElement->removeAttributeNode(attr, exceptionState); 1016 ownerElement->removeAttributeNode(attr, exceptionState);
1018 break; 1017 break;
1019 } 1018 }
1020 default: 1019 default:
1021 if (source->isShadowRoot()) { 1020 if (source->isShadowRoot()) {
(...skipping 4795 matching lines...) Expand 10 before | Expand all | Expand 10 after
5817 visitor->trace(m_compositorPendingAnimations); 5816 visitor->trace(m_compositorPendingAnimations);
5818 visitor->trace(m_contextDocument); 5817 visitor->trace(m_contextDocument);
5819 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5818 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5820 DocumentSupplementable::trace(visitor); 5819 DocumentSupplementable::trace(visitor);
5821 TreeScope::trace(visitor); 5820 TreeScope::trace(visitor);
5822 ContainerNode::trace(visitor); 5821 ContainerNode::trace(visitor);
5823 ExecutionContext::trace(visitor); 5822 ExecutionContext::trace(visitor);
5824 } 5823 }
5825 5824
5826 } // namespace WebCore 5825 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Document/adopt-node-with-doctype-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698