Commit 8c68ea43 authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS Cellular] Fix double-backward navigation when dongle unplugged.

When a cellular dongle is unplugged when the InternetDetailPage is
visible, we "close" the dialog by navigating backward. However, this
navigation is performed within a requestAnimationFrame() call, meaning
that it is asynchronously performed sometime before the next repaint.

It is possible that close() is called multiple times before the repaint
actually occurs, resulting in multiple backward navigations. When
settings is opened via chrome://settings in a browser tab (rather than
from within a standalone settings window), this results in the browser
navigating back to the page *before* the settings page was loaded, which
is usually the NTP.

This CL fixes this issue by simply returning early if close() has
already been called.

Bug: 956498
Change-Id: Iecbfb0f8a9e9db14e7d5ece40253686001ce8d18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1622482
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662255}
parent f982e3e4
...@@ -256,6 +256,12 @@ Polymer({ ...@@ -256,6 +256,12 @@ Polymer({
}, },
close: function() { close: function() {
// If the page is already closed, return early to avoid navigating backward
// erroneously.
if (!this.guid) {
return;
}
this.guid = ''; this.guid = '';
// Delay navigating to allow other subpages to load first. // Delay navigating to allow other subpages to load first.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment