Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit 88a50b5

Browse files
author
chrisisbeef
committed
Fixing live testing
1 parent ffeeaa7 commit 88a50b5

File tree

7 files changed

+38
-42
lines changed

7 files changed

+38
-42
lines changed

dist/esapi-compressed.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/esapi.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,11 @@ if ( !Exception ) {
188188
}
189189

190190
if ( !RuntimeException ) {
191-
var RuntimeException = {};
192-
RuntimeException.prototype = Exception.prototype;
191+
var RuntimeException = Exception;
193192
}
194193

195194
if ( !IllegalArgumentException ) {
196-
var IllegalArgumentException = {};
197-
IllegalArgumentException.prototype = Exception.prototype;
195+
var IllegalArgumentException = Exception;
198196
}
199197

200198
if ( !DateFormat ) {
@@ -1825,11 +1823,6 @@ org.owasp.esapi.i18n.ResourceBundle.getResourceBundle = function(sResource, oLoc
18251823
}
18261824
};
18271825

1828-
with(org.owasp.esapi.i18n) {
1829-
ResourceBundle.ESAPI_Standard = "ESAPI_Standard";
1830-
ResourceBundle.ESAPI_Standard_en_US = new ArrayResourceBundle( 'ESAPI Standard Messaging - US English', Locale.US, messages );
1831-
}
1832-
18331826
$namespace('org.owasp.esapi.net');
18341827

18351828
/**

src/main/javascript/core.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,11 @@ if ( !Exception ) {
187187
}
188188

189189
if ( !RuntimeException ) {
190-
var RuntimeException = {};
191-
RuntimeException.prototype = Exception.prototype;
190+
var RuntimeException = Exception;
192191
}
193192

194193
if ( !IllegalArgumentException ) {
195-
var IllegalArgumentException = {};
196-
IllegalArgumentException.prototype = Exception.prototype;
194+
var IllegalArgumentException = Exception;
197195
}
198196

199197
if ( !DateFormat ) {

src/main/javascript/org/owasp/esapi/i18n/ResourceBundle.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,4 @@ org.owasp.esapi.i18n.ResourceBundle.getResourceBundle = function(sResource, oLoc
8484
return new ResourceBundle[classname]();
8585
}
8686
}
87-
};
88-
89-
with(org.owasp.esapi.i18n) {
90-
ResourceBundle.ESAPI_Standard = "ESAPI_Standard";
91-
ResourceBundle.ESAPI_Standard_en_US = new ArrayResourceBundle( 'ESAPI Standard Messaging - US English', Locale.US, messages );
92-
}
87+
};

src/test/javascript/TestCore.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,25 @@ function testCreditCardValidationRule() {
255255
}
256256

257257
function testHTTPUtilitiesAddCookie() {
258-
var c = new org.owasp.esapi.net.Cookie("ESAPI4JS_Test", "true" );
259-
c.setComment("For ESAPI4JS Test");
260-
c.setSecure(false);
261-
$ESAPI.httpUtilities().addCookie(c);
258+
if ( window.location.protocol != 'file:' ) {
259+
var c = new org.owasp.esapi.net.Cookie("ESAPI4JS_Test", "true");
260+
c.setComment("For ESAPI4JS Test");
261+
c.setSecure(false);
262+
$ESAPI.httpUtilities().addCookie(c);
263+
}
264+
else {
265+
inform("Can't test cookies on file: protocol.")
266+
}
262267
}
263268

264269
function testHTTPUtilitiesGetCookie() {
265-
var c = $ESAPI.httpUtilities().getCookie("ESAPI4JS_Test");
266-
alert(c);
267-
if (!c) fail();
268-
if (c.getValue()!='true') fail();
270+
if ( window.location.protocol != 'file:' ) {
271+
var c = $ESAPI.httpUtilities().getCookie("ESAPI4JS_Test");
272+
if (!c) fail();
273+
if (c.getValue()!='true') fail();
274+
}
275+
else {
276+
inform("Can't test cookies on file: protocol.")
277+
}
269278
}
270279

src/test/javascript/testCore.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"http://www.w3.org/TR/html4/loose.dtd">
1616
<html>
1717
<head>
18-
<title>Test Page for ESAPI4JS Core.js</title>
18+
<title>Test Page for ESAPI4JS</title>
1919
<!-- Dependencies -->
20-
<script type="text/javascript" language="JavaScript" src="../../../lib/log4js.js"></script>
20+
<script type="text/javascript" language="JavaScript" src="../../../dist/lib/log4js.js"></script>
2121
<script type="text/javascript" language="JavaScript" src="jsunit/app/jsUnitCore.js"></script>
22-
2322
<script type="text/javascript" language="JavaScript" src="../../../dist/resources/i18n/ESAPI_Standard_en_US.properties.js"></script>
23+
2424
<script type="text/javascript" language="JavaScript" src="../../../dist/esapi.js"></script>
2525
<script type="text/javascript" language="JavaScript" src="../../../dist/resources/Base.esapi.properties.js"></script>
2626
<script type="text/javascript" language="JavaScript" src="../resources/TestCode.esapi.properties.js"></script>

src/test/resources/TestCode.esapi.properties.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
// Override the default settings to enable info level logging
1515
Base.esapi.properties.logging = {
16+
Implementation: org.owasp.esapi.reference.logging.Log4JSLogFactory,
1617
Level: org.owasp.esapi.Logger.INFO,
17-
Appenders: [ new Log4js.ConsoleAppender(true) ],
18+
Appenders: [ new Log4js.ConsoleAppender() ],
1819
LogApplicationName: true,
1920
EncodingRequired: true
2021
};

0 commit comments

Comments
 (0)