Files
gerrit/polygerrit-ui/app/elements/core/gr-router/gr-router.html
Wyatt Allen 6d3141fc93 Handle network failures during project lookup
Navigating to nonexistent change numbers should result in a visual 404,
but if the URL uses a legacy pattern (without the change's project) a
lookup is performed for the nonexistent change number using the REST API
interface's `getFromProjectLookup` method.

When this lookup request fails, the method yields undefined (per its
JSDoc signature), but the undefined case is not handled by the router's
URL upgrade and an attempt is made to redirect to the same project-less
URL. The result is an infinite loop of failing network requests.

With this change, additional handling is added for the case when
`getFromProjectLookup` fails.

The network failures generated by this bug were not being displayed in
the UI because gr-router uses an unattached REST API interface, the
events from which are unable to propagate to the app and error manager.
With this change, the interface is now DOM attached so that the expected
404 message appears in this case.

Bug: Issue 7255
Change-Id: Ic9c9f0071e535f642b1d888bf9e4a1d8ab560ede
2017-09-19 14:00:46 -07:00

32 lines
1.3 KiB
HTML

<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../behaviors/base-url-behavior/base-url-behavior.html">
<link rel="import" href="../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html">
<link rel="import" href="../../../behaviors/gr-url-encoding-behavior.html">
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../gr-reporting/gr-reporting.html">
<dom-module id="gr-router">
<template>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="../../../bower_components/page/page.js"></script>
<script src="gr-router.js"></script>
</dom-module>