Spaces.deploy.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Spaces');
  3. smalltalk.addClass('ObjectSpace', smalltalk.Object, ['frame'], 'Spaces');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "connectTo:",
  7. fn: function (aFrame){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) {
  10. self._release();
  11. self["@frame"]=aFrame;
  12. return self}, function($ctx1) {$ctx1.fill(self,"connectTo:",{aFrame:aFrame},smalltalk.ObjectSpace)})},
  13. messageSends: ["release"]}),
  14. smalltalk.ObjectSpace);
  15. smalltalk.addMethod(
  16. smalltalk.method({
  17. selector: "create",
  18. fn: function (){
  19. var self=this;
  20. return smalltalk.withContext(function($ctx1) {
  21. _st("body"._asJQuery())._append_("<iframe style=\x22display: none;\x22></iframe>");
  22. self["@frame"]=_st(_st("iframe"._asJQuery())._get())._last();
  23. _st(_st(self["@frame"])._contentWindow())._location_(_st(window)._location());
  24. return self}, function($ctx1) {$ctx1.fill(self,"create",{},smalltalk.ObjectSpace)})},
  25. messageSends: ["append:", "asJQuery", "last", "get", "location:", "location", "contentWindow"]}),
  26. smalltalk.ObjectSpace);
  27. smalltalk.addMethod(
  28. smalltalk.method({
  29. selector: "destroy",
  30. fn: function (){
  31. var self=this;
  32. return smalltalk.withContext(function($ctx1) {
  33. var $1,$2;
  34. $1=self["@frame"];
  35. if(($receiver = $1) == nil || $receiver == undefined){
  36. $2=self;
  37. return $2;
  38. } else {
  39. $1;
  40. };
  41. _st(_st(self["@frame"])._asJQuery())._remove();
  42. self._release();
  43. return self}, function($ctx1) {$ctx1.fill(self,"destroy",{},smalltalk.ObjectSpace)})},
  44. messageSends: ["ifNil:", "remove", "asJQuery", "release"]}),
  45. smalltalk.ObjectSpace);
  46. smalltalk.addMethod(
  47. smalltalk.method({
  48. selector: "do:",
  49. fn: function (aBlock){
  50. var self=this;
  51. function $ObjectSpaceConnectionError(){return smalltalk.ObjectSpaceConnectionError||(typeof ObjectSpaceConnectionError=="undefined"?nil:ObjectSpaceConnectionError)}
  52. return smalltalk.withContext(function($ctx1) {
  53. var $1,$2,$3;
  54. $1=self._isConnected();
  55. if(! smalltalk.assert($1)){
  56. $2=_st($ObjectSpaceConnectionError())._signal();
  57. return $2;
  58. };
  59. $3=_st(_st(self["@frame"])._contentWindow())._eval_(_st("(".__comma(_st(aBlock)._compiledSource())).__comma(")()"));
  60. return $3;
  61. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.ObjectSpace)})},
  62. messageSends: ["ifFalse:", "signal", "isConnected", "eval:", ",", "compiledSource", "contentWindow"]}),
  63. smalltalk.ObjectSpace);
  64. smalltalk.addMethod(
  65. smalltalk.method({
  66. selector: "frame",
  67. fn: function (){
  68. var self=this;
  69. return smalltalk.withContext(function($ctx1) {
  70. var $1;
  71. $1=self["@frame"];
  72. return $1;
  73. }, function($ctx1) {$ctx1.fill(self,"frame",{},smalltalk.ObjectSpace)})},
  74. messageSends: []}),
  75. smalltalk.ObjectSpace);
  76. smalltalk.addMethod(
  77. smalltalk.method({
  78. selector: "initialize",
  79. fn: function (){
  80. var self=this;
  81. return smalltalk.withContext(function($ctx1) {
  82. smalltalk.ObjectSpace.superclass.fn.prototype._initialize.apply(_st(self), []);
  83. self._create();
  84. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ObjectSpace)})},
  85. messageSends: ["initialize", "create"]}),
  86. smalltalk.ObjectSpace);
  87. smalltalk.addMethod(
  88. smalltalk.method({
  89. selector: "isConnected",
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) {
  93. var $1;
  94. $1=_st(self._frame())._notNil();
  95. return $1;
  96. }, function($ctx1) {$ctx1.fill(self,"isConnected",{},smalltalk.ObjectSpace)})},
  97. messageSends: ["notNil", "frame"]}),
  98. smalltalk.ObjectSpace);
  99. smalltalk.addMethod(
  100. smalltalk.method({
  101. selector: "release",
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. self["@frame"]=nil;
  106. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.ObjectSpace)})},
  107. messageSends: []}),
  108. smalltalk.ObjectSpace);
  109. smalltalk.addMethod(
  110. smalltalk.method({
  111. selector: "whenReadyDo:",
  112. fn: function (aBlock){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) {
  115. _st(_st(self["@frame"])._asJQuery())._bind_do_("load",aBlock);
  116. return self}, function($ctx1) {$ctx1.fill(self,"whenReadyDo:",{aBlock:aBlock},smalltalk.ObjectSpace)})},
  117. messageSends: ["bind:do:", "asJQuery"]}),
  118. smalltalk.ObjectSpace);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "on:",
  122. fn: function (aFrame){
  123. var self=this;
  124. return smalltalk.withContext(function($ctx1) {
  125. var $2,$3,$1;
  126. $2=self._basicNew();
  127. _st($2)._connectTo_(aFrame);
  128. $3=_st($2)._yourself();
  129. $1=$3;
  130. return $1;
  131. }, function($ctx1) {$ctx1.fill(self,"on:",{aFrame:aFrame},smalltalk.ObjectSpace.klass)})},
  132. messageSends: ["connectTo:", "basicNew", "yourself"]}),
  133. smalltalk.ObjectSpace.klass);
  134. smalltalk.addClass('ObjectSpaceConnectionError', smalltalk.Error, [], 'Spaces');
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "messageText",
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. return "The ObjectSpace is not connected";
  142. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.ObjectSpaceConnectionError)})},
  143. messageSends: []}),
  144. smalltalk.ObjectSpaceConnectionError);
  145. smalltalk.addClass('ObjectSpaceTest', smalltalk.TestCase, ['space'], 'Spaces');
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "setUp",
  149. fn: function (){
  150. var self=this;
  151. function $ObjectSpace(){return smalltalk.ObjectSpace||(typeof ObjectSpace=="undefined"?nil:ObjectSpace)}
  152. return smalltalk.withContext(function($ctx1) {
  153. self["@space"]=_st($ObjectSpace())._new();
  154. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ObjectSpaceTest)})},
  155. messageSends: ["new"]}),
  156. smalltalk.ObjectSpaceTest);
  157. smalltalk.addMethod(
  158. smalltalk.method({
  159. selector: "tearDown",
  160. fn: function (){
  161. var self=this;
  162. return smalltalk.withContext(function($ctx1) {
  163. _st(self["@space"])._destroy();
  164. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ObjectSpaceTest)})},
  165. messageSends: ["destroy"]}),
  166. smalltalk.ObjectSpaceTest);
  167. smalltalk.addMethod(
  168. smalltalk.method({
  169. selector: "testConnection",
  170. fn: function (){
  171. var self=this;
  172. function $ObjectSpaceConnectionError(){return smalltalk.ObjectSpaceConnectionError||(typeof ObjectSpaceConnectionError=="undefined"?nil:ObjectSpaceConnectionError)}
  173. return smalltalk.withContext(function($ctx1) {
  174. _st(self["@space"])._destroy();
  175. self._deny_(_st(self["@space"])._isConnected());
  176. self._should_raise_((function(){
  177. return smalltalk.withContext(function($ctx2) {
  178. return _st(self["@space"])._do_((function(){
  179. return smalltalk.withContext(function($ctx3) {
  180. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$ObjectSpaceConnectionError());
  182. return self}, function($ctx1) {$ctx1.fill(self,"testConnection",{},smalltalk.ObjectSpaceTest)})},
  183. messageSends: ["destroy", "deny:", "isConnected", "should:raise:", "do:"]}),
  184. smalltalk.ObjectSpaceTest);
  185. smalltalk.addMethod(
  186. smalltalk.method({
  187. selector: "testCreate",
  188. fn: function (){
  189. var self=this;
  190. return smalltalk.withContext(function($ctx1) {
  191. self._assert_(_st(_st(self["@space"])._frame())._notNil());
  192. self._assert_(_st(self["@space"])._isConnected());
  193. return self}, function($ctx1) {$ctx1.fill(self,"testCreate",{},smalltalk.ObjectSpaceTest)})},
  194. messageSends: ["assert:", "notNil", "frame", "isConnected"]}),
  195. smalltalk.ObjectSpaceTest);
  196. smalltalk.addMethod(
  197. smalltalk.method({
  198. selector: "testEvaluation",
  199. fn: function (){
  200. var self=this;
  201. var result;
  202. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  203. return smalltalk.withContext(function($ctx1) {
  204. _st(self["@space"])._whenReadyDo_((function(){
  205. return smalltalk.withContext(function($ctx2) {
  206. result=_st(self["@space"])._do_((function(){
  207. return smalltalk.withContext(function($ctx3) {
  208. return smalltalk;
  209. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  210. result;
  211. self._assert_equals_(_st(_st(result)._class())._name(),"Smalltalk");
  212. self._deny_(_st(_st(result)._class()).__eq($Smalltalk()));
  213. return self._deny_(_st(result).__eq_eq(smalltalk));
  214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  215. return self}, function($ctx1) {$ctx1.fill(self,"testEvaluation",{result:result},smalltalk.ObjectSpaceTest)})},
  216. messageSends: ["whenReadyDo:", "do:", "assert:equals:", "name", "class", "deny:", "=", "=="]}),
  217. smalltalk.ObjectSpaceTest);
  218. smalltalk.addMethod(
  219. smalltalk.method({
  220. selector: "testRelease",
  221. fn: function (){
  222. var self=this;
  223. return smalltalk.withContext(function($ctx1) {
  224. self._deny_(_st(_st(self["@space"])._frame())._isNil());
  225. _st(self["@space"])._release();
  226. self._assert_(_st(_st(self["@space"])._frame())._isNil());
  227. return self}, function($ctx1) {$ctx1.fill(self,"testRelease",{},smalltalk.ObjectSpaceTest)})},
  228. messageSends: ["deny:", "isNil", "frame", "release", "assert:"]}),
  229. smalltalk.ObjectSpaceTest);
  230. })(global_smalltalk,global_nil,global__st);