2
* Copyright 2015 Canonical Ltd.
4
* This file is part of webbrowser-app.
6
* webbrowser-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* webbrowser-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import com.canonical.Oxide 1.8 as Oxide
27
property var webview: null
29
readonly property bool killed: webview &&
30
(webview.webProcessStatus == Oxide.WebView.WebProcessKilled)
31
readonly property bool crashed: webview &&
32
(webview.webProcessStatus == Oxide.WebView.WebProcessCrashed)
34
// When the renderer process is killed (most likely by the system’s
35
// OOM killer), try to reload the page once, and if this results in
36
// the process being killed again within one minute, then display
39
readonly property int killedRetries: internal.killedRetries
43
property int killedRetries: 0
48
onWebProcessStatusChanged: {
49
if (webview.webProcessStatus == Oxide.WebView.WebProcessKilled) {
50
if (internal.killedRetries == 0) {
51
// Do not attempt reloading right away, this would result in a crash
52
delayedReload.restart()
62
monitorTimer.restart()
63
monitor.webview.reload()
64
internal.killedRetries++
70
interval: 60000 // 1 minute
71
onTriggered: internal.killedRetries = 0
75
internal.killedRetries = 0