Merge "Use a utility function for reloading the window"
This commit is contained in:
		@@ -55,6 +55,7 @@ import {
 | 
			
		||||
} from '../../../utils/attention-set-util';
 | 
			
		||||
import {CustomKeyboardEvent} from '../../../types/events';
 | 
			
		||||
import {fireEvent} from '../../../utils/event-util';
 | 
			
		||||
import {windowLocationReload} from '../../../utils/dom-util';
 | 
			
		||||
 | 
			
		||||
const NUMBER_FIXED_COLUMNS = 3;
 | 
			
		||||
const CLOSED_STATUS = ['MERGED', 'ABANDONED'];
 | 
			
		||||
@@ -478,7 +479,7 @@ export class GrChangeList extends ChangeTableMixin(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _reloadWindow() {
 | 
			
		||||
    window.location.reload();
 | 
			
		||||
    windowLocationReload();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _toggleChangeStar(e: CustomKeyboardEvent) {
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,10 @@ import {
 | 
			
		||||
} from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin';
 | 
			
		||||
import {GrEditConstants} from '../../edit/gr-edit-constants';
 | 
			
		||||
import {pluralize} from '../../../utils/string-util';
 | 
			
		||||
import {getComputedStyleValue} from '../../../utils/dom-util';
 | 
			
		||||
import {
 | 
			
		||||
  getComputedStyleValue,
 | 
			
		||||
  windowLocationReload,
 | 
			
		||||
} from '../../../utils/dom-util';
 | 
			
		||||
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
 | 
			
		||||
import {getPluginEndpoints} from '../../shared/gr-js-api-interface/gr-plugin-endpoints';
 | 
			
		||||
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
 | 
			
		||||
@@ -896,7 +899,7 @@ export class GrChangeView extends KeyboardShortcutMixin(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _reloadWindow() {
 | 
			
		||||
    window.location.reload();
 | 
			
		||||
    windowLocationReload();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _handleCommitMessageCancel() {
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@ import {
 | 
			
		||||
  ServerErrorEvent,
 | 
			
		||||
  ShowAlertEvent,
 | 
			
		||||
} from '../../../types/events';
 | 
			
		||||
import {windowLocationReload} from '../../../utils/dom-util';
 | 
			
		||||
 | 
			
		||||
const HIDE_ALERT_TIMEOUT_MS = 5000;
 | 
			
		||||
const CHECK_SIGN_IN_INTERVAL_MS = 60 * 1000;
 | 
			
		||||
@@ -446,7 +447,7 @@ export class GrErrorManager extends GestureEventListeners(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _reloadPage() {
 | 
			
		||||
    window.location.reload();
 | 
			
		||||
    windowLocationReload();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _createLoginPopup() {
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,7 @@ import {LocationChangeEventDetail} from '../../../types/events';
 | 
			
		||||
import {GerritView, updateState} from '../../../services/router/router-model';
 | 
			
		||||
import {firePageError} from '../../../utils/event-util';
 | 
			
		||||
import {addQuotesWhen} from '../../../utils/string-util';
 | 
			
		||||
import {windowLocationReload} from '../../../utils/dom-util';
 | 
			
		||||
 | 
			
		||||
const RoutePattern = {
 | 
			
		||||
  ROOT: '/',
 | 
			
		||||
@@ -1725,7 +1726,7 @@ export class GrRouter extends GestureEventListeners(
 | 
			
		||||
   * by the catchall _handleDefaultRoute handler.
 | 
			
		||||
   */
 | 
			
		||||
  _handlePassThroughRoute() {
 | 
			
		||||
    location.reload();
 | 
			
		||||
    windowLocationReload();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
@@ -1762,7 +1763,7 @@ export class GrRouter extends GestureEventListeners(
 | 
			
		||||
 | 
			
		||||
  _handleDocumentationRedirectRoute(data: PageContextWithQueryMap) {
 | 
			
		||||
    if (data.params[1]) {
 | 
			
		||||
      location.reload();
 | 
			
		||||
      windowLocationReload();
 | 
			
		||||
    } else {
 | 
			
		||||
      // Redirect /Documentation to /Documentation/index.html
 | 
			
		||||
      this._redirect('/Documentation/index.html');
 | 
			
		||||
 
 | 
			
		||||
@@ -79,6 +79,7 @@ import {
 | 
			
		||||
import {ViewState} from '../types/types';
 | 
			
		||||
import {EventType} from '../utils/event-util';
 | 
			
		||||
import {GerritView} from '../services/router/router-model';
 | 
			
		||||
import {windowLocationReload} from '../utils/dom-util';
 | 
			
		||||
 | 
			
		||||
interface ErrorInfo {
 | 
			
		||||
  text: string;
 | 
			
		||||
@@ -241,7 +242,7 @@ export class GrAppElement extends KeyboardShortcutMixin(
 | 
			
		||||
    // Ideally individual views should handle this event and respond with a soft
 | 
			
		||||
    // reload. This is a catch-all for all views that cannot or have not
 | 
			
		||||
    // implemented that.
 | 
			
		||||
    this.addEventListener('reload', () => window.location.reload());
 | 
			
		||||
    this.addEventListener('reload', () => windowLocationReload());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /** @override */
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@ import {RevisionInfo, ChangeInfo, RequestPayload} from '../../../types/common';
 | 
			
		||||
import {ShowAlertEventDetail} from '../../../types/events';
 | 
			
		||||
import {PluginApi} from '../../plugins/gr-plugin-types';
 | 
			
		||||
import {UIActionInfo} from './gr-change-actions-js-api';
 | 
			
		||||
import {windowLocationReload} from '../../../utils/dom-util';
 | 
			
		||||
 | 
			
		||||
interface GrPopupInterface {
 | 
			
		||||
  close(): void;
 | 
			
		||||
@@ -57,7 +58,7 @@ export class GrPluginActionContext {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  refresh() {
 | 
			
		||||
    window.location.reload();
 | 
			
		||||
    windowLocationReload();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  textfield(): HTMLElement {
 | 
			
		||||
 
 | 
			
		||||
@@ -153,6 +153,12 @@ export function querySelectorAll(
 | 
			
		||||
  return [...results];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function windowLocationReload() {
 | 
			
		||||
  const e = new Error();
 | 
			
		||||
  console.info(`Calling window.location.realod(): ${e.stack}`);
 | 
			
		||||
  window.location.reload();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Retrieves the dom path of the current event.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user