IE crash in pdf viewer onDestroy

Hello All,

I get this error on IE when leaving any page that has pdfviewerComponent in it. The Issue doesn't exist on chrome , edge and Firefox (Only IE).

IE version: 11.900.18362.0
sybcfusion pdf version :     "@syncfusion/ej2-angular-pdfviewer": "^18.1.55",

Error Stack: 
ERROR Error: Uncaught (in promise): TypeError: Unable to get property 'removeChild' of undefined or null reference
TypeError: Unable to get property 'removeChild' of undefined or null reference
   at PdfViewerBase.prototype.destroy (https://localhost:44356/vendor.js:608859:9)
   at PdfViewer.prototype.destroy (https://localhost:44356/vendor.js:619550:9)
   at ComponentBase.prototype.ngOnDestroy (https://localhost:44356/vendor.js:96970:13)
   at PdfViewerComponent.prototype.ngOnDestroy (https://localhost:44356/vendor.js:254403:9)
   at callProviderLifecycles (https://localhost:44356/vendor.js:59541:9)
   at callElementProvidersLifecycles (https://localhost:44356/vendor.js:59509:13)
   at callLifecycleHooksChildrenFirst (https://localhost:44356/vendor.js:59499:17)
   at destroyView (https://localhost:44356/vendor.js:67695:5)
   at callViewAction (https://localhost:44356/vendor.js:67821:13)
   at execComponentViewsAction (https://localhost:44356/vendor.js:67743:13)
   "ERROR"
   {
      [functions]: ,
      __proto__: { },
      description: "Uncaught (in promise): TypeError: Unable to get property 'removeChild' of undefined or null reference
TypeError: Unable to get property 'removeChild' of undefined or null reference
   at PdfViewerBase.prototype.destroy (https://localhost:44356/vendor.js:608859:9)
   at PdfViewer.prototype.destroy (https://localhost:44356/vendor.js:619550:9)
   at ComponentBase.prototype.ngOnDestroy (https://localhost:44356/vendor.js:96970:13)
   at PdfViewerComponent.prototype.ngOnDestroy (https://localhost:44356/vendor.js:254403:9)
   at callProviderLifecycles (https://localhost:44356/vendor.js:59541:9)
   at callElementProvidersLifecycles (https://localhost:44356/vendor.js:59509:13)
   at callLifecycleHooksChildrenFirst (https://localhost:44356/vendor.js:59499:17)
   at destroyView (https://localhost:44356/vendor.js:67695:5)
   at callViewAction (https://localhost:44356/vendor.js:67821:13)
   at execComponentViewsAction (https://localhost:44356/vendor.js:67743:13)",
      message: "Uncaught (in promise): TypeError: Unable to get property 'removeChild' of undefined or null reference
TypeError: Unable to get property 'removeChild' of undefined or null reference
   at PdfViewerBase.prototype.destroy (https://localhost:44356/vendor.js:608859:9)
   at PdfViewer.prototype.destroy (https://localhost:44356/vendor.js:619550:9)
   at ComponentBase.prototype.ngOnDestroy (https://localhost:44356/vendor.js:96970:13)
   at PdfViewerComponent.prototype.ngOnDestroy (https://localhost:44356/vendor.js:254403:9)
   at callProviderLifecycles (https://localhost:44356/vendor.js:59541:9)
   at callElementProvidersLifecycles (https://localhost:44356/vendor.js:59509:13)
   at callLifecycleHooksChildrenFirst (https://localhost:44356/vendor.js:59499:17)
   at destroyView (https://localhost:44356/vendor.js:67695:5)
   at callViewAction (https://localhost:44356/vendor.js:67821:13)
   at execComponentViewsAction (https://localhost:44356/vendor.js:67743:13)",
      name: "Error",
      promise: { },
      rejection: { },
      stack: "Error: Uncaught (in promise): TypeError: Unable to get property 'removeChild' of undefined or null reference
TypeError: Unable to get property 'removeChild' of undefined or null reference
   at PdfViewerBase.prototype.destroy (https://localhost:44356/vendor.js:608859:9)
   at PdfViewer.prototype.destroy (https://localhost:44356/vendor.js:619550:9)
   at ComponentBase.prototype.ngOnDestroy (https://localhost:44356/vendor.js:96970:13)
   at PdfViewerComponent.prototype.ngOnDestroy (https://localhost:44356/vendor.js:254403:9)
   at callProviderLifecycles (https://localhost:44356/vendor.js:59541:9)
   at callElementProvidersLifecycles (https://localhost:44356/vendor.js:59509:13)
   at callLifecycleHooksChildrenFirst (https://localhost:44356/vendor.js:59499:17)
   at destroyView (https://localhost:44356/vendor.js:67695:5)
   at callViewAction (https://localhost:44356/vendor.js:67821:13)
   at execComponentViewsAction (https://localhost:44356/vendor.js:67743:13)
   at resolvePromise (https://localhost:44356/polyfil",
      Symbol()_8.lhzs7dybhh8: undefined,
      Symbol(INITIAL_VALUE)_j.lhzs7dybhh8: undefined,
      Symbol(rxSubscriber)_i.lhzs7dybhh8: undefined,
      task: { },
      zone: { }
   }

So please Advise , How to fix it , or If I need to add some polyfills to fix this.

Thanks,
Mohamed


4 Replies

MO Mohamed July 15, 2020 12:05 PM UTC

In this function specifically , The highlighted line
 PdfViewerBase.prototype.destroy = function () {
        if (_syncfusion_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
            this.pdfViewer.element.classList.remove('e-pv-mobile-view');
        }
        this.unWireEvents();
        this.clear(false);
        this.pageContainer.parentNode.removeChild(this.pageContainer);
        this.viewerContainer.parentNode.removeChild(this.viewerContainer);
        this.contextMenuModule.destroy();
        if (this.pdfViewer.toolbarModule) {
            this.navigationPane.destroy();
        }
        var measureElement = document.getElementById('measureElement');
        if (measureElement) {
            measureElement = undefined;
        }
    };


AA Akshaya Arivoli Syncfusion Team July 17, 2020 02:01 PM UTC

Hi Mohamed , 

Thank you for contacting Syncfusion support 

We are unable to reproduce the reported issue with the provided details. We have shared the sample in which we have tried to reproduce the issue in the below link, 


Please try it and revert us with more details and the modified sample if you need further assistance. 
Regards, 
Akshaya 



MO Mohamed July 17, 2020 04:59 PM UTC

The sample link not working on IE11, However the problem is not in the this.pdfviewerControl.ngOnDestroy(); T
The problem occurs when you navigate from the page that contains "ejx-pdfviewer" to any other page. The the function Highlighted in the previous reply is called and show the specified error. Thanks, Mohamed


AA Akshaya Arivoli Syncfusion Team July 23, 2020 04:26 PM UTC

Hi Mohamed, 

Thank you for your patience. 

We are unable to render the PDF Viewer in IE we are currently checking on it. Meanwhile can you please share us the sample in which you are facing the issue. Also can you please try with our latest Essential Studio version and revert us with more details if you still have any concerns on this. 

Regards, 
Akshaya 


Loader.
Up arrow icon