Error destroying when closing dialog or navigating in Firefox (47.0.1) #282
Description
To reproduce
Put the editor on a dialog
Close the dialog without editing any of the text
An error occurs in in the tinyInstance.remove() calls
Put the editor on a view
Navigate away from the view without making any changes
An error occurs in the tinyInstance.remove() calls
The code in the directive is:
scope.$on('$destroy', function () {
ensureInstance();
if (tinyInstance) {
**tinyInstance.remove();** /// <-- This call errors
tinyInstance = null;
}
});
function ensureInstance() {
if (!tinyInstance) {
tinyInstance = tinymce.get(attrs.id);
}
}
Stack trace:
.serialize@http://localhost:43548/Scripts/vendor/tinymce.min.js:5:19133
A.prototype.getContent@http://localhost:43548/Scripts/vendor/tinymce.min.js:11:19898
A.prototype.save@http://localhost:43548/Scripts/vendor/tinymce.min.js:11:18533
A.prototype.remove@http://localhost:43548/Scripts/vendor/tinymce.min.js:11:21799
.link/<@http://localhost:43548/Scripts/angular-ui/tinymce.js:194:23
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost:43548/Scripts/vendor/angular.js:17767:15
$RootScopeProvider/this.$get</Scope.prototype.$destroy@http://localhost:43548/Scripts/vendor/angular.js:17385:9
afterAnimating@http://localhost:43548/Scripts/angular-ui/ui-bootstrap-tpls.js:3826:11
processQueue@http://localhost:43548/Scripts/vendor/angular.js:16170:28
scheduleProcessQueue/<@http://localhost:43548/Scripts/vendor/angular.js:16186:27
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:43548/Scripts/vendor/angular.js:17444:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:43548/Scripts/vendor/angular.js:17257:15
$RootScopeProvider/this.$get</Scope.prototype.$evalAsync/<@http://localhost:43548/Scripts/vendor/angular.js:17483:15
completeOutstandingRequest@http://localhost:43548/Scripts/vendor/angular.js:5955:7
Browser/self.defer/timeoutId<@http://localhost:43548/Scripts/vendor/angular.js:6234:7