@@ -25,17 +25,18 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
2525
2626 function arrivingHereIsGood ( aResult ) {
2727 ok ( true , "Good result! Received a: " + aResult ) ;
28- return Promise . resolve ( ) ;
2928 }
3029
3130 function arrivingHereIsBad ( aResult ) {
3231 ok ( false , "Bad result! Received a: " + aResult ) ;
33- return Promise . resolve ( ) ;
3432 }
3533
3634 function expectSecurityError ( aResult ) {
3735 ok ( aResult . toString ( ) . startsWith ( "SecurityError" ) , "Expecting a SecurityError" ) ;
38- return Promise . resolve ( ) ;
36+ }
37+
38+ function expectTypeError ( aResult ) {
39+ ok ( aResult . toString ( ) . startsWith ( "TypeError" ) , "Expecting a TypeError" ) ;
3940 }
4041
4142 function keepThisPublicKeyCredential ( aIdentifier ) {
@@ -66,7 +67,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
6667 var testFuncs = [
6768 function ( ) {
6869 // Test basic good call
69- let rp = { id : document . domain } ;
70+ let rp = { id : document . domain , name : "none" } ;
7071 let makeCredentialOptions = {
7172 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
7273 } ;
@@ -78,15 +79,24 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
7879 function ( ) {
7980 // Test rp.id being unset
8081 let makeCredentialOptions = {
81- rp : { } , user : user , challenge : chall , pubKeyCredParams : [ param ]
82+ rp : { name : "none" } , user : user , challenge : chall , pubKeyCredParams : [ param ]
8283 } ;
8384 return credm . create ( { publicKey : makeCredentialOptions } )
8485 . then ( arrivingHereIsGood )
8586 . catch ( arrivingHereIsBad ) ;
8687 } ,
88+ function ( ) {
89+ // Test rp.name being unset
90+ let makeCredentialOptions = {
91+ rp : { id : document . domain } , user : user , challenge : chall , pubKeyCredParams : [ param ]
92+ } ;
93+ return credm . create ( { publicKey : makeCredentialOptions } )
94+ . then ( arrivingHereIsBad )
95+ . catch ( expectTypeError ) ;
96+ } ,
8797 function ( ) {
8898 // Test this origin with optional fields
89- let rp = { id : "user:pass@" + document . domain + ":8888" } ;
99+ let rp = { id : "user:pass@" + document . domain + ":8888" , name : "none" } ;
90100 let makeCredentialOptions = {
91101 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
92102 } ;
@@ -96,7 +106,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
96106 } ,
97107 function ( ) {
98108 // Test blank rp.id
99- let rp = { id : "" } ;
109+ let rp = { id : "" , name : "none" } ;
100110 let makeCredentialOptions = {
101111 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
102112 } ;
@@ -106,7 +116,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
106116 } ,
107117 function ( ) {
108118 // Test subdomain of this origin
109- let rp = { id : "subdomain." + document . domain } ;
119+ let rp = { id : "subdomain." + document . domain , name : "none" } ;
110120 let makeCredentialOptions = {
111121 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
112122 } ;
@@ -116,7 +126,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
116126 } ,
117127 function ( ) {
118128 // Test the same origin
119- let rp = { id : "example.com" } ;
129+ let rp = { id : "example.com" , name : "none" } ;
120130 let makeCredentialOptions = {
121131 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
122132 } ;
@@ -126,7 +136,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
126136 } ,
127137 function ( ) {
128138 // Test the eTLD
129- let rp = { id : "com" } ;
139+ let rp = { id : "com" , name : "none" } ;
130140 let makeCredentialOptions = {
131141 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
132142 } ;
@@ -136,7 +146,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
136146 } ,
137147 function ( ) {
138148 // Test a different domain within the same TLD
139- let rp = { id : "alt.test" } ;
149+ let rp = { id : "alt.test" , name : "none" } ;
140150 let makeCredentialOptions = {
141151 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
142152 } ;
@@ -233,7 +243,7 @@ <h1>Test Same Origin Policy for W3C Web Authentication</h1>
233243 } ,
234244 function ( ) {
235245 // Test basic good Create call but using an origin (Bug 1380421)
236- let rp = { id : window . origin } ;
246+ let rp = { id : window . origin , name : "none" } ;
237247 let makeCredentialOptions = {
238248 rp : rp , user : user , challenge : chall , pubKeyCredParams : [ param ]
239249 } ;
0 commit comments