* Attempts to locate the Firefox executable for this release channel. This * will first check the default installation location for the channel before * checking the user's PATH. The returned promise will be rejected if Firefox * can not be found. * * @return {!Promise } A prom
()
| 694 | * Firefox executable. |
| 695 | */ |
| 696 | locate() { |
| 697 | if (this.found_) { |
| 698 | return this.found_ |
| 699 | } |
| 700 | |
| 701 | let found |
| 702 | switch (process.platform) { |
| 703 | case 'darwin': |
| 704 | found = io.exists(this.darwin_).then((exists) => (exists ? this.darwin_ : io.findInPath('firefox'))) |
| 705 | break |
| 706 | |
| 707 | case 'win32': |
| 708 | found = findInProgramFiles(this.win32_).then((found) => found || io.findInPath('firefox.exe')) |
| 709 | break |
| 710 | |
| 711 | default: |
| 712 | found = Promise.resolve(io.findInPath('firefox')) |
| 713 | break |
| 714 | } |
| 715 | |
| 716 | this.found_ = found.then((found) => { |
| 717 | if (found) { |
| 718 | // TODO: verify version info. |
| 719 | return found |
| 720 | } |
| 721 | throw Error('Could not locate Firefox on the current system') |
| 722 | }) |
| 723 | return this.found_ |
| 724 | } |
| 725 | |
| 726 | /** @return {!Promise<string>} */ |
| 727 | [Symbols.serialize]() { |