mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-04 20:05:03 +00:00
Merge branch '280north/master'
This commit is contained in:
commit
62284c9218
7 files changed
+70
-28
No files matched your search
+5
-1
@@ -386,10 +386,14 @@ var CPDocumentUntitledCount = 0;
|
||||
*/
|
||||
- (void)connection:(CPURLConnection)aConnection didReceiveResponse:(CPURLResponse)aResponse
|
||||
{
|
||||
// If we got this far and it wasn't an HTTP request, then everything is fine.
|
||||
if (![aResponse isKindOfClass:[CPHTTPURLResponse class]])
|
||||
return;
|
||||
|
||||
var statusCode = [aResponse statusCode];
|
||||
|
||||
// Nothing to do if everything is hunky dory.
|
||||
if (statusCode == 200)
|
||||
if (statusCode === 200)
|
||||
return;
|
||||
|
||||
var session = aConnection.session;
|
||||
|
||||
@@ -666,11 +666,14 @@ var _CPTextFieldSquareBezelColor = nil,
|
||||
#if PLATFORM(DOM)
|
||||
var displayString = "";
|
||||
|
||||
if (aValue && [aValue respondsToSelector:@selector(string)])
|
||||
displayString = [aValue string];
|
||||
else if (aValue)
|
||||
displayString += aValue;
|
||||
|
||||
if (aValue !== nil && aValue !== undefined)
|
||||
{
|
||||
if ([aValue respondsToSelector:@selector(string)])
|
||||
displayString = [aValue string];
|
||||
else
|
||||
displayString += aValue;
|
||||
}
|
||||
|
||||
if ([[self window] firstResponder] == self)
|
||||
[[self class] _inputElement].value = displayString;
|
||||
|
||||
|
||||
@@ -448,6 +448,8 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
|
||||
|
||||
CPPopUpButton _additionalItemsButton;
|
||||
CPColor _labelColor;
|
||||
|
||||
float _minWidth;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
|
||||
@@ -338,7 +338,7 @@ function CGContextFillRect(aContext, aRect)
|
||||
|
||||
function CGContextFillRects(aContext, rects, count)
|
||||
{
|
||||
if (arguments["count"] == NULL)
|
||||
if (arguments[2] === undefined)
|
||||
var count = rects.length;
|
||||
|
||||
CGContextBeginPath(aContext);
|
||||
|
||||
+11
-10
@@ -123,17 +123,18 @@
|
||||
{
|
||||
objj_decompile([data string], self);
|
||||
|
||||
var files = [self objectForInfoDictionaryKey:@"CPBundleReplacedFiles"];
|
||||
importCallback = function()
|
||||
{
|
||||
// FIXME: Should we share a common context across all these loads?
|
||||
if (files.length > 0)
|
||||
objj_import([self bundlePath] + '/' + files.pop(), YES, importCallback);
|
||||
else if ([_delegate respondsToSelector:@selector(bundleDidFinishLoading:)])
|
||||
[_delegate bundleDidFinishLoading:self];
|
||||
}
|
||||
var context = new objj_context();
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(bundleDidFinishLoading:)])
|
||||
context.didCompleteCallback = function() { [_delegate bundleDidFinishLoading:self]; };
|
||||
|
||||
var files = [self objectForInfoDictionaryKey:@"CPBundleReplacedFiles"],
|
||||
count = files.length;
|
||||
|
||||
while (count--)
|
||||
context.pushFragment(fragment_create_file([self bundlePath] + '/' + files[count], new objj_bundle(""), YES, NULL));
|
||||
|
||||
objj_import([self bundlePath] + '/' + files.pop(), YES, importCallback);
|
||||
context.evaluate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ var CPURLConnectionDelegate = nil;
|
||||
CPURLRequest _request;
|
||||
id _delegate;
|
||||
BOOL _isCanceled;
|
||||
BOOL _isLocalFileConnection;
|
||||
|
||||
XMLHTTPRequest _XMLHTTPRequest;
|
||||
}
|
||||
@@ -150,6 +151,12 @@ var CPURLConnectionDelegate = nil;
|
||||
_delegate = aDelegate;
|
||||
_isCanceled = NO;
|
||||
|
||||
var path = [_request URL];
|
||||
|
||||
_isLocalFileConnection = path.indexOf("file:") === 0 ||
|
||||
((path.indexOf("http:") !== 0 || path.indexOf("https:") !== 0) &&
|
||||
window.location && window.location.protocol === "file:");
|
||||
|
||||
_XMLHTTPRequest = objj_request_xmlhttp();
|
||||
|
||||
if (shouldStartImmediately)
|
||||
@@ -217,20 +224,34 @@ var CPURLConnectionDelegate = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isLocalFileConnection
|
||||
{
|
||||
return _isLocalFileConnection;
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_readyStateDidChange
|
||||
{
|
||||
if (_XMLHTTPRequest.readyState == XMLHTTPRequestComplete)
|
||||
{
|
||||
var statusCode = _XMLHTTPRequest.status,
|
||||
url = [_request URL];
|
||||
URL = [_request URL];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(connection:didReceiveResponse:)])
|
||||
[_delegate connection:self didReceiveResponse:[[CPHTTPURLResponse alloc] _initWithStatusCode:statusCode]];
|
||||
|
||||
if (_isLocalFileConnection)
|
||||
[_delegate connection:self didReceiveResponse:[[CPURLResponse alloc] initWithURL:URL]];
|
||||
else
|
||||
{
|
||||
var response = [[CPHTTPURLResponse alloc] initWithURL:URL];
|
||||
|
||||
[response _setStatusCode:statusCode];
|
||||
|
||||
[_delegate connection:self didReceiveResponse:response];
|
||||
}
|
||||
|
||||
if (!_isCanceled)
|
||||
{
|
||||
if (statusCode == 200 || (url.indexOf("file:") === 0 && statusCode === 0) || ((url.indexOf("http:") !== 0 || url.indexOf("https:") !== 0) && window.location && window.location.protocol === "file:" && statusCode === 0))
|
||||
if (statusCode == 200 || (statusCode === 0 && _isLocalFileConnection))
|
||||
{
|
||||
[_delegate connection:self didReceiveData:_XMLHTTPRequest.responseText];
|
||||
[_delegate connectionDidFinishLoading:self];
|
||||
|
||||
@@ -34,6 +34,22 @@
|
||||
*/
|
||||
@implementation CPURLResponse : CPObject
|
||||
{
|
||||
CPURL _URL;
|
||||
}
|
||||
|
||||
- (id)initWithURL:(CPURL)aURL
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
_URL = aURL;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPURL)URL
|
||||
{
|
||||
return _URL;
|
||||
}
|
||||
/*
|
||||
Creating a Response
|
||||
@@ -56,14 +72,9 @@ Getting the Response Properties
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (id)_initWithStatusCode:(int)aStatusCode
|
||||
- (id)_setStatusCode:(int)aStatusCode
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
_statusCode = aStatusCode;
|
||||
|
||||
return self;
|
||||
_statusCode = aStatusCode;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in new issue
Block a user