Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
9a18e260 by Cédric Krier at 2023-07-12T17:09:02+02:00
Ensure to always revoke Object URL created for document widget
If object is loaded before the onload function is set, the Object URL is not
revoked. To be sure we revoke the previous Object URL and we set the function
before changing the data attribute.
- - - - -
1 changed file:
- sao/src/view/form.js
Changes:
=====================================
sao/src/view/form.js
=====================================
@@ -4444,6 +4444,8 @@
if (record !== this.record) {
return;
}
+ // in case onload was not yet triggered
+ window.URL.revokeObjectURL(this.object.attr('data'));
if (!data) {
url = null;
} else {
@@ -4456,5 +4458,5 @@
});
url = window.URL.createObjectURL(blob);
}
- this.object.attr('data', url);
+ // set onload before data to be always called
this.object.get(0).onload = function() {
@@ -4460,3 +4462,4 @@
this.object.get(0).onload = function() {
+ this.onload = null;
window.URL.revokeObjectURL(url);
};
@@ -4461,5 +4464,6 @@
window.URL.revokeObjectURL(url);
};
+ this.object.attr('data', url);
});
},
});
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/9a18e2600e9c77a098d96a5794f277b933ba3797
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/9a18e2600e9c77a098d96a5794f277b933ba3797
You're receiving this email because of your account on foss.heptapod.net.