Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/sandbox_ui.js

Issue 10233013: Crawler, second version (Closed)
Patch Set: Created April 12, 2013, 1:38 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/content/crawler_ui.js ('k') | chrome/content/task_test_ui.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/sandbox_ui.js
===================================================================
new file mode 100644
--- /dev/null
+++ b/chrome/content/sandbox_ui.js
@@ -0,0 +1,71 @@
+let {Logger} = require( "logger" );
+let {Encoding} = require( "encoding" );
+let {Action} = require( "action" );
+
+var what = "actions";
+var output_box;
+function sandbox_start()
+{
+ output_box = document.getElementById( "sandbox_output" );
+ switch ( what )
+ {
+ case "actions":
+ exercise_actions();
+ break;
+ }
+}
+
+var write = function( s )
+{
+ output_box.value += s;
+};
+
+var logger = new Logger( "sandbox" );
+var log = logger.make_log();
+
+//=========================================================================================
+// exercise_actions
+//=========================================================================================
+function exercise_actions()
+{
+ log( "Action" );
+
+ //-----------------------------------------------------------------------------------------
+ write( "---\n" );
+ write( "# 0\n" );
+ var t = typeof Action;
+ write( "Action is " + ((t === 'undefined') ? "not " : "") + "defined."
+ + " It is " + ((t === 'object') ? "" : "not") + "an object.\n" );
+ var b = "Join" in Action;
+ write( "Action.Join is a " + (b ? "valid " : "invalid") + "member.\n" );
+
+ //-----------------------------------------------------------------------------------------
+ write( "---\n" );
+ write( "# 1\n" );
+ var defer = new Action.Defer( function()
+ {
+ write( "Defer executed." )
+ } );
+
+ function catcher()
+ {
+ write( "Join_Timeout catcher: timed_out = " + join.timed_out + ".\n" );
+ }
+
+ function finisher()
+ {
+ write( "Finished." );
+ }
+
+ try
+ {
+ var join = new Action.Join_Timeout( defer, 10 );
+ join.go( finisher, catcher );
+ }
+ catch ( e )
+ {
+ write( "Exception: " + e.message );
+ }
+
+}
+
« no previous file with comments | « chrome/content/crawler_ui.js ('k') | chrome/content/task_test_ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld