Commit 54244846 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Make URL handling timeout error more developper friendly

parent 90d6cfdf
......@@ -55,12 +55,22 @@
return window.location.replace(hash);
}
function synchronousChangeState(hash) {
changeState(hash);
function timeoutUrlChange() {
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return new RSVP.Queue()
.push(function () {
return RSVP.timeout(REDIRECT_TIMEOUT);
})
.push(undefined, function () {
throw new Error('URL handling timeout: ' + window.location.hash);
});
}
function synchronousChangeState(hash) {
changeState(hash);
return timeoutUrlChange();
}
//////////////////////////////////////////////////////////////////
......@@ -500,6 +510,8 @@
//////////////////////////////////////////////////////////////////
function routeMethodLess(gadget) {
// Nothing. Go to front page
// If no frontpage is configured, his may comes from missing configuration on website
// or default HTML gadget modification date more recent than the website modification date
return gadget.getSetting("frontpage_gadget")
.push(function (result) {
return synchronousChangeState(
......@@ -767,11 +779,7 @@
return this.getCommandUrlFor(options)
.push(function (hash) {
window.location.replace(hash);
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT);
return timeoutUrlChange();
});
})
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.17472.32633.64870</string> </value>
<value> <string>952.5855.32841.20582</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1452242357.34</float>
<float>1466782122.1</float>
<string>UTC</string>
</tuple>
</state>
......
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