From d599adcc6ab6e6539262e32d5202a26c94d3ca09 Mon Sep 17 00:00:00 2001 From: Chris Nauroth Date: Fri, 30 May 2014 18:07:23 +0000 Subject: [PATCH] YARN-1868. YARN status web ui does not show correctly in IE 11. Contributed by Chuan Liu. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1598686 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/yarn/webapp/view/HtmlPage.java | 3 ++- .../java/org/apache/hadoop/yarn/webapp/TestSubViews.java | 2 +- .../org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java | 9 ++++++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 02f2a3a613..09cf7a1f56 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -171,6 +171,9 @@ Release 2.5.0 - UNRELEASED that both Timeline Server and client can access them. (Zhijie Shen via vinodkv) + YARN-1868. YARN status web ui does not show correctly in IE 11. + (Chuan Liu via cnauroth) + Release 2.4.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlPage.java index e3e6bb8723..9c200f634b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlPage.java @@ -79,7 +79,8 @@ protected HtmlPage(ViewContext ctx) { @Override public void render() { puts(DOCTYPE); - render(page().html().meta_http("Content-type", MimeType.HTML)); + render(page().html().meta_http("X-UA-Compatible", "IE=8") + .meta_http("Content-type", MimeType.HTML)); if (page().nestLevel() != 0) { throw new WebAppException("Error rendering page: nestLevel="+ page().nestLevel()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/TestSubViews.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/TestSubViews.java index 29ac6b4937..66d9ef22c3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/TestSubViews.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/TestSubViews.java @@ -70,6 +70,6 @@ public void render(Block html) { out.flush(); verify(out).print("sub1 text"); verify(out).print("sub2 text"); - verify(out, times(15)).println(); // test inline transition across views + verify(out, times(16)).println(); // test inline transition across views } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java index d99384b78a..a5a8e1f1ce 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java @@ -22,11 +22,12 @@ import java.io.PrintWriter; +import org.apache.hadoop.yarn.webapp.MimeType; import org.apache.hadoop.yarn.webapp.WebAppException; import org.apache.hadoop.yarn.webapp.test.WebAppTests; import org.apache.hadoop.yarn.webapp.view.HtmlPage; - import org.junit.Test; + import static org.mockito.Mockito.*; public class TestHtmlPage { @@ -53,6 +54,12 @@ public void render(Page.HTML<_> html) { Injector injector = WebAppTests.testPage(TestView.class); PrintWriter out = injector.getInstance(PrintWriter.class); + // Verify the HTML page has correct meta tags in the header + verify(out).print(" http-equiv=\"X-UA-Compatible\""); + verify(out).print(" content=\"IE=8\""); + verify(out).print(" http-equiv=\"Content-type\""); + verify(out).print(String.format(" content=\"%s\"", MimeType.HTML)); + verify(out).print("test"); verify(out).print(" id=\"testid\""); verify(out).print("test note");