(rootSegmentGroup: UrlSegmentGroup)
| 119 | } |
| 120 | |
| 121 | private async match(rootSegmentGroup: UrlSegmentGroup): Promise<{ |
| 122 | children: TreeNode<ActivatedRouteSnapshot>[]; |
| 123 | rootSnapshot: ActivatedRouteSnapshot; |
| 124 | }> { |
| 125 | // Use Object.freeze to prevent readers of the Router state from modifying it outside |
| 126 | // of a navigation, resulting in the router being out of sync with the browser. |
| 127 | const rootSnapshot = new ActivatedRouteSnapshot( |
| 128 | [], |
| 129 | Object.freeze({}), |
| 130 | this.queryParams, |
| 131 | this.urlTree.fragment, |
| 132 | Object.freeze({}), |
| 133 | PRIMARY_OUTLET, |
| 134 | this.rootComponentType, |
| 135 | null, |
| 136 | {}, |
| 137 | this.injector, |
| 138 | ); |
| 139 | try { |
| 140 | const children = await this.processSegmentGroup( |
| 141 | this.injector, |
| 142 | this.config, |
| 143 | rootSegmentGroup, |
| 144 | PRIMARY_OUTLET, |
| 145 | rootSnapshot, |
| 146 | ); |
| 147 | return {children, rootSnapshot}; |
| 148 | } catch (e: any) { |
| 149 | if (e instanceof AbsoluteRedirect) { |
| 150 | // Count at the actual root-restart boundary so redirects returned from functions are |
| 151 | // subject to the same limit as static redirects. |
| 152 | this.absoluteRedirectCount++; |
| 153 | if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) { |
| 154 | if (ngDevMode) { |
| 155 | throw new RuntimeError( |
| 156 | RuntimeErrorCode.INFINITE_REDIRECT, |
| 157 | `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${e.urlTree}'.`, |
| 158 | ); |
| 159 | } |
| 160 | this.allowRedirects = false; |
| 161 | } |
| 162 | this.urlTree = e.urlTree; |
| 163 | this.queryParams = Object.freeze({...this.urlTree.queryParams}); |
| 164 | return this.match(e.urlTree.root); |
| 165 | } |
| 166 | if (e instanceof NoMatch) { |
| 167 | throw this.noMatchError(e); |
| 168 | } |
| 169 | |
| 170 | throw e; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | async processSegmentGroup( |
| 175 | injector: EnvironmentInjector, |
no test coverage detected