WebBrowser/WebBrowserView.py

changeset 5491
a9d9f294de64
parent 5389
9b1c800daff3
child 5526
11337e4fba52
--- a/WebBrowser/WebBrowserView.py	Sun Feb 05 19:02:52 2017 +0100
+++ b/WebBrowser/WebBrowserView.py	Tue Feb 07 18:54:42 2017 +0100
@@ -1474,12 +1474,19 @@
         if status == QWebEnginePage.NormalTerminationStatus:
             return
         
-        QTimer.singleShot(0, self.__showTabCrashPage)
+        QTimer.singleShot(0, lambda: self.__showTabCrashPage(status))
     
-    def __showTabCrashPage(self):
+    def __showTabCrashPage(self, status):
         """
         Private slot to show the tab crash page.
+        
+        @param status termination status
+        @type QWebEnginePage.RenderProcessTerminationStatus
         """
+        self.page().deleteLater()
+        self.__page = WebBrowserPage(self)
+        self.setPage(self.__page)
+        
         html = readAllFileContents(":/html/tabCrashPage.html")
         html = html.replace("@IMAGE@", pixmapToDataUrl(
             qApp.style().standardIcon(QStyle.SP_MessageBoxWarning).pixmap(
@@ -1487,18 +1494,24 @@
         html = html.replace("@FAVICON@", pixmapToDataUrl(
             qApp.style() .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(
                 16, 16)).toString())
-        html = html.replace("@TITLE@", self.tr("Failed loading page"))
-        html = html.replace("@H1@", self.tr("Failed loading page"))
+        html = html.replace(
+            "@TITLE@", self.tr("Render Process terminated abnormally"))
         html = html.replace(
-            "@LI-1@",
-            self.tr("Something went wrong while loading this page."))
+            "@H1@", self.tr("Render Process terminated abnormally"))
+        if status == QWebEnginePage.CrashedTerminationStatus:
+            msg = self.tr("The render process crashed while"
+                          " loading this page.")
+        elif status == QWebEnginePage.KilledTerminationStatus:
+            msg = self.tr("The render process was killed.")
+        else:
+            msg = self.tr("The render process terminated while"
+                          " loading this page.")
+        html = html.replace("@LI-1@", msg)
         html = html.replace(
             "@LI-2@",
             self.tr(
                 "Try reloading the page or closing some tabs to make more"
                 " memory available."))
-        html = html.replace(
-            "@BUTTON@", self.tr("Reload Page"))
         self.page().setHtml(html, self.url())
     
     def __loadStarted(self):

eric ide

mercurial