Skip to content

Commit

Permalink
Cleanups.
Browse files Browse the repository at this point in the history
- Remove trailing whitespace.
- Remove tabs.
- Change sys.puts to console.log.
- Fix tls comment and add websocket server comment.
  • Loading branch information
davidlehn authored and dlongley committed Jan 10, 2017
1 parent 189c988 commit 2c37d0b
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 134 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
You may use the Forge project under the terms of either the BSD License or the
You may use the Forge project under the terms of either the BSD License or the
GNU General Public License (GPL) Version 2.

The BSD License is recommended for most projects. It is simple and easy to
The BSD License is recommended for most projects. It is simple and easy to
understand and it places almost no restrictions on what you can do with the
Forge project.

If the GPL suits your project better you are also free to use Forge under
If the GPL suits your project better you are also free to use Forge under
that license.

You don't have to do anything special to choose one license or the other and
Expand Down
2 changes: 1 addition & 1 deletion flash/policyserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def main():

# log basic info
logging.info("Flash Socket Policy Server. Use ctrl-c to exit.")

# create policy server
logging.info("Socket policy serving on %s:%d." % (options.host, options.port))
policyd = ThreadedTCPServer((options.host, options.port), PolicyHandler)
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To run legacy browser based tests the main forge build is required:
The tests are run with a custom server that prints out the URL to use:

npm run test-server

Running other tests
-------------------

Expand Down
16 changes: 8 additions & 8 deletions tests/flash/Test.as
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/*
* Copyright (c) 2010 Digital Bazaar, Inc. All rights reserved.
*
*
* @author Dave Longley
*/
package
{
import flash.display.Sprite;

public class Test extends Sprite
{
import flash.events.*;
import flash.net.*;

import flash.external.ExternalInterface;
import flash.system.Security;

public function Test()
{
try
{
// FIXME: replace 'localhost' with cross-domain host to hit
var xhost:String = "localhost";
Security.loadPolicyFile("xmlsocket://" + xhost + ":80");

var loader:URLLoader = new URLLoader();
loader.addEventListener(
Event.COMPLETE, completeHandler);
Expand All @@ -36,7 +36,7 @@ package
HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
loader.addEventListener(
IOErrorEvent.IO_ERROR, ioErrorHandler);

var request:URLRequest = new URLRequest(
"http://" + xhost + "/index.html");
loader.load(request);
Expand All @@ -47,7 +47,7 @@ package
throw e;
}
}

private function log(obj:Object):void
{
if(obj is String)
Expand All @@ -61,7 +61,7 @@ package
log("error=" + e.errorID + "," + e.name + "," + e.message);
}
}

private function completeHandler(event:Event):void
{
var loader:URLLoader = URLLoader(event.target);
Expand Down
6 changes: 3 additions & 3 deletions tests/legacy/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ $(document).ready(function()
{
// logging category
var cat = 'forge.tests.form';

// local alias
var forge = window.forge;

$('form.ajax').each(function(i, form)
{
$(form).submit(function()
Expand All @@ -23,7 +23,7 @@ $(document).ready(function()
var f = forge.form.serialize($(this));
forge.log.debug(cat, 'result:', JSON.stringify(f));
$('#result').html(JSON.stringify(f));

/* dictionary test
var f = forge.form.serialize($(this), '.', {'username':'user'});
forge.log.debug(cat, 'result:', JSON.stringify(f));
Expand Down
24 changes: 12 additions & 12 deletions tests/legacy/loginDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var init = function($)
{
// logging category
var cat = 'forge.tests.loginDemo';

// local alias
var forge = window.forge;
try
Expand All @@ -38,11 +38,11 @@ var init = function($)
if(domain)
{
$('#domain').html('`' + domain + '`');
}
}

// for chosen webid
var chosen = null;

// init forge xhr
forge.xhr.init({
flashId: 'socketPool',
Expand All @@ -67,15 +67,15 @@ var init = function($)
return chosen.privateKey;
}
});

// get flash API
var flashApi = document.getElementById('socketPool');

// get web ids collection
var webids = forge.util.getItem(
flashApi, 'forge.test.webid', 'webids');
webids = webids || {};

var id = 0;
var list = $('<ul/>');
for(var key in webids)
Expand All @@ -90,10 +90,10 @@ var init = function($)
button.click(function()
{
button.attr('disabled', 'disabled');

// set chosen webid
chosen = webid;

// do webid call
$.ajax(
{
Expand Down Expand Up @@ -123,23 +123,23 @@ var init = function($)
});
item.append(button);
item.append(' ' + key + '<br/>');

// display certificate attributes
var attr;
for(var n = 0; n < cert.subject.attributes.length; ++n)
{
attr = cert.subject.attributes[n];
item.append(attr.name + ': ' + attr.value + '<br/>');
}

list.append(item);
})(webids[key]);
}
if(list.html() === '<ul/>')
{
list.append('None');
}

$('#webids').append(list);
}
catch(ex)
Expand Down
16 changes: 8 additions & 8 deletions tests/legacy/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jQuery(function($)
var tests = [];
var passed = 0;
var failed = 0;

var init = function() {
passed = failed = 0;
$('.ready,.testing,.pass,.fail')
Expand Down Expand Up @@ -85,11 +85,11 @@ jQuery(function($)
$('#start').click(function() {
start();
});

$('#reset').click(function() {
init();
});

var addTest = function(name, run)
{
var container = $('<ul><li>Test ' + name + '</li><ul/></ul>');
Expand Down Expand Up @@ -292,7 +292,7 @@ jQuery(function($)
test.pass();
});
});

addTest('serial 20 + sleep', function(task, test) {
// total
var n = 20;
Expand All @@ -309,7 +309,7 @@ jQuery(function($)
test.check();
});
});

addTest('concurrent tasks', function(task, test)
{
var colors = [
Expand All @@ -329,7 +329,7 @@ jQuery(function($)
{
var main = task;
task.block(count);

var tasks = [];
for(var i = 0; i < count; ++i)
{
Expand Down Expand Up @@ -362,13 +362,13 @@ jQuery(function($)
run: makefunction(i)
});
}

for(var i = 0; i < count; ++i)
{
forge.task.start(tasks[i]);
}
});

task.next(function(task) {
test.pass();
});
Expand Down
3 changes: 2 additions & 1 deletion tests/legacy/tls.html
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ <h1>TLS Tests</h1>
<ul>
<li>Use the controls below to test the HTTP client over TLS.</li>
<li>You currently need a JavaScript console to view the output.</li>
<li>This test connects to a TLS server so you must have one running. The easiest way to run this test is to start the test server with --tls and load this page over HTTPS.</li>
<li>This test connects to a TLS server so you must have one running and load this page over HTTPS.</li>
<li>The websocket tests require also running websocket servers from test directory.</li>
</ul>
</fieldset>

Expand Down
Loading

0 comments on commit 2c37d0b

Please sign in to comment.