Skip to content

Commit

Permalink
Make the UpdaterHelper function on WebKit-based browsers.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobie committed Oct 25, 2009
1 parent 24569d1 commit 70c5e98
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
7 changes: 6 additions & 1 deletion ext/update_helper/prototype_update_helper.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ <h1>Prototype Unit test file</h1>

new Test.Unit.Runner({
testGetStack: function() {
this.assertMatch(/prototype_update_helper\.html:\d+\n$/, prototypeUpdateHelper.getStack());
var stack = prototypeUpdateHelper.getStack();
if (stack === '') {
this.info('UpdaterHelper#getStack is currently not supported on this browser.')
} else {
this.assertMatch(/prototype_update_helper\.html:\d+\n$/, prototypeUpdateHelper.getStack());
}
},

testDisplay: function() {
Expand Down
4 changes: 2 additions & 2 deletions ext/update_helper/prototype_update_helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//= require "update_helper"

/* UpdateHelper for Prototype <%= PROTOTYPE_VERSION %> (c) 2008 Tobie Langel
/* UpdateHelper for Prototype <%= PROTOTYPE_VERSION %> (c) 2008-2009 Tobie Langel
*
* UpdateHelper for Prototype is freely distributable under the same
* terms as Prototype (MIT-style license).
Expand All @@ -17,7 +17,7 @@
*
* This, for example, will prevent deprecation messages from being logged.
*
* THIS SCRIPT WORKS IN FIREFOX ONLY
* THIS SCRIPT DOES NOT WORK IN INTERNET EXPLORER
*--------------------------------------------------------------------------*/

var prototypeUpdateHelper = new UpdateHelper([
Expand Down
11 changes: 7 additions & 4 deletions ext/update_helper/update_helper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Update Helper (c) 2008 Tobie Langel
/* Update Helper (c) 2008-2009 Tobie Langel
*
* Requires Prototype >= 1.6.0
*
Expand Down Expand Up @@ -54,9 +54,12 @@ var UpdateHelper = Class.create({
try {
throw new Error("stack");
} catch(e) {
return (e.stack || '').match(this.Regexp).reject(function(path) {
return /(prototype|unittest|update_helper)\.js/.test(path);
}).join("\n");
var match = (e.stack || '').match(this.Regexp);
if (match) {
return match.reject(function(path) {
return (/(prototype|unittest|update_helper)\.js/).test(path);
}).join("\n");
} else { return ''; }
}
},

Expand Down

0 comments on commit 70c5e98

Please sign in to comment.