Commit 493925d2 authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

[Media Router UI] Fix updateMaxHeight() console error

The error appears when we try to update the dialog height before the
container element is initialized. We will update later when the element
is initialized.

Bug: 799912
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ia24832275a46e753da48be9223f0a3ec83463d04
Reviewed-on: https://chromium-review.googlesource.com/919310Reviewed-by: default avatarDerek Cheng <imcheng@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537863}
parent 7b4401f0
......@@ -16,6 +16,9 @@ cr.define('media_router.ui', function() {
// The route-controls element. Is null if the route details view isn't open.
var routeControls = null;
// The initial height for |container|.
var initialMaxHeight = 0;
/**
* Handles response of previous create route attempt.
*
......@@ -64,6 +67,11 @@ cr.define('media_router.ui', function() {
function setElements(mediaRouterContainer, mediaRouterHeader) {
container = mediaRouterContainer;
header = mediaRouterHeader;
if (initialMaxHeight) {
container.updateMaxDialogHeight(initialMaxHeight);
initialMaxHeight = 0;
}
}
/**
......@@ -183,7 +191,12 @@ cr.define('media_router.ui', function() {
* @param {number} height
*/
function updateMaxHeight(height) {
container.updateMaxDialogHeight(height);
if (container) {
container.updateMaxDialogHeight(height);
} else {
// Update the max height once |container| gets set.
initialMaxHeight = height;
}
}
/**
......
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