comparison lib/js/urweb.js @ 1323:0d8bd8ae8417

Fix JavaScript unit unurlification; URL blessing client-side
author Adam Chlipala <adamc@hcoop.net>
date Fri, 26 Nov 2010 11:57:04 -0500
parents 6791454653c5
children 02fc16faecf3
comparison
equal deleted inserted replaced
1322:80bff6449f41 1323:0d8bd8ae8417
1180 function confrm(s) { 1180 function confrm(s) {
1181 return confirm(s) ? true : false; 1181 return confirm(s) ? true : false;
1182 } 1182 }
1183 1183
1184 1184
1185 // URL blessing
1186
1187 var urlRules = null;
1188
1189 function checkUrl(s) {
1190 for (var r = urlRules; r; r = r.next) {
1191 var ru = r.data;
1192 if (ru.prefix ? s.indexOf(ru.pattern) == 0 : s == ru.pattern)
1193 return ru.allow ? s : null;
1194 }
1195
1196 return null;
1197 }
1198
1199 function bless(s) {
1200 u = checkUrl(s);
1201 if (u == null)
1202 er("Disallowed URL: " + s);
1203 return u;
1204 }
1205
1185 // App-specific code 1206 // App-specific code
1186 1207