瀏覽代碼

- Fixed JavaScriptException to make the tests greem
- Use the native exception message in as the messageText

Nicolas Petton 11 年之前
父節點
當前提交
79d6b979c2
共有 4 個文件被更改,包括 15 次插入22 次删除
  1. 3 6
      js/Kernel-Exceptions.deploy.js
  2. 7 10
      js/Kernel-Exceptions.js
  3. 4 4
      js/boot.js
  4. 1 2
      st/Kernel-Exceptions.st

+ 3 - 6
js/Kernel-Exceptions.deploy.js

@@ -150,8 +150,7 @@ smalltalk.method({
 selector: "exception:",
 fn: function (anException){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(anException)._messageText_(_st(anException)._basicAt_("message"));
-self["@exception"]=anException;
+return smalltalk.withContext(function($ctx1) { 
self["@exception"]=anException;
 return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException}, smalltalk.JavaScriptException)})}
 }),
 smalltalk.JavaScriptException);
@@ -162,10 +161,8 @@ smalltalk.method({
 selector: "messageText",
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st("JavaScript exception: ").__comma(_st(_st(self)._exception())._messageText());
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.JavaScriptException)})}
+return smalltalk.withContext(function($ctx1) { 
return 'JavaScript exception: ' + self["@exception"].toString();
+return self}, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.JavaScriptException)})}
 }),
 smalltalk.JavaScriptException);
 

+ 7 - 10
js/Kernel-Exceptions.js

@@ -213,12 +213,11 @@ selector: "exception:",
 category: 'accessing',
 fn: function (anException){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(anException)._messageText_(_st(anException)._basicAt_("message"));
-self["@exception"]=anException;
+return smalltalk.withContext(function($ctx1) { 
self["@exception"]=anException;
 return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException}, smalltalk.JavaScriptException)})},
 args: ["anException"],
-source: "exception: anException\x0a\x09anException messageText: (anException basicAt: 'message').\x0a\x09exception := anException",
-messageSends: ["messageText:", "basicAt:"],
+source: "exception: anException\x0a\x09exception := anException",
+messageSends: [],
 referencedClasses: []
 }),
 smalltalk.JavaScriptException);
@@ -230,13 +229,11 @@ selector: "messageText",
 category: 'accessing',
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st("JavaScript exception: ").__comma(_st(_st(self)._exception())._messageText());
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.JavaScriptException)})},
+return smalltalk.withContext(function($ctx1) { 
return 'JavaScript exception: ' + self["@exception"].toString();
+return self}, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.JavaScriptException)})},
 args: [],
-source: "messageText\x0a\x09^ 'JavaScript exception: ', self exception messageText",
-messageSends: [",", "messageText", "exception"],
+source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
+messageSends: [],
 referencedClasses: []
 }),
 smalltalk.JavaScriptException);

+ 4 - 4
js/boot.js

@@ -529,10 +529,10 @@ function Smalltalk() {
 				if(error.smalltalkError) {
 					handleError(error);
                 } else {
-                    var wrapperError = st.JavaScriptException._on_(error);
-                    try {wrapperError._signal()} catch(ex) {}
-                    wrapperError._context_(st.getThisContext());
-                    handleError(wrapperError);
+                    var errorWrapper = st.JavaScriptException._on_(error);
+                    try {errorWrapper._signal()} catch(ex) {}
+                    errorWrapper._context_(st.getThisContext());
+                    handleError(errorWrapper);
                 }
 				// Reset the context stack in any case
 				st.thisContext = undefined;

+ 1 - 2
st/Kernel-Exceptions.st

@@ -83,12 +83,11 @@ exception
 !
 
 exception: anException
-	anException messageText: (anException basicAt: 'message').
 	exception := anException
 !
 
 messageText
-	^ 'JavaScript exception: ', self exception messageText
+	<return 'JavaScript exception: ' + self["@exception"].toString()>
 ! !
 
 !JavaScriptException class methodsFor: 'instance creation'!