Skip to content

Commit 4b3ac22

Browse files
committed
v1.9.0
1 parent b652768 commit 4b3ac22

File tree

8 files changed

+28
-18
lines changed

8 files changed

+28
-18
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: node_js
2+
sudo: false
23
node_js:
34
- stable
45

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## v1.9.0
4+
Ignore "Script error." for old Android and iOS.
5+
36
## v1.8.1
47
Small fix in bower.json.
58

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "show-js-error",
33
"description": "Show a message about a js error in any browser",
4-
"version": "1.8.1",
4+
"version": "1.9.0",
55
"main": [
66
"dist/show-js-error.js",
77
"dist/show-js-error.css"

dist/show-js-error.custom.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@ var showJSError = {
1414
* @param {Boolean} [settings.helpLinks]
1515
*/
1616
init: function(settings) {
17-
var that = this;
18-
19-
this.settings = settings || {};
20-
2117
if (this._inited) {
2218
return;
2319
}
2420

21+
var that = this,
22+
isAndroidOrIOS = /(Android|iPhone|iPod|iPad)/i.test(navigator.userAgent);
23+
24+
this.settings = settings || {};
25+
2526
this._inited = true;
2627
this._isLast = true;
2728
this._i = 0;
2829
this._buffer = [];
2930

3031
this._onerror = function(e) {
32+
if (isAndroidOrIOS && e && e.message === 'Script error.' && !e.lineno && !e.filename) {
33+
return;
34+
}
35+
3136
that._buffer.push(e);
3237
if (that._isLast) {
3338
that._i = that._buffer.length - 1;
@@ -42,7 +47,7 @@ var showJSError = {
4247
this._oldOnError = window.onerror;
4348

4449
window.onerror = function(message, filename, lineno, colno, error) {
45-
this._onerror({
50+
that._onerror({
4651
message: message,
4752
filename: filename,
4853
lineno: lineno,
@@ -466,8 +471,6 @@ var showJSError = {
466471
this._container.className = this.elemClass('', 'visible');
467472
},
468473
_highlightLinks: function(text) {
469-
var that = this;
470-
471474
return text.replace(/(at | \(|@)(https?|file)(:.*?)(?=:\d+:\d+\)?$)/gm, function($0, $1, $2, $3) {
472475
var url = $2 + $3;
473476

dist/show-js-error.custom.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/show-js-error.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@ var showJSError = {
1414
* @param {Boolean} [settings.helpLinks]
1515
*/
1616
init: function(settings) {
17-
var that = this;
18-
19-
this.settings = settings || {};
20-
2117
if (this._inited) {
2218
return;
2319
}
2420

21+
var that = this,
22+
isAndroidOrIOS = /(Android|iPhone|iPod|iPad)/i.test(navigator.userAgent);
23+
24+
this.settings = settings || {};
25+
2526
this._inited = true;
2627
this._isLast = true;
2728
this._i = 0;
2829
this._buffer = [];
2930

3031
this._onerror = function(e) {
32+
if (isAndroidOrIOS && e && e.message === 'Script error.' && !e.lineno && !e.filename) {
33+
return;
34+
}
35+
3136
that._buffer.push(e);
3237
if (that._isLast) {
3338
that._i = that._buffer.length - 1;
@@ -42,7 +47,7 @@ var showJSError = {
4247
this._oldOnError = window.onerror;
4348

4449
window.onerror = function(message, filename, lineno, colno, error) {
45-
this._onerror({
50+
that._onerror({
4651
message: message,
4752
filename: filename,
4853
lineno: lineno,
@@ -466,8 +471,6 @@ var showJSError = {
466471
this._container.className = this.elemClass('', 'visible');
467472
},
468473
_highlightLinks: function(text) {
469-
var that = this;
470-
471474
return text.replace(/(at | \(|@)(https?|file)(:.*?)(?=:\d+:\d+\)?$)/gm, function($0, $1, $2, $3) {
472475
var url = $2 + $3;
473476

0 commit comments

Comments
 (0)