Skip to content

Commit b55c805

Browse files
author
stormsaber
committed
Initial commit to github
1 parent 5ac1840 commit b55c805

File tree

11 files changed

+387
-30
lines changed

11 files changed

+387
-30
lines changed

LICENSE.md

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Error Reloader
2+
==============
3+
4+
# Overview
5+
On slow and unreliable connections it's common for page loads to fail after low-level transport errors, socket errors and general timeouts. Even reliable connections can fail if the host suffers contention-related problems. Since there is no way for the browser to tell that the resource is actually available, common browser functionality is to stop after presenting an error to the user. On unreliable networks such as the internet this behaviour is a mistake. This browser extension will automaticly reload the page if a transient error occurs.
6+
7+
# Browser Support
8+
The extension was designed in Opera and works in both Chrome and Opera desktop editions.
9+
10+
# Installation
11+
For most users, it is sufficient to drag the relevent packed browser extension into the browser extensions management page. The packed extensions live in the "extensions" directory in this repository. For Opera, use error_reloader.nex. For Chrome, use error_reloader.crx.
12+
13+
# Privacy Information
14+
As any page on the internet could in principal experience a transient error, this extension needs permission to operate on all URLs. However, users should rest assured that at no point will the extension ever communicate in any way with any process outside of the requested page's host.
15+
16+
# Mechanism of Operation
17+
Currently, the extension sends a tab reload event after three seconds to the browser in the following instances: If the page's HTTP status code is any of 324, 408, 502, 503, 504, 522, 524, 598, or 599; or if the "net::ERR_ABORTED" socket error has occurred. However, this will not happen if the following resource types are interupted: "stylesheet", "script", "image", or "xmlhttprequest". Having sent a reload instruction to the tab, the extension increments a badge counter so that the user can keep track of how many times the tab has been reloaded so far.
18+
19+
# Documentation and Further Information
20+
https://github.com/stormsaber/error-reloader-extension. Do you know of any other socket errors or general transport problems which this extension fails to operate on? Please submit all bug reports in a timely manner so that this extension can be improved.
21+
22+
# Licence
23+
All code and icons are licenced under the GPLv2.

background.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/** Set defaults **/
22
status_codes = [324, 408, 502, 503, 504, 522, 524, 598, 599];
3-
socket_errors = ["net::ERR_ABORTED", "net::ERR_BLOCKED_BY_CLIENT"];
3+
socket_errors = ["net::ERR_ABORTED"];
44
ignore_types = ["stylesheet", "script", "image", "xmlhttprequest"];
55
enabled = true;
66
wait_timer = 3000; // ms (3 seconds before page reloads)
7-
chrome.browserAction.setBadgeText({text: "ON"});
87

98
tab_list = {};
109

@@ -19,7 +18,6 @@ function incrementTabCounter(tabId) {
1918

2019
function reloadTab(tabId) {
2120
if (tabId > -1) {
22-
console.log("Reloading..");
2321
chrome.browserAction.setBadgeText({text: ""+incrementTabCounter(tabId)+""});
2422
chrome.tabs.reload(tabId);
2523
}
@@ -68,24 +66,20 @@ chrome.webRequest.onErrorOccurred.addListener(
6866
chrome.browserAction.onClicked.addListener(function() {
6967
if (enabled) {
7068
enabled = false;
71-
alert("Reloader disabled");
72-
chrome.browserAction.setBadgeText({text: "OFF"});
69+
chrome.browserAction.setIcon({path:"icons/reloader-disabled.png"});
70+
chrome.browserAction.setTitle({ "title": "Enable Error Reloader"});
7371
} else {
7472
enabled = true;
75-
alert("Reloader enabled");
76-
chrome.browserAction.setBadgeText({text: "ON"});
73+
chrome.browserAction.setIcon({path:"icons/reloader-19.png"});
74+
chrome.browserAction.setTitle({ "title": "Disable Error Reloader"});
7775
}
7876
});
7977

78+
/** Sets the icon badge text for the extension to be the
79+
number of times the current tab has been reloaded, if it has been reloaded
80+
at all.**/
8081
chrome.tabs.onActivated.addListener(function(activeInfo) {
81-
chrome.browserAction.setBadgeText({text: ""});
8282
if(tab_list[activeInfo.tabId]) {
8383
chrome.browserAction.setBadgeText({text: ""+tab_list[activeInfo.tabId]+""});
84-
} else {
85-
if (enabled) {
86-
chrome.browserAction.setBadgeText({text: "ON"});
87-
} else {
88-
chrome.browserAction.setBadgeText({text: "OFF"});
89-
}
9084
}
9185
});

extensions/error-reloader.crx

67.8 KB
Binary file not shown.

extensions/error-reloader.nex

25.4 KB
Binary file not shown.

icons/reloader-128.png

9.12 KB
Loading

icons/reloader-16.png

801 Bytes
Loading

icons/reloader-19.png

1005 Bytes
Loading

icons/reloader-48.png

2.8 KB
Loading

icons/reloader-disabled.png

763 Bytes
Loading

0 commit comments

Comments
 (0)