@@ -142,3 +142,19 @@ assert.strictEqual(url.searchParams, oldParams);
142142 assert . strictEqual ( opts . search , '?l=24' ) ;
143143 assert . strictEqual ( opts . hash , '#test' ) ;
144144}
145+
146+ // Test special origins
147+ [
148+ { expected : 'https://whatwg.org' ,
149+ url : 'blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' } ,
150+ { expected : 'ftp://example.org' , url : 'ftp://example.org/foo' } ,
151+ { expected : 'gopher://gopher.quux.org' , url : 'gopher://gopher.quux.org/1/' } ,
152+ { expected : 'http://example.org' , url : 'http://example.org/foo' } ,
153+ { expected : 'https://example.org' , url : 'https://example.org/foo' } ,
154+ { expected : 'ws://example.org' , url : 'ws://example.org/foo' } ,
155+ { expected : 'wss://example.org' , url : 'wss://example.org/foo' } ,
156+ { expected : 'null' , url : 'file:///tmp/mock/path' } ,
157+ { expected : 'null' , url : 'npm://nodejs/rules' }
158+ ] . forEach ( ( test ) => {
159+ assert . strictEqual ( new URL ( test . url ) . origin , test . expected ) ;
160+ } ) ;
0 commit comments