Conditionally allow Gerrit to load in IFrame

Introduce new configuration option (gerrit.canLoadInIFrame) to allow
loading Gerrit in IFrame. By default it is set to 'false' to keep
current behavior.

Change-Id: Ie13b6141a9dfb8a18348fc778fb5f6083f95bd14
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
This commit is contained in:
Dariusz Luksza
2014-04-03 17:05:47 +02:00
committed by Shawn Pearce
parent c282d7b282
commit 7a046da6f5
4 changed files with 18 additions and 1 deletions

View File

@@ -405,7 +405,9 @@ public class Gerrit implements EntryPoint {
@Override
public void onModuleLoad() {
UserAgent.assertNotInIFrame();
if (!canLoadInIFrame()) {
UserAgent.assertNotInIFrame();
}
setXsrfToken();
KeyUtil.setEncoderImpl(new KeyUtil.Encoder() {
@@ -507,6 +509,10 @@ public class Gerrit implements EntryPoint {
}));
}
private native boolean canLoadInIFrame() /*-{
return $wnd.gerrit_hostpagedata.canLoadInIFrame || false;
}-*/;
private static void initHostname() {
myHost = Location.getHostName();
final int d1 = myHost.indexOf('.');