diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index efb025890..7d4f519c7 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -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. diff --git a/CommonJS/lib/cappuccino/objj-flatten-additions.js b/CommonJS/lib/cappuccino/objj-flatten-additions.js index 2b4781e62..4c69f133e 100644 --- a/CommonJS/lib/cappuccino/objj-flatten-additions.js +++ b/CommonJS/lib/cappuccino/objj-flatten-additions.js @@ -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) diff --git a/Objective-J/CFHTTPRequest.js b/Objective-J/CFHTTPRequest.js index de32c1897..d4007f585 100644 --- a/Objective-J/CFHTTPRequest.js +++ b/Objective-J/CFHTTPRequest.js @@ -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(); } diff --git a/Tests/Tools/ToolsTest.j b/Tests/Tools/ToolsTest.j new file mode 100644 index 000000000..6705affee --- /dev/null +++ b/Tests/Tools/ToolsTest.j @@ -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