Merge branch 'master' of github.com:280north/cappuccino

This commit is contained in:
Francisco Ryan Tolmasky I
2010-05-04 22:08:08 -07:00
4 changed files with 52 additions and 7 deletions
@@ -130,8 +130,6 @@ var CPDOMEventGetClickCount,
StopDOMEventPropagation,
StopContextMenuDOMEventPropagation;
var _DOMEventGuard;
//right now we hard code q, w, r and t as keys to propogate
//these aren't normal keycodes, they are with modifier key codes
//might be mac only, we should investigate futher later.
@@ -1,6 +1,7 @@
var URLCache = { };
var CFHTTPRequest_open = CFHTTPRequest.prototype.open;
CFHTTPRequest.prototype.open = function(/*String*/ method, /*String*/ url, /*Boolean*/ async, /*String*/ user, /*String*/ password)
{
var cachedRequest = CFHTTPRequest._lookupCachedRequest(url);
@@ -13,7 +14,7 @@ CFHTTPRequest.prototype.open = function(/*String*/ method, /*String*/ url, /*Boo
ObjectiveJ.determineAndDispatchHTTPRequestEvents(self);
};
}
return this._nativeRequest.open(method, url, async, user, password);
return CFHTTPRequest_open.apply(this, arguments);
}
CFHTTPRequest._cacheRequest = function(/*CFURL|String*/ aURL, /*Number*/ status, /*Object*/ headers, /*String*/ body)
+11 -4
View File
@@ -92,6 +92,7 @@ if (!NativeRequest)
GLOBAL(CFHTTPRequest) = function()
{
this._isOpen = false;
this._requestHeaders = {};
this._mimeType = null;
@@ -207,6 +208,7 @@ CFHTTPRequest.prototype.overrideMimeType = function(/*String*/ aMimeType)
CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*Boolean*/ isAsynchronous, /*String*/ aUser, /*String*/ aPassword)
{
this._isOpen = true;
this._URL = aURL;
this._async = isAsynchronous;
this._method = aMethod;
@@ -217,19 +219,23 @@ CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*B
CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
{
delete this._nativeRequest.onreadystatechange;
for (var i in this._requestHeaders)
{
if (this._requestHeaders.hasOwnProperty(i))
this._nativeRequest.setRequestHeader(i, this._requestHeaders[i]);
}
if (!this._isOpen)
{
delete this._nativeRequest.onreadystatechange;
this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password);
this._nativeRequest.onreadystatechange = this._stateChangeHandler;
}
if (this._mimeType && "overrideMimeType" in this._nativeRequest)
this._nativeRequest.overrideMimeType(this._mimeType);
this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password);
this._nativeRequest.onreadystatechange = this._stateChangeHandler;
this._isOpen = false;
try
{
@@ -244,6 +250,7 @@ CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
CFHTTPRequest.prototype.abort = function()
{
this._isOpen = false;
return this._nativeRequest.abort();
}
+39
View File
@@ -0,0 +1,39 @@
var OS = require("os");
var FILE = require("file");
function cleanup() {
["ToolsTestApp", "PressTestApp", "FlattenTestApp"].forEach(function(dir) {
if (FILE.isDirectory(dir))
FILE.rmtree(dir);
});
}
@implementation ToolsTest : OJTestCase
{
}
- (void)setUp
{
cleanup();
}
- (void)testTools
{
var status;
status = OS.system(["capp", "gen", "ToolsTestApp"]);
[self assert:status equals:0 message:"capp gen failed"];
status = OS.system(["press", "-f", "ToolsTestApp", "PressTestApp"]);
[self assert:status equals:0 message:"press failed"];
status = OS.system(["flatten", "-f", "ToolsTestApp", "FlattenTestApp"]);
[self assert:status equals:0 message:"flatten failed"];
}
- (void)tearDown
{
cleanup();
}
@end