Skip to content

Commit da44202

Browse files
committed
Bug 1358104 - Only throw InvalidCharacterError for bad XML id's, not NamespaceError r=baku
Discussion at <whatwg/dom#319>. In short, the specification used to say to throw sometimes InvalidCharacterError and sometimes NamespaceError, but browsers disagreed on which to throw in corner cases, and everyone agreed it wasn't worth the effort to spec the distinction, so we just changed it to InvalidCharacterError across the board. The test changes are already upstream. MozReview-Commit-ID: AWSZBznQprG UltraBlame original commit: b57cea7362656856b373828a932ceb3d8a84400f
1 parent f91a71c commit da44202

11 files changed

Lines changed: 60 additions & 173 deletions

‎dom/base/nsContentUtils.cpp‎

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17415,44 +17415,10 @@ return
1741517415
NS_OK
1741617416
;
1741717417
}
17418-
/
17419-
/
17420-
MOZ_EXPAT_EMPTY_QNAME
17421-
|
17422-
|
17423-
MOZ_EXPAT_INVALID_CHARACTER
17424-
if
17425-
(
17426-
result
17427-
=
17428-
=
17429-
(
17430-
1
17431-
<
17432-
<
17433-
0
17434-
)
17435-
|
17436-
|
17437-
result
17438-
=
17439-
=
17440-
(
17441-
1
17442-
<
17443-
<
17444-
1
17445-
)
17446-
)
17447-
{
1744817418
return
1744917419
NS_ERROR_DOM_INVALID_CHARACTER_ERR
1745017420
;
1745117421
}
17452-
return
17453-
NS_ERROR_DOM_NAMESPACE_ERR
17454-
;
17455-
}
1745617422
/
1745717423
/
1745817424
static

‎dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -864,33 +864,22 @@
864864
{
865865
success
866866
=
867-
(
868-
typeof
869-
(
870867
ex
871868
.
872869
code
873-
)
874-
!
875870
=
876-
'
877-
undefined
878-
'
879-
&
880-
&
881-
ex
882-
.
883-
code
884871
=
885872
=
886-
14
887-
)
873+
DOMException
874+
.
875+
INVALID_CHARACTER_ERR
888876
;
889877
}
890878
assertTrue
891879
(
892880
"
893-
throw_NAMESPACE_ERR
881+
throw
882+
INVALID_CHARACTER_ERR
894883
"
895884
success
896885
)

‎dom/tests/mochitest/dom-level2-core/test_createDocument01.html‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -909,33 +909,22 @@
909909
{
910910
success
911911
=
912-
(
913-
typeof
914-
(
915912
ex
916913
.
917914
code
918-
)
919-
!
920915
=
921-
'
922-
undefined
923-
'
924-
&
925-
&
926-
ex
927-
.
928-
code
929916
=
930917
=
931-
14
932-
)
918+
DOMException
919+
.
920+
INVALID_CHARACTER_ERR
933921
;
934922
}
935923
assertTrue
936924
(
937925
"
938-
throw_NAMESPACE_ERR
926+
throw
927+
INVALID_CHARACTER_ERR
939928
"
940929
success
941930
)

‎dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -896,33 +896,22 @@
896896
{
897897
success
898898
=
899-
(
900-
typeof
901-
(
902899
ex
903900
.
904901
code
905-
)
906-
!
907902
=
908-
'
909-
undefined
910-
'
911-
&
912-
&
913-
ex
914-
.
915-
code
916903
=
917904
=
918-
14
919-
)
905+
DOMException
906+
.
907+
INVALID_CHARACTER_ERR
920908
;
921909
}
922910
assertTrue
923911
(
924912
"
925-
throw_NAMESPACE_ERR
913+
throw
914+
INVALID_CHARACTER_ERR
926915
"
927916
success
928917
)

‎dom/tests/mochitest/dom-level2-core/test_createElementNS01.html‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -868,33 +868,22 @@
868868
{
869869
success
870870
=
871-
(
872-
typeof
873-
(
874871
ex
875872
.
876873
code
877-
)
878-
!
879874
=
880-
'
881-
undefined
882-
'
883-
&
884-
&
885-
ex
886-
.
887-
code
888875
=
889876
=
890-
14
891-
)
877+
DOMException
878+
.
879+
INVALID_CHARACTER_ERR
892880
;
893881
}
894882
assertTrue
895883
(
896884
"
897-
throw_NAMESPACE_ERR
885+
throw
886+
INVALID_CHARACTER_ERR
898887
"
899888
success
900889
)

‎dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -840,27 +840,15 @@
840840
{
841841
success
842842
=
843-
(
844-
typeof
845-
(
846843
ex
847844
.
848845
code
849-
)
850-
!
851846
=
852-
'
853-
undefined
854-
'
855-
&
856-
&
857-
ex
858-
.
859-
code
860847
=
861848
=
862-
14
863-
)
849+
DOMException
850+
.
851+
INVALID_CHARACTER_ERR
864852
;
865853
}
866854
assertTrue

‎dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -747,27 +747,15 @@
747747
{
748748
success
749749
=
750-
(
751-
typeof
752-
(
753750
ex
754751
.
755752
code
756-
)
757-
!
758753
=
759-
'
760-
undefined
761-
'
762-
&
763-
&
764-
ex
765-
.
766-
code
767754
=
768755
=
769-
14
770-
)
756+
DOMException
757+
.
758+
INVALID_CHARACTER_ERR
771759
;
772760
}
773761
assertTrue

‎dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -871,33 +871,22 @@
871871
{
872872
success
873873
=
874-
(
875-
typeof
876-
(
877874
ex
878875
.
879876
code
880-
)
881-
!
882877
=
883-
'
884-
undefined
885-
'
886-
&
887-
&
888-
ex
889-
.
890-
code
891878
=
892879
=
893-
14
894-
)
880+
DOMException
881+
.
882+
INVALID_CHARACTER_ERR
895883
;
896884
}
897885
assertTrue
898886
(
899887
"
900-
throw_NAMESPACE_ERR
888+
throw
889+
INVALID_CHARACTER_ERR
901890
"
902891
success
903892
)

‎testing/web-platform/tests/dom/nodes/DOMImplementation-createDocumentType.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@
11121112
"
11131113
"
11141114
"
1115-
NAMESPACE_ERR
1115+
INVALID_CHARACTER_ERR
11161116
"
11171117
]
11181118
[
@@ -1125,7 +1125,7 @@
11251125
"
11261126
"
11271127
"
1128-
NAMESPACE_ERR
1128+
INVALID_CHARACTER_ERR
11291129
"
11301130
]
11311131
[
@@ -1140,7 +1140,7 @@
11401140
"
11411141
"
11421142
"
1143-
NAMESPACE_ERR
1143+
INVALID_CHARACTER_ERR
11441144
"
11451145
]
11461146
[

0 commit comments

Comments
 (0)