Merge branch 'stable-2.12'

* stable-2.12:
  Don't serve /gerrit_ui/rpc/* as static content
  Correct issue with Bouncy Castle code signing
  Gerrit: Move XSRF token to onModuleLoad
  TagsIT: Fix broken usage of ExpectedException and project API
  PatchSetInserter: Propagate commit validation exceptions
  Set version to 2.12-rc0

Change-Id: Id0e132a5882f40fdd711e306627d0fafeb197c59
This commit is contained in:
Dave Borowitz
2015-11-10 18:30:15 -05:00
5 changed files with 54 additions and 21 deletions

View File

@@ -415,9 +415,26 @@ public class Gerrit implements EntryPoint {
Cookies.removeCookie("GerritAccount");
}
private void setXsrfToken() {
xGerritAuth = Cookies.getCookie(XSRF_COOKIE_NAME);
Cookies.removeCookie(XSRF_COOKIE_NAME);
JsonUtil.setDefaultXsrfManager(new XsrfManager() {
@Override
public String getToken(JsonDefTarget proxy) {
return xGerritAuth;
}
@Override
public void setToken(JsonDefTarget proxy, String token) {
// Ignore the request, we always rely upon the cookie.
}
});
}
@Override
public void onModuleLoad() {
UserAgent.assertNotInIFrame();
setXsrfToken();
KeyUtil.setEncoderImpl(new KeyUtil.Encoder() {
@Override
@@ -513,8 +530,6 @@ public class Gerrit implements EntryPoint {
editPrefs = null;
onModuleLoad2(result);
}
xGerritAuth = Cookies.getCookie(XSRF_COOKIE_NAME);
Cookies.removeCookie(XSRF_COOKIE_NAME);
}
}));
}
@@ -612,17 +627,6 @@ public class Gerrit implements EntryPoint {
JsonUtil.addRpcStartHandler(RpcStatus.INSTANCE);
JsonUtil.addRpcCompleteHandler(RpcStatus.INSTANCE);
JsonUtil.setDefaultXsrfManager(new XsrfManager() {
@Override
public String getToken(JsonDefTarget proxy) {
return xGerritAuth;
}
@Override
public void setToken(JsonDefTarget proxy, String token) {
// Ignore the request, we always rely upon the cookie.
}
});
gStarting.getElement().getParentElement().removeChild(
gStarting.getElement());