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

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

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/DatasetDOMStringMap.cpp ('k') | Source/core/dom/Element.cpp » ('j') | 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c hildCountDelta); 676 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c hildCountDelta);
677 677
678 Element* newDocumentElement = ElementTraversal::firstWithin(*this); 678 Element* newDocumentElement = ElementTraversal::firstWithin(*this);
679 if (newDocumentElement == m_documentElement) 679 if (newDocumentElement == m_documentElement)
680 return; 680 return;
681 m_documentElement = newDocumentElement; 681 m_documentElement = newDocumentElement;
682 // The root style used for media query matching depends on the document elem ent. 682 // The root style used for media query matching depends on the document elem ent.
683 clearStyleResolver(); 683 clearStyleResolver();
684 } 684 }
685 685
686 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& es) 686 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& exceptionState)
687 { 687 {
688 if (!isValidName(name)) { 688 if (!isValidName(name)) {
689 es.throwUninformativeAndGenericDOMException(InvalidCharacterError); 689 exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacter Error);
690 return 0; 690 return 0;
691 } 691 }
692 692
693 if (isXHTMLDocument() || isHTMLDocument()) 693 if (isXHTMLDocument() || isHTMLDocument())
694 return HTMLElementFactory::createHTMLElement(isHTMLDocument() ? name.low er() : name, document(), 0, false); 694 return HTMLElementFactory::createHTMLElement(isHTMLDocument() ? name.low er() : name, document(), 0, false);
695 695
696 return createElement(QualifiedName(nullAtom, name, nullAtom), false); 696 return createElement(QualifiedName(nullAtom, name, nullAtom), false);
697 } 697 }
698 698
699 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& es) 699 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& exceptionState)
700 { 700 {
701 if (!isValidName(localName)) { 701 if (!isValidName(localName)) {
702 es.throwUninformativeAndGenericDOMException(InvalidCharacterError); 702 exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacter Error);
703 return 0; 703 return 0;
704 } 704 }
705 705
706 RefPtr<Element> element; 706 RefPtr<Element> element;
707 707
708 if (RuntimeEnabledFeatures::customElementsEnabled() && CustomElement::isVali dName(localName) && registrationContext()) 708 if (RuntimeEnabledFeatures::customElementsEnabled() && CustomElement::isVali dName(localName) && registrationContext())
709 element = registrationContext()->createCustomTagElement(*this, Qualified Name(nullAtom, localName, xhtmlNamespaceURI)); 709 element = registrationContext()->createCustomTagElement(*this, Qualified Name(nullAtom, localName, xhtmlNamespaceURI));
710 else 710 else
711 element = createElement(localName, es); 711 element = createElement(localName, exceptionState);
712 712
713 if (RuntimeEnabledFeatures::customElementsEnabled() && !typeExtension.isNull () && !typeExtension.isEmpty()) 713 if (RuntimeEnabledFeatures::customElementsEnabled() && !typeExtension.isNull () && !typeExtension.isEmpty())
714 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension); 714 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension);
715 715
716 return element; 716 return element;
717 } 717 }
718 718
719 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionState& es) 719 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionState& exceptionState)
720 { 720 {
721 String prefix, localName; 721 String prefix, localName;
722 if (!parseQualifiedName(qualifiedName, prefix, localName, es)) 722 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState))
723 return 0; 723 return 0;
724 724
725 QualifiedName qName(prefix, localName, namespaceURI); 725 QualifiedName qName(prefix, localName, namespaceURI);
726 if (!hasValidNamespaceForElements(qName)) { 726 if (!hasValidNamespaceForElements(qName)) {
727 es.throwUninformativeAndGenericDOMException(NamespaceError); 727 exceptionState.throwUninformativeAndGenericDOMException(NamespaceError);
728 return 0; 728 return 0;
729 } 729 }
730 730
731 RefPtr<Element> element; 731 RefPtr<Element> element;
732 if (CustomElement::isValidName(qName.localName()) && registrationContext()) 732 if (CustomElement::isValidName(qName.localName()) && registrationContext())
733 element = registrationContext()->createCustomTagElement(*this, qName); 733 element = registrationContext()->createCustomTagElement(*this, qName);
734 else 734 else
735 element = createElementNS(namespaceURI, qualifiedName, es); 735 element = createElementNS(namespaceURI, qualifiedName, exceptionState);
736 736
737 if (!typeExtension.isNull() && !typeExtension.isEmpty()) 737 if (!typeExtension.isNull() && !typeExtension.isEmpty())
738 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension); 738 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension);
739 739
740 return element; 740 return element;
741 } 741 }
742 742
743 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, ExceptionState& es) 743 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, ExceptionState& exceptionState)
744 { 744 {
745 return registerElement(state, name, Dictionary(), es); 745 return registerElement(state, name, Dictionary(), exceptionState);
746 } 746 }
747 747
748 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, const Dictionary& options, ExceptionState& es, CustomElement::NameS et validNames) 748 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, const Dictionary& options, ExceptionState& exceptionState, CustomEl ement::NameSet validNames)
749 { 749 {
750 if (!registrationContext()) { 750 if (!registrationContext()) {
751 es.throwUninformativeAndGenericDOMException(NotSupportedError); 751 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
752 return ScriptValue(); 752 return ScriptValue();
753 } 753 }
754 754
755 CustomElementConstructorBuilder constructorBuilder(state, &options); 755 CustomElementConstructorBuilder constructorBuilder(state, &options);
756 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, es); 756 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState);
757 return constructorBuilder.bindingsReturnValue(); 757 return constructorBuilder.bindingsReturnValue();
758 } 758 }
759 759
760 void Document::setImport(HTMLImport* import) 760 void Document::setImport(HTMLImport* import)
761 { 761 {
762 ASSERT(!m_import || !import); 762 ASSERT(!m_import || !import);
763 m_import = import; 763 m_import = import;
764 } 764 }
765 765
766 void Document::didLoadAllImports() 766 void Document::didLoadAllImports()
(...skipping 14 matching lines...) Expand all
781 PassRefPtr<Text> Document::createTextNode(const String& data) 781 PassRefPtr<Text> Document::createTextNode(const String& data)
782 { 782 {
783 return Text::create(*this, data); 783 return Text::create(*this, data);
784 } 784 }
785 785
786 PassRefPtr<Comment> Document::createComment(const String& data) 786 PassRefPtr<Comment> Document::createComment(const String& data)
787 { 787 {
788 return Comment::create(*this, data); 788 return Comment::create(*this, data);
789 } 789 }
790 790
791 PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except ionState& es) 791 PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except ionState& exceptionState)
792 { 792 {
793 if (isHTMLDocument()) { 793 if (isHTMLDocument()) {
794 es.throwUninformativeAndGenericDOMException(NotSupportedError); 794 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
795 return 0; 795 return 0;
796 } 796 }
797 if (data.find("]]>") != WTF::kNotFound) { 797 if (data.find("]]>") != WTF::kNotFound) {
798 es.throwDOMException(InvalidCharacterError, "String cannot contain ']]>' since that is the end delimiter of a CData section."); 798 exceptionState.throwDOMException(InvalidCharacterError, "String cannot c ontain ']]>' since that is the end delimiter of a CData section.");
799 return 0; 799 return 0;
800 } 800 }
801 return CDATASection::create(*this, data); 801 return CDATASection::create(*this, data);
802 } 802 }
803 803
804 PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St ring& target, const String& data, ExceptionState& es) 804 PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St ring& target, const String& data, ExceptionState& exceptionState)
805 { 805 {
806 if (!isValidName(target)) { 806 if (!isValidName(target)) {
807 es.throwUninformativeAndGenericDOMException(InvalidCharacterError); 807 exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacter Error);
808 return 0; 808 return 0;
809 } 809 }
810 if (isHTMLDocument()) { 810 if (isHTMLDocument()) {
811 es.throwUninformativeAndGenericDOMException(NotSupportedError); 811 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
812 return 0; 812 return 0;
813 } 813 }
814 return ProcessingInstruction::create(*this, target, data); 814 return ProcessingInstruction::create(*this, target, data);
815 } 815 }
816 816
817 PassRefPtr<Text> Document::createEditingTextNode(const String& text) 817 PassRefPtr<Text> Document::createEditingTextNode(const String& text)
818 { 818 {
819 return Text::createEditingText(*this, text); 819 return Text::createEditingText(*this, text);
820 } 820 }
821 821
822 PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() 822 PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()
823 { 823 {
824 return MutableStylePropertySet::create()->ensureCSSStyleDeclaration(); 824 return MutableStylePropertySet::create()->ensureCSSStyleDeclaration();
825 } 825 }
826 826
827 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt ate& es) 827 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt ate& exceptionState)
828 { 828 {
829 if (!importedNode) { 829 if (!importedNode) {
830 es.throwUninformativeAndGenericDOMException(NotSupportedError); 830 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
831 return 0; 831 return 0;
832 } 832 }
833 833
834 switch (importedNode->nodeType()) { 834 switch (importedNode->nodeType()) {
835 case TEXT_NODE: 835 case TEXT_NODE:
836 return createTextNode(importedNode->nodeValue()); 836 return createTextNode(importedNode->nodeValue());
837 case CDATA_SECTION_NODE: 837 case CDATA_SECTION_NODE:
838 return createCDATASection(importedNode->nodeValue(), es); 838 return createCDATASection(importedNode->nodeValue(), exceptionState);
839 case PROCESSING_INSTRUCTION_NODE: 839 case PROCESSING_INSTRUCTION_NODE:
840 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), es); 840 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState);
841 case COMMENT_NODE: 841 case COMMENT_NODE:
842 return createComment(importedNode->nodeValue()); 842 return createComment(importedNode->nodeValue());
843 case ELEMENT_NODE: { 843 case ELEMENT_NODE: {
844 Element* oldElement = toElement(importedNode); 844 Element* oldElement = toElement(importedNode);
845 // FIXME: The following check might be unnecessary. Is it possible that 845 // FIXME: The following check might be unnecessary. Is it possible that
846 // oldElement has mismatched prefix/namespace? 846 // oldElement has mismatched prefix/namespace?
847 if (!hasValidNamespaceForElements(oldElement->tagQName())) { 847 if (!hasValidNamespaceForElements(oldElement->tagQName())) {
848 es.throwUninformativeAndGenericDOMException(NamespaceError); 848 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr or);
849 return 0; 849 return 0;
850 } 850 }
851 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false ); 851 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false );
852 852
853 newElement->cloneDataFromElement(*oldElement); 853 newElement->cloneDataFromElement(*oldElement);
854 854
855 if (deep) { 855 if (deep) {
856 for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) { 856 for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
857 RefPtr<Node> newChild = importNode(oldChild, true, es); 857 RefPtr<Node> newChild = importNode(oldChild, true, exceptionStat e);
858 if (es.hadException()) 858 if (exceptionState.hadException())
859 return 0; 859 return 0;
860 newElement->appendChild(newChild.release(), es); 860 newElement->appendChild(newChild.release(), exceptionState);
861 if (es.hadException()) 861 if (exceptionState.hadException())
862 return 0; 862 return 0;
863 } 863 }
864 } 864 }
865 865
866 return newElement.release(); 866 return newElement.release();
867 } 867 }
868 case ATTRIBUTE_NODE: 868 case ATTRIBUTE_NODE:
869 return Attr::create(*this, QualifiedName(nullAtom, toAttr(importedNode)- >name(), nullAtom), toAttr(importedNode)->value()); 869 return Attr::create(*this, QualifiedName(nullAtom, toAttr(importedNode)- >name(), nullAtom), toAttr(importedNode)->value());
870 case DOCUMENT_FRAGMENT_NODE: { 870 case DOCUMENT_FRAGMENT_NODE: {
871 if (importedNode->isShadowRoot()) { 871 if (importedNode->isShadowRoot()) {
872 // ShadowRoot nodes should not be explicitly importable. 872 // ShadowRoot nodes should not be explicitly importable.
873 // Either they are imported along with their host node, or created i mplicitly. 873 // Either they are imported along with their host node, or created i mplicitly.
874 break; 874 break;
875 } 875 }
876 DocumentFragment* oldFragment = toDocumentFragment(importedNode); 876 DocumentFragment* oldFragment = toDocumentFragment(importedNode);
877 RefPtr<DocumentFragment> newFragment = createDocumentFragment(); 877 RefPtr<DocumentFragment> newFragment = createDocumentFragment();
878 if (deep) { 878 if (deep) {
879 for (Node* oldChild = oldFragment->firstChild(); oldChild; oldChild = oldChild->nextSibling()) { 879 for (Node* oldChild = oldFragment->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
880 RefPtr<Node> newChild = importNode(oldChild, true, es); 880 RefPtr<Node> newChild = importNode(oldChild, true, exceptionStat e);
881 if (es.hadException()) 881 if (exceptionState.hadException())
882 return 0; 882 return 0;
883 newFragment->appendChild(newChild.release(), es); 883 newFragment->appendChild(newChild.release(), exceptionState);
884 if (es.hadException()) 884 if (exceptionState.hadException())
885 return 0; 885 return 0;
886 } 886 }
887 } 887 }
888 888
889 return newFragment.release(); 889 return newFragment.release();
890 } 890 }
891 case ENTITY_NODE: 891 case ENTITY_NODE:
892 case NOTATION_NODE: 892 case NOTATION_NODE:
893 // FIXME: It should be possible to import these node types, however in D OM3 the DocumentType is readonly, so there isn't much sense in doing that. 893 // FIXME: It should be possible to import these node types, however in D OM3 the DocumentType is readonly, so there isn't much sense in doing that.
894 // Ability to add these imported nodes to a DocumentType will be conside red for addition to a future release of the DOM. 894 // Ability to add these imported nodes to a DocumentType will be conside red for addition to a future release of the DOM.
895 case DOCUMENT_NODE: 895 case DOCUMENT_NODE:
896 case DOCUMENT_TYPE_NODE: 896 case DOCUMENT_TYPE_NODE:
897 case XPATH_NAMESPACE_NODE: 897 case XPATH_NAMESPACE_NODE:
898 break; 898 break;
899 } 899 }
900 es.throwUninformativeAndGenericDOMException(NotSupportedError); 900 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
901 return 0; 901 return 0;
902 } 902 }
903 903
904 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es ) 904 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex ceptionState)
905 { 905 {
906 if (!source) { 906 if (!source) {
907 es.throwUninformativeAndGenericDOMException(NotSupportedError); 907 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
908 return 0; 908 return 0;
909 } 909 }
910 910
911 EventQueueScope scope; 911 EventQueueScope scope;
912 912
913 switch (source->nodeType()) { 913 switch (source->nodeType()) {
914 case ENTITY_NODE: 914 case ENTITY_NODE:
915 case NOTATION_NODE: 915 case NOTATION_NODE:
916 case DOCUMENT_NODE: 916 case DOCUMENT_NODE:
917 case DOCUMENT_TYPE_NODE: 917 case DOCUMENT_TYPE_NODE:
918 case XPATH_NAMESPACE_NODE: 918 case XPATH_NAMESPACE_NODE:
919 es.throwUninformativeAndGenericDOMException(NotSupportedError); 919 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
920 return 0; 920 return 0;
921 case ATTRIBUTE_NODE: { 921 case ATTRIBUTE_NODE: {
922 Attr* attr = toAttr(source.get()); 922 Attr* attr = toAttr(source.get());
923 if (attr->ownerElement()) 923 if (attr->ownerElement())
924 attr->ownerElement()->removeAttributeNode(attr, es); 924 attr->ownerElement()->removeAttributeNode(attr, exceptionState);
925 break; 925 break;
926 } 926 }
927 default: 927 default:
928 if (source->isShadowRoot()) { 928 if (source->isShadowRoot()) {
929 // ShadowRoot cannot disconnect itself from the host node. 929 // ShadowRoot cannot disconnect itself from the host node.
930 es.throwUninformativeAndGenericDOMException(HierarchyRequestError); 930 exceptionState.throwUninformativeAndGenericDOMException(HierarchyReq uestError);
931 return 0; 931 return 0;
932 } 932 }
933 933
934 if (source->isFrameOwnerElement()) { 934 if (source->isFrameOwnerElement()) {
935 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s ource.get()); 935 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s ource.get());
936 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->con tentFrame())) { 936 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->con tentFrame())) {
937 es.throwUninformativeAndGenericDOMException(HierarchyRequestErro r); 937 exceptionState.throwUninformativeAndGenericDOMException(Hierarch yRequestError);
938 return 0; 938 return 0;
939 } 939 }
940 } 940 }
941 if (source->parentNode()) { 941 if (source->parentNode()) {
942 source->parentNode()->removeChild(source.get(), es); 942 source->parentNode()->removeChild(source.get(), exceptionState);
943 if (es.hadException()) 943 if (exceptionState.hadException())
944 return 0; 944 return 0;
945 } 945 }
946 } 946 }
947 947
948 this->adoptIfNeeded(*source); 948 this->adoptIfNeeded(*source);
949 949
950 return source; 950 return source;
951 } 951 }
952 952
953 bool Document::hasValidNamespaceForElements(const QualifiedName& qName) 953 bool Document::hasValidNamespaceForElements(const QualifiedName& qName)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 } 1019 }
1020 1020
1021 NamedFlowCollection* Document::namedFlows() 1021 NamedFlowCollection* Document::namedFlows()
1022 { 1022 {
1023 if (!m_namedFlows) 1023 if (!m_namedFlows)
1024 m_namedFlows = NamedFlowCollection::create(this); 1024 m_namedFlows = NamedFlowCollection::create(this);
1025 1025
1026 return m_namedFlows.get(); 1026 return m_namedFlows.get();
1027 } 1027 }
1028 1028
1029 PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionState& es) 1029 PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionState& exceptionState)
1030 { 1030 {
1031 String prefix, localName; 1031 String prefix, localName;
1032 if (!parseQualifiedName(qualifiedName, prefix, localName, es)) 1032 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState))
1033 return 0; 1033 return 0;
1034 1034
1035 QualifiedName qName(prefix, localName, namespaceURI); 1035 QualifiedName qName(prefix, localName, namespaceURI);
1036 if (!hasValidNamespaceForElements(qName)) { 1036 if (!hasValidNamespaceForElements(qName)) {
1037 es.throwUninformativeAndGenericDOMException(NamespaceError); 1037 exceptionState.throwUninformativeAndGenericDOMException(NamespaceError);
1038 return 0; 1038 return 0;
1039 } 1039 }
1040 1040
1041 return createElement(qName, false); 1041 return createElement(qName, false);
1042 } 1042 }
1043 1043
1044 String Document::readyState() const 1044 String Document::readyState() const
1045 { 1045 {
1046 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); 1046 DEFINE_STATIC_LOCAL(const String, loading, ("loading"));
1047 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); 1047 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive"));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 void Document::setContentLanguage(const String& language) 1118 void Document::setContentLanguage(const String& language)
1119 { 1119 {
1120 if (m_contentLanguage == language) 1120 if (m_contentLanguage == language)
1121 return; 1121 return;
1122 m_contentLanguage = language; 1122 m_contentLanguage = language;
1123 1123
1124 // Document's style depends on the content language. 1124 // Document's style depends on the content language.
1125 setNeedsStyleRecalc(); 1125 setNeedsStyleRecalc();
1126 } 1126 }
1127 1127
1128 void Document::setXMLVersion(const String& version, ExceptionState& es) 1128 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta te)
1129 { 1129 {
1130 if (!implementation()->hasFeature("XML", String())) { 1130 if (!implementation()->hasFeature("XML", String())) {
1131 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1131 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1132 return; 1132 return;
1133 } 1133 }
1134 1134
1135 if (!XMLDocumentParser::supportsXMLVersion(version)) { 1135 if (!XMLDocumentParser::supportsXMLVersion(version)) {
1136 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1136 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1137 return; 1137 return;
1138 } 1138 }
1139 1139
1140 m_xmlVersion = version; 1140 m_xmlVersion = version;
1141 } 1141 }
1142 1142
1143 void Document::setXMLStandalone(bool standalone, ExceptionState& es) 1143 void Document::setXMLStandalone(bool standalone, ExceptionState& exceptionState)
1144 { 1144 {
1145 if (!implementation()->hasFeature("XML", String())) { 1145 if (!implementation()->hasFeature("XML", String())) {
1146 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1146 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1147 return; 1147 return;
1148 } 1148 }
1149 1149
1150 m_xmlStandalone = standalone ? Standalone : NotStandalone; 1150 m_xmlStandalone = standalone ? Standalone : NotStandalone;
1151 } 1151 }
1152 1152
1153 KURL Document::baseURI() const 1153 KURL Document::baseURI() const
1154 { 1154 {
1155 return m_baseURL; 1155 return m_baseURL;
1156 } 1156 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 Settings* Document::settings() const 1426 Settings* Document::settings() const
1427 { 1427 {
1428 return m_frame ? m_frame->settings() : 0; 1428 return m_frame ? m_frame->settings() : 0;
1429 } 1429 }
1430 1430
1431 PassRefPtr<Range> Document::createRange() 1431 PassRefPtr<Range> Document::createRange()
1432 { 1432 {
1433 return Range::create(*this); 1433 return Range::create(*this);
1434 } 1434 }
1435 1435
1436 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState & es) 1436 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState & exceptionState)
1437 { 1437 {
1438 // FIXME: Probably this should be handled within the bindings layer and Type Error should be thrown. 1438 // FIXME: Probably this should be handled within the bindings layer and Type Error should be thrown.
1439 if (!root) { 1439 if (!root) {
1440 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1440 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1441 return 0; 1441 return 0;
1442 } 1442 }
1443 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte r>()); 1443 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte r>());
1444 } 1444 }
1445 1445
1446 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT oShow, ExceptionState& es) 1446 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT oShow, ExceptionState& exceptionState)
1447 { 1447 {
1448 if (!root) { 1448 if (!root) {
1449 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1449 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1450 return 0; 1450 return 0;
1451 } 1451 }
1452 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in 1452 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in
1453 // NodeFilter. 1453 // NodeFilter.
1454 return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>()); 1454 return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>());
1455 } 1455 }
1456 1456
1457 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT oShow, PassRefPtr<NodeFilter> filter, ExceptionState& es) 1457 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT oShow, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState)
1458 { 1458 {
1459 if (!root) { 1459 if (!root) {
1460 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1460 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1461 return 0; 1461 return 0;
1462 } 1462 }
1463 // FIXME: Ditto. 1463 // FIXME: Ditto.
1464 return NodeIterator::create(root, whatToShow, filter); 1464 return NodeIterator::create(root, whatToShow, filter);
1465 } 1465 }
1466 1466
1467 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT oShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionStat e& es) 1467 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT oShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionStat e& exceptionState)
1468 { 1468 {
1469 if (!root) { 1469 if (!root) {
1470 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1470 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1471 return 0; 1471 return 0;
1472 } 1472 }
1473 // FIXME: Warn if |expandEntityReferences| is specified. This optional argum ent is deprecated in DOM4. 1473 // FIXME: Warn if |expandEntityReferences| is specified. This optional argum ent is deprecated in DOM4.
1474 UNUSED_PARAM(expandEntityReferences); 1474 UNUSED_PARAM(expandEntityReferences);
1475 return NodeIterator::create(root, whatToShow, filter); 1475 return NodeIterator::create(root, whatToShow, filter);
1476 } 1476 }
1477 1477
1478 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& es ) 1478 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& ex ceptionState)
1479 { 1479 {
1480 if (!root) { 1480 if (!root) {
1481 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1481 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1482 return 0; 1482 return 0;
1483 } 1483 }
1484 return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter> ()); 1484 return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter> ());
1485 } 1485 }
1486 1486
1487 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, ExceptionState& es) 1487 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, ExceptionState& exceptionState)
1488 { 1488 {
1489 if (!root) { 1489 if (!root) {
1490 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1490 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1491 return 0; 1491 return 0;
1492 } 1492 }
1493 return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>()); 1493 return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>());
1494 } 1494 }
1495 1495
1496 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, PassRefPtr<NodeFilter> filter, ExceptionState& es) 1496 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState)
1497 { 1497 {
1498 if (!root) { 1498 if (!root) {
1499 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1499 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1500 return 0; 1500 return 0;
1501 } 1501 }
1502 return TreeWalker::create(root, whatToShow, filter); 1502 return TreeWalker::create(root, whatToShow, filter);
1503 } 1503 }
1504 1504
1505 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& e s) 1505 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& e xceptionState)
1506 { 1506 {
1507 UNUSED_PARAM(expandEntityReferences); 1507 UNUSED_PARAM(expandEntityReferences);
1508 if (!root) { 1508 if (!root) {
1509 es.throwUninformativeAndGenericDOMException(NotSupportedError); 1509 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1510 return 0; 1510 return 0;
1511 } 1511 }
1512 return TreeWalker::create(root, whatToShow, filter); 1512 return TreeWalker::create(root, whatToShow, filter);
1513 } 1513 }
1514 1514
1515 void Document::serviceAnimations(double monotonicAnimationStartTime) 1515 void Document::serviceAnimations(double monotonicAnimationStartTime)
1516 { 1516 {
1517 if (!RuntimeEnabledFeatures::webAnimationsEnabled()) 1517 if (!RuntimeEnabledFeatures::webAnimationsEnabled())
1518 return; 1518 return;
1519 1519
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 return 0; 2250 return 0;
2251 2251
2252 for (Node* child = documentElement()->firstChild(); child; child = child->ne xtSibling()) { 2252 for (Node* child = documentElement()->firstChild(); child; child = child->ne xtSibling()) {
2253 if (child->hasTagName(framesetTag) || child->hasTagName(bodyTag)) 2253 if (child->hasTagName(framesetTag) || child->hasTagName(bodyTag))
2254 return toHTMLElement(child); 2254 return toHTMLElement(child);
2255 } 2255 }
2256 2256
2257 return 0; 2257 return 0;
2258 } 2258 }
2259 2259
2260 void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& es) 2260 void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& excep tionState)
2261 { 2261 {
2262 RefPtr<HTMLElement> newBody = prpNewBody; 2262 RefPtr<HTMLElement> newBody = prpNewBody;
2263 2263
2264 if (!newBody || !documentElement()) { 2264 if (!newBody || !documentElement()) {
2265 es.throwUninformativeAndGenericDOMException(HierarchyRequestError); 2265 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest Error);
2266 return; 2266 return;
2267 } 2267 }
2268 2268
2269 if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) { 2269 if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) {
2270 es.throwUninformativeAndGenericDOMException(HierarchyRequestError); 2270 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest Error);
2271 return; 2271 return;
2272 } 2272 }
2273 2273
2274 HTMLElement* oldBody = body(); 2274 HTMLElement* oldBody = body();
2275 if (oldBody == newBody) 2275 if (oldBody == newBody)
2276 return; 2276 return;
2277 2277
2278 if (oldBody) 2278 if (oldBody)
2279 documentElement()->replaceChild(newBody.release(), oldBody, es); 2279 documentElement()->replaceChild(newBody.release(), oldBody, exceptionSta te);
2280 else 2280 else
2281 documentElement()->appendChild(newBody.release(), es); 2281 documentElement()->appendChild(newBody.release(), exceptionState);
2282 } 2282 }
2283 2283
2284 HTMLHeadElement* Document::head() 2284 HTMLHeadElement* Document::head()
2285 { 2285 {
2286 Node* de = documentElement(); 2286 Node* de = documentElement();
2287 if (!de) 2287 if (!de)
2288 return 0; 2288 return 0;
2289 2289
2290 for (Node* node = de->firstChild(); node; node = node->nextSibling()) { 2290 for (Node* node = de->firstChild(); node; node = node->nextSibling()) {
2291 if (node->hasTagName(headTag)) 2291 if (node->hasTagName(headTag))
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
3651 } 3651 }
3652 3652
3653 void Document::enqueueScrollEventForNode(Node* target) 3653 void Document::enqueueScrollEventForNode(Node* target)
3654 { 3654 {
3655 // Per the W3C CSSOM View Module only scroll events fired at the document sh ould bubble. 3655 // Per the W3C CSSOM View Module only scroll events fired at the document sh ould bubble.
3656 RefPtr<Event> scrollEvent = target->isDocumentNode() ? Event::createBubble(E ventTypeNames::scroll) : Event::create(EventTypeNames::scroll); 3656 RefPtr<Event> scrollEvent = target->isDocumentNode() ? Event::createBubble(E ventTypeNames::scroll) : Event::create(EventTypeNames::scroll);
3657 scrollEvent->setTarget(target); 3657 scrollEvent->setTarget(target);
3658 scheduleAnimationFrameEvent(scrollEvent.release()); 3658 scheduleAnimationFrameEvent(scrollEvent.release());
3659 } 3659 }
3660 3660
3661 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState& es) 3661 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState& exceptionState)
3662 { 3662 {
3663 RefPtr<Event> event = EventFactory::create(eventType); 3663 RefPtr<Event> event = EventFactory::create(eventType);
3664 if (event) 3664 if (event)
3665 return event.release(); 3665 return event.release();
3666 3666
3667 es.throwUninformativeAndGenericDOMException(NotSupportedError); 3667 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
3668 return 0; 3668 return 0;
3669 } 3669 }
3670 3670
3671 void Document::addMutationEventListenerTypeIfEnabled(ListenerType listenerType) 3671 void Document::addMutationEventListenerTypeIfEnabled(ListenerType listenerType)
3672 { 3672 {
3673 if (ContextFeatures::mutationEventsEnabled(this)) 3673 if (ContextFeatures::mutationEventsEnabled(this))
3674 addListenerType(listenerType); 3674 addListenerType(listenerType);
3675 } 3675 }
3676 3676
3677 void Document::addListenerTypeIfNeeded(const AtomicString& eventType) 3677 void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3721 return 0; 3721 return 0;
3722 } 3722 }
3723 3723
3724 HTMLFrameOwnerElement* Document::ownerElement() const 3724 HTMLFrameOwnerElement* Document::ownerElement() const
3725 { 3725 {
3726 if (!frame()) 3726 if (!frame())
3727 return 0; 3727 return 0;
3728 return frame()->ownerElement(); 3728 return frame()->ownerElement();
3729 } 3729 }
3730 3730
3731 String Document::cookie(ExceptionState& es) const 3731 String Document::cookie(ExceptionState& exceptionState) const
3732 { 3732 {
3733 if (settings() && !settings()->cookieEnabled()) 3733 if (settings() && !settings()->cookieEnabled())
3734 return String(); 3734 return String();
3735 3735
3736 // FIXME: The HTML5 DOM spec states that this attribute can raise an 3736 // FIXME: The HTML5 DOM spec states that this attribute can raise an
3737 // InvalidStateError exception on getting if the Document has no 3737 // InvalidStateError exception on getting if the Document has no
3738 // browsing context. 3738 // browsing context.
3739 3739
3740 if (!securityOrigin()->canAccessCookies()) { 3740 if (!securityOrigin()->canAccessCookies()) {
3741 String accessDeniedMessage = "Access to 'cookie' is denied for this docu ment."; 3741 String accessDeniedMessage = "Access to 'cookie' is denied for this docu ment.";
3742 if (isSandboxed(SandboxOrigin)) 3742 if (isSandboxed(SandboxOrigin))
3743 es.throwSecurityError(accessDeniedMessage + " The document is sandbo xed and lacks the 'allow-same-origin' flag."); 3743 exceptionState.throwSecurityError(accessDeniedMessage + " The docume nt is sandboxed and lacks the 'allow-same-origin' flag.");
3744 else if (url().protocolIs("data")) 3744 else if (url().protocolIs("data"))
3745 es.throwSecurityError(accessDeniedMessage + " Cookies are disabled i nside 'data:' URLs."); 3745 exceptionState.throwSecurityError(accessDeniedMessage + " Cookies ar e disabled inside 'data:' URLs.");
3746 else 3746 else
3747 es.throwSecurityError(accessDeniedMessage); 3747 exceptionState.throwSecurityError(accessDeniedMessage);
3748 return String(); 3748 return String();
3749 } 3749 }
3750 3750
3751 KURL cookieURL = this->cookieURL(); 3751 KURL cookieURL = this->cookieURL();
3752 if (cookieURL.isEmpty()) 3752 if (cookieURL.isEmpty())
3753 return String(); 3753 return String();
3754 3754
3755 return cookies(this, cookieURL); 3755 return cookies(this, cookieURL);
3756 } 3756 }
3757 3757
3758 void Document::setCookie(const String& value, ExceptionState& es) 3758 void Document::setCookie(const String& value, ExceptionState& exceptionState)
3759 { 3759 {
3760 if (settings() && !settings()->cookieEnabled()) 3760 if (settings() && !settings()->cookieEnabled())
3761 return; 3761 return;
3762 3762
3763 // FIXME: The HTML5 DOM spec states that this attribute can raise an 3763 // FIXME: The HTML5 DOM spec states that this attribute can raise an
3764 // InvalidStateError exception on setting if the Document has no 3764 // InvalidStateError exception on setting if the Document has no
3765 // browsing context. 3765 // browsing context.
3766 3766
3767 if (!securityOrigin()->canAccessCookies()) { 3767 if (!securityOrigin()->canAccessCookies()) {
3768 String accessDeniedMessage = "Access to 'cookie' is denied for this docu ment."; 3768 String accessDeniedMessage = "Access to 'cookie' is denied for this docu ment.";
3769 if (isSandboxed(SandboxOrigin)) 3769 if (isSandboxed(SandboxOrigin))
3770 es.throwSecurityError(accessDeniedMessage + " The document is sandbo xed and lacks the 'allow-same-origin' flag."); 3770 exceptionState.throwSecurityError(accessDeniedMessage + " The docume nt is sandboxed and lacks the 'allow-same-origin' flag.");
3771 else if (url().protocolIs("data")) 3771 else if (url().protocolIs("data"))
3772 es.throwSecurityError(accessDeniedMessage + " Cookies are disabled i nside 'data:' URLs."); 3772 exceptionState.throwSecurityError(accessDeniedMessage + " Cookies ar e disabled inside 'data:' URLs.");
3773 else 3773 else
3774 es.throwSecurityError(accessDeniedMessage); 3774 exceptionState.throwSecurityError(accessDeniedMessage);
3775 return; 3775 return;
3776 } 3776 }
3777 3777
3778 KURL cookieURL = this->cookieURL(); 3778 KURL cookieURL = this->cookieURL();
3779 if (cookieURL.isEmpty()) 3779 if (cookieURL.isEmpty())
3780 return; 3780 return;
3781 3781
3782 setCookies(this, cookieURL, value); 3782 setCookies(this, cookieURL, value);
3783 } 3783 }
3784 3784
3785 String Document::referrer() const 3785 String Document::referrer() const
3786 { 3786 {
3787 if (loader()) 3787 if (loader())
3788 return loader()->request().httpReferrer(); 3788 return loader()->request().httpReferrer();
3789 return String(); 3789 return String();
3790 } 3790 }
3791 3791
3792 String Document::domain() const 3792 String Document::domain() const
3793 { 3793 {
3794 return securityOrigin()->domain(); 3794 return securityOrigin()->domain();
3795 } 3795 }
3796 3796
3797 void Document::setDomain(const String& newDomain, ExceptionState& es) 3797 void Document::setDomain(const String& newDomain, ExceptionState& exceptionState )
3798 { 3798 {
3799 if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(securityOrigin() ->protocol())) { 3799 if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(securityOrigin() ->protocol())) {
3800 es.throwSecurityError(ExceptionMessages::failedToSet("domain", "Document ", "assignment is forbidden for the '" + securityOrigin()->protocol() + "' schem e.")); 3800 exceptionState.throwSecurityError(ExceptionMessages::failedToSet("domain ", "Document", "assignment is forbidden for the '" + securityOrigin()->protocol( ) + "' scheme."));
3801 return; 3801 return;
3802 } 3802 }
3803 3803
3804 String exceptionMessage = ExceptionMessages::failedToSet("domain", "Document ", "'" + newDomain + "' is not a suffix of '" + domain() + "'."); 3804 String exceptionMessage = ExceptionMessages::failedToSet("domain", "Document ", "'" + newDomain + "' is not a suffix of '" + domain() + "'.");
3805 if (newDomain.isEmpty()) { 3805 if (newDomain.isEmpty()) {
3806 es.throwSecurityError(exceptionMessage); 3806 exceptionState.throwSecurityError(exceptionMessage);
3807 return; 3807 return;
3808 } 3808 }
3809 3809
3810 OriginAccessEntry::IPAddressSetting ipAddressSetting = settings() && setting s()->treatIPAddressAsDomain() ? OriginAccessEntry::TreatIPAddressAsDomain : Orig inAccessEntry::TreatIPAddressAsIPAddress; 3810 OriginAccessEntry::IPAddressSetting ipAddressSetting = settings() && setting s()->treatIPAddressAsDomain() ? OriginAccessEntry::TreatIPAddressAsDomain : Orig inAccessEntry::TreatIPAddressAsIPAddress;
3811 OriginAccessEntry accessEntry(securityOrigin()->protocol(), newDomain, Origi nAccessEntry::AllowSubdomains, ipAddressSetting); 3811 OriginAccessEntry accessEntry(securityOrigin()->protocol(), newDomain, Origi nAccessEntry::AllowSubdomains, ipAddressSetting);
3812 if (!accessEntry.matchesOrigin(*securityOrigin())) { 3812 if (!accessEntry.matchesOrigin(*securityOrigin())) {
3813 es.throwSecurityError(exceptionMessage); 3813 exceptionState.throwSecurityError(exceptionMessage);
3814 return; 3814 return;
3815 } 3815 }
3816 3816
3817 securityOrigin()->setDomainFromDOM(newDomain); 3817 securityOrigin()->setDomainFromDOM(newDomain);
3818 if (m_frame) 3818 if (m_frame)
3819 m_frame->script().updateSecurityOrigin(); 3819 m_frame->script().updateSecurityOrigin();
3820 } 3820 }
3821 3821
3822 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified 3822 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
3823 String Document::lastModified() const 3823 String Document::lastModified() const
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3910 3910
3911 const UChar* characters = name.characters16(); 3911 const UChar* characters = name.characters16();
3912 3912
3913 if (isValidNameASCII(characters, length)) 3913 if (isValidNameASCII(characters, length))
3914 return true; 3914 return true;
3915 3915
3916 return isValidNameNonASCII(characters, length); 3916 return isValidNameNonASCII(characters, length);
3917 } 3917 }
3918 3918
3919 template<typename CharType> 3919 template<typename CharType>
3920 static bool parseQualifiedNameInternal(const String& qualifiedName, const CharTy pe* characters, unsigned length, String& prefix, String& localName, ExceptionSta te& es) 3920 static bool parseQualifiedNameInternal(const String& qualifiedName, const CharTy pe* characters, unsigned length, String& prefix, String& localName, ExceptionSta te& exceptionState)
3921 { 3921 {
3922 bool nameStart = true; 3922 bool nameStart = true;
3923 bool sawColon = false; 3923 bool sawColon = false;
3924 int colonPos = 0; 3924 int colonPos = 0;
3925 3925
3926 for (unsigned i = 0; i < length;) { 3926 for (unsigned i = 0; i < length;) {
3927 UChar32 c; 3927 UChar32 c;
3928 U16_NEXT(characters, i, length, c) 3928 U16_NEXT(characters, i, length, c)
3929 if (c == ':') { 3929 if (c == ':') {
3930 if (sawColon) { 3930 if (sawColon) {
3931 es.throwUninformativeAndGenericDOMException(NamespaceError); 3931 exceptionState.throwUninformativeAndGenericDOMException(Namespac eError);
3932 return false; // multiple colons: not allowed 3932 return false; // multiple colons: not allowed
3933 } 3933 }
3934 nameStart = true; 3934 nameStart = true;
3935 sawColon = true; 3935 sawColon = true;
3936 colonPos = i - 1; 3936 colonPos = i - 1;
3937 } else if (nameStart) { 3937 } else if (nameStart) {
3938 if (!isValidNameStart(c)) { 3938 if (!isValidNameStart(c)) {
3939 es.throwUninformativeAndGenericDOMException(InvalidCharacterErro r); 3939 exceptionState.throwUninformativeAndGenericDOMException(InvalidC haracterError);
3940 return false; 3940 return false;
3941 } 3941 }
3942 nameStart = false; 3942 nameStart = false;
3943 } else { 3943 } else {
3944 if (!isValidNamePart(c)) { 3944 if (!isValidNamePart(c)) {
3945 es.throwUninformativeAndGenericDOMException(InvalidCharacterErro r); 3945 exceptionState.throwUninformativeAndGenericDOMException(InvalidC haracterError);
3946 return false; 3946 return false;
3947 } 3947 }
3948 } 3948 }
3949 } 3949 }
3950 3950
3951 if (!sawColon) { 3951 if (!sawColon) {
3952 prefix = String(); 3952 prefix = String();
3953 localName = qualifiedName; 3953 localName = qualifiedName;
3954 } else { 3954 } else {
3955 prefix = qualifiedName.substring(0, colonPos); 3955 prefix = qualifiedName.substring(0, colonPos);
3956 if (prefix.isEmpty()) { 3956 if (prefix.isEmpty()) {
3957 es.throwUninformativeAndGenericDOMException(NamespaceError); 3957 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr or);
3958 return false; 3958 return false;
3959 } 3959 }
3960 localName = qualifiedName.substring(colonPos + 1); 3960 localName = qualifiedName.substring(colonPos + 1);
3961 } 3961 }
3962 3962
3963 if (localName.isEmpty()) { 3963 if (localName.isEmpty()) {
3964 es.throwUninformativeAndGenericDOMException(NamespaceError); 3964 exceptionState.throwUninformativeAndGenericDOMException(NamespaceError);
3965 return false; 3965 return false;
3966 } 3966 }
3967 3967
3968 return true; 3968 return true;
3969 } 3969 }
3970 3970
3971 bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, S tring& localName, ExceptionState& es) 3971 bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, S tring& localName, ExceptionState& exceptionState)
3972 { 3972 {
3973 unsigned length = qualifiedName.length(); 3973 unsigned length = qualifiedName.length();
3974 3974
3975 if (!length) { 3975 if (!length) {
3976 es.throwUninformativeAndGenericDOMException(InvalidCharacterError); 3976 exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacter Error);
3977 return false; 3977 return false;
3978 } 3978 }
3979 3979
3980 if (qualifiedName.is8Bit()) 3980 if (qualifiedName.is8Bit())
3981 return parseQualifiedNameInternal(qualifiedName, qualifiedName.character s8(), length, prefix, localName, es); 3981 return parseQualifiedNameInternal(qualifiedName, qualifiedName.character s8(), length, prefix, localName, exceptionState);
3982 return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters16( ), length, prefix, localName, es); 3982 return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters16( ), length, prefix, localName, exceptionState);
3983 } 3983 }
3984 3984
3985 void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder) 3985 void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder)
3986 { 3986 {
3987 m_decoder = decoder; 3987 m_decoder = decoder;
3988 setEncoding(m_decoder ? m_decoder->encoding() : WTF::TextEncoding()); 3988 setEncoding(m_decoder ? m_decoder->encoding() : WTF::TextEncoding());
3989 } 3989 }
3990 3990
3991 void Document::setEncoding(const WTF::TextEncoding& encoding) 3991 void Document::setEncoding(const WTF::TextEncoding& encoding)
3992 { 3992 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
4181 4181
4182 WeakPtr<Document> Document::contextDocument() 4182 WeakPtr<Document> Document::contextDocument()
4183 { 4183 {
4184 if (m_contextDocument) 4184 if (m_contextDocument)
4185 return m_contextDocument; 4185 return m_contextDocument;
4186 if (m_frame) 4186 if (m_frame)
4187 return m_weakFactory.createWeakPtr(); 4187 return m_weakFactory.createWeakPtr();
4188 return WeakPtr<Document>(0); 4188 return WeakPtr<Document>(0);
4189 } 4189 }
4190 4190
4191 PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionState& e s) 4191 PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionState& e xceptionState)
4192 { 4192 {
4193 return createAttributeNS(String(), name, es, true); 4193 return createAttributeNS(String(), name, exceptionState, true);
4194 } 4194 }
4195 4195
4196 PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S tring& qualifiedName, ExceptionState& es, bool shouldIgnoreNamespaceChecks) 4196 PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S tring& qualifiedName, ExceptionState& exceptionState, bool shouldIgnoreNamespace Checks)
4197 { 4197 {
4198 String prefix, localName; 4198 String prefix, localName;
4199 if (!parseQualifiedName(qualifiedName, prefix, localName, es)) 4199 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState))
4200 return 0; 4200 return 0;
4201 4201
4202 QualifiedName qName(prefix, localName, namespaceURI); 4202 QualifiedName qName(prefix, localName, namespaceURI);
4203 4203
4204 if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) { 4204 if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
4205 es.throwUninformativeAndGenericDOMException(NamespaceError); 4205 exceptionState.throwUninformativeAndGenericDOMException(NamespaceError);
4206 return 0; 4206 return 0;
4207 } 4207 }
4208 4208
4209 return Attr::create(*this, qName, emptyString()); 4209 return Attr::create(*this, qName, emptyString());
4210 } 4210 }
4211 4211
4212 const SVGDocumentExtensions* Document::svgExtensions() 4212 const SVGDocumentExtensions* Document::svgExtensions()
4213 { 4213 {
4214 return m_svgExtensions.get(); 4214 return m_svgExtensions.get();
4215 } 4215 }
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
5216 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5216 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5217 { 5217 {
5218 if (!isActive()) 5218 if (!isActive())
5219 return; 5219 return;
5220 5220
5221 styleEngine()->modifiedStyleSheet(sheet); 5221 styleEngine()->modifiedStyleSheet(sheet);
5222 styleResolverChanged(when, updateMode); 5222 styleResolverChanged(when, updateMode);
5223 } 5223 }
5224 5224
5225 } // namespace WebCore 5225 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/DatasetDOMStringMap.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698