summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core.js
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2014-04-14 12:53:33 +0200
committerSimon Lejeune <sle@openerp.com>2014-04-14 12:53:33 +0200
commitfaadf0fec4c577e984d916e7fd54c2a42ad621c5 (patch)
tree9b350b5e6b85e8dd491c42fb5bea57fe4d4c6723 /addons/web/static/src/js/core.js
parentf8664c8d97443e2e3d31242fc8969ac28ee5cad3 (diff)
[FIX] get_file error: the exception can be the only node and must be json parsed
bzr revid: sle@openerp.com-20140414105333-05jona7myntifamw
Diffstat (limited to 'addons/web/static/src/js/core.js')
-rw-r--r--addons/web/static/src/js/core.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js
index 90c84ba9cda..45ed6f41c6f 100644
--- a/addons/web/static/src/js/core.js
+++ b/addons/web/static/src/js/core.js
@@ -460,14 +460,11 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
.appendTo(document.body)
.load(function () {
try {
- if (options.error) {
- if (!this.contentDocument.body.childNodes[1]) {
- options.error(this.contentDocument.body.childNodes);
- }
- else {
- options.error(JSON.parse(this.contentDocument.body.childNodes[1].textContent));
- }
- }
+ if (options.error) {
+ var body = this.contentDocument.body;
+ var node = body.childNodes[1] || body.childNodes[0];
+ options.error(JSON.parse(node.textContent));
+ }
} finally {
complete();
}