OLD | NEW |
1 // A framework for testing. | 1 // A framework for testing. |
2 | 2 |
3 var Framework = {}; | 3 var Framework = {}; |
4 | 4 |
5 Framework.safeRun = function(callback, onSuccess, onException, breakOnUncaught) | 5 Framework.safeRun = function(callback, onSuccess, onException, breakOnUncaught) |
6 { | 6 { |
7 try { | 7 try { |
8 callback(); | 8 callback(); |
9 if (onSuccess) | 9 if (onSuccess) |
10 Framework.safeRun(onSuccess, undefined, onException, breakOnUncaught
); | 10 Framework.safeRun(onSuccess, undefined, onException, breakOnUncaught
); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 Framework.appendChild = function(parent, child) | 70 Framework.appendChild = function(parent, child) |
71 { | 71 { |
72 parent.appendChild(child); | 72 parent.appendChild(child); |
73 } | 73 } |
74 | 74 |
75 Framework.sendXHR = function(url) | 75 Framework.sendXHR = function(url) |
76 { | 76 { |
77 var request = new XMLHttpRequest(); | 77 var request = new XMLHttpRequest(); |
78 request.open("GET", url, true); | 78 request.open("GET", url, true); |
79 try { request.send(); } catch (e) {} | 79 request.send(); |
80 } | 80 } |
81 | 81 |
82 Framework.addEventListener = function(element, eventType, listener, capture) | 82 Framework.addEventListener = function(element, eventType, listener, capture) |
83 { | 83 { |
84 function Framework_eventListener() | 84 function Framework_eventListener() |
85 { | 85 { |
86 if (listener) | 86 if (listener) |
87 listener(); | 87 listener(); |
88 } | 88 } |
89 | 89 |
(...skipping 13 matching lines...) Expand all Loading... |
103 function Framework_bound(var_args) | 103 function Framework_bound(var_args) |
104 { | 104 { |
105 return func.apply(thisObject, args.concat(Array.prototype.slice.call(arg
uments))); | 105 return func.apply(thisObject, args.concat(Array.prototype.slice.call(arg
uments))); |
106 } | 106 } |
107 Framework_bound.toString = function() | 107 Framework_bound.toString = function() |
108 { | 108 { |
109 return "Framework_bound: " + func; | 109 return "Framework_bound: " + func; |
110 }; | 110 }; |
111 return Framework_bound; | 111 return Framework_bound; |
112 } | 112 } |
OLD | NEW |