* @param {string} href * @param {!FakeWindow} win * @param {?History} history
(href, win, history)
| 414 | * @param {?History} history |
| 415 | */ |
| 416 | constructor(href, win, history) { |
| 417 | /** @const {!Window} */ |
| 418 | this.win = win; |
| 419 | |
| 420 | /** @private @const {?History} */ |
| 421 | this.history_ = history; |
| 422 | |
| 423 | /** @const {!Array<!Location>} */ |
| 424 | this.changes = []; |
| 425 | |
| 426 | /** @private {!Location} */ |
| 427 | this.url_ = parseUrlDeprecated(href, true); |
| 428 | |
| 429 | // href |
| 430 | Object.defineProperty(this, 'href', { |
| 431 | get: () => this.url_.href, |
| 432 | set: (href) => this.assign(href), |
| 433 | configurable: true, |
| 434 | }); |
| 435 | |
| 436 | const properties = [ |
| 437 | 'protocol', |
| 438 | 'host', |
| 439 | 'hostname', |
| 440 | 'port', |
| 441 | 'pathname', |
| 442 | 'search', |
| 443 | 'hash', |
| 444 | 'origin', |
| 445 | ]; |
| 446 | properties.forEach((property) => { |
| 447 | Object.defineProperty(this, property, { |
| 448 | get: () => this.url_[property], |
| 449 | }); |
| 450 | }); |
| 451 | |
| 452 | if (this.history_) { |
| 453 | this.history_.replaceState( |
| 454 | null, |
| 455 | '', |
| 456 | this.url_.href, |
| 457 | /* fireEvent */ false |
| 458 | ); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * @param {string} href |
nothing calls this directly
no test coverage detected