|
3 | 3 | constutil=require('util'); |
4 | 4 | const{ |
5 | 5 | hexTable, |
6 | | - isHexTable, |
7 | | - StorageObject |
| 6 | + isHexTable |
8 | 7 | }=require('internal/querystring'); |
9 | 8 | constbinding=process.binding('url'); |
10 | 9 | constcontext=Symbol('context'); |
@@ -97,6 +96,26 @@ class TupleOrigin{ |
97 | 96 | } |
98 | 97 | } |
99 | 98 |
|
| 99 | +// This class provides the internal state of a URL object. An instance of this |
| 100 | +// class is stored in every URL object and is accessed internally by setters |
| 101 | +// and getters. It roughly corresponds to the concept of a URL record in the |
| 102 | +// URL Standard, with a few differences. It is also the object transported to |
| 103 | +// the C++ binding. |
| 104 | +// Refs: https://url.spec.whatwg.org/#concept-url |
| 105 | +classURLContext{ |
| 106 | +constructor(){ |
| 107 | +this.flags=0; |
| 108 | +this.scheme=undefined; |
| 109 | +this.username=undefined; |
| 110 | +this.password=undefined; |
| 111 | +this.host=undefined; |
| 112 | +this.port=undefined; |
| 113 | +this.path=[]; |
| 114 | +this.query=undefined; |
| 115 | +this.fragment=undefined; |
| 116 | +} |
| 117 | +} |
| 118 | + |
100 | 119 | functiononParseComplete(flags,protocol,username,password, |
101 | 120 | host,port,path,query,fragment){ |
102 | 121 | varctx=this[context]; |
@@ -125,7 +144,7 @@ function onParseError(flags, input){ |
125 | 144 | // Reused by URL constructor and URL#href setter. |
126 | 145 | functionparse(url,input,base){ |
127 | 146 | constbase_context=base ? base[context] : undefined; |
128 | | -url[context]=newStorageObject(); |
| 147 | +url[context]=newURLContext(); |
129 | 148 | binding.parse(input.trim(),-1, |
130 | 149 | base_context,undefined, |
131 | 150 | onParseComplete.bind(url),onParseError); |
|
0 commit comments