[FIX] web, *: make crash_manager use services correctly
* = website_forum, stock Fix for: https://github.com/odoo/odoo/pull/32132 crash_manager.js was using the services while bypassing ServiceProviderMixin That means all services are duplicated, each having their own state. To fix this issue, CrashManager now extends AbstractService. Also crash_manager is now registered in serviceRegistry instead of being instanciated on the fly. The crash_manager now being a Service raise one issue with the tests: The services are not run for the tests but some tests needs the crash_manager 'unhandledrejection' listener. For that matter the services are reenable in qunit. Also the crash_manager's 'unhandledrejection' listener has to have precedence over the qunit listener as it will handle rejections wich have no reason or are not Errors. Part of: https://github.com/odoo/odoo/pull/35209
This commit is contained in:
@@ -10,7 +10,6 @@ odoo.define('web.basic_fields', function (require) {
|
||||
var AbstractField = require('web.AbstractField');
|
||||
var config = require('web.config');
|
||||
var core = require('web.core');
|
||||
var crash_manager = require('web.crash_manager');
|
||||
var datepicker = require('web.datepicker');
|
||||
var dom = require('web.dom');
|
||||
var Domain = require('web.Domain');
|
||||
@@ -1928,11 +1927,10 @@ var FieldBinaryFile = AbstractFieldBinary.extend({
|
||||
ev.stopPropagation();
|
||||
} else if (this.res_id) {
|
||||
framework.blockUI();
|
||||
var c = crash_manager;
|
||||
var filename_fieldname = this.attrs.filename;
|
||||
this.getSession().get_file({
|
||||
'url': '/web/content',
|
||||
'data': {
|
||||
complete: framework.unblockUI,
|
||||
data: {
|
||||
'model': this.model,
|
||||
'id': this.res_id,
|
||||
'field': this.name,
|
||||
@@ -1941,8 +1939,8 @@ var FieldBinaryFile = AbstractFieldBinary.extend({
|
||||
'download': true,
|
||||
'data': utils.is_bin_size(this.value) ? null : this.value,
|
||||
},
|
||||
'complete': framework.unblockUI,
|
||||
'error': c.rpc_error.bind(c),
|
||||
error: () => this.call('crash_manager', 'rpc_error', ...arguments),
|
||||
url: '/web/content',
|
||||
});
|
||||
ev.stopPropagation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user