diff --git a/AppKit/CPButtonBar.j b/AppKit/CPButtonBar.j index f655796b5..4dd9db247 100644 --- a/AppKit/CPButtonBar.j +++ b/AppKit/CPButtonBar.j @@ -26,7 +26,8 @@ @class CPSplitView @global CPPopUpButtonStatePullsDown - +@global CPKeyValueChangeOldKey +@global CPKeyValueChangeNewKey @implementation CPButtonBar : CPView { @@ -129,10 +130,16 @@ - (void)setButtons:(CPArray)buttons { + for (var i = [_buttons count] - 1; i >= 0; i--) + [_buttons[i] removeObserver:self forKeyPath:@"hidden"]; + _buttons = [CPArray arrayWithArray:buttons]; - for (var i = 0, count = [_buttons count]; i < count; i++) + for (var i = [_buttons count] - 1; i >= 0; i--) + { + [_buttons[i] addObserver:self forKeyPath:@"hidden" options:nil context:nil]; [_buttons[i] setBordered:YES]; + } [self setNeedsLayout]; } @@ -280,6 +287,14 @@ } } +- (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change context:(id)context +{ + if ([change objectForKey:CPKeyValueChangeOldKey] == [change objectForKey:CPKeyValueChangeNewKey]) + return; + + [self setNeedsLayout]; +} + - (void)setFrameSize:(CGSize)aSize { [super setFrameSize:aSize]; diff --git a/Objective-J/CFHTTPRequest.js b/Objective-J/CFHTTPRequest.js index 1e82be082..6186dc80f 100644 --- a/Objective-J/CFHTTPRequest.js +++ b/Objective-J/CFHTTPRequest.js @@ -99,7 +99,6 @@ GLOBAL(CFHTTPRequest) = function() this._isOpen = false; this._requestHeaders = {}; this._mimeType = null; - this._withCredentials = false; this._eventDispatcher = new EventDispatcher(this); this._nativeRequest = new NativeRequest(); @@ -225,9 +224,7 @@ CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*B this._method = aMethod; this._user = aUser; this._password = aPassword; - var result = this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, aPassword); - this._nativeRequest.withCredentials = this._withCredentials; - return result; + return this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, aPassword); }; CFHTTPRequest.prototype.send = function(/*Object*/ aBody) @@ -236,7 +233,6 @@ CFHTTPRequest.prototype.send = function(/*Object*/ aBody) { delete this._nativeRequest.onreadystatechange; this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password); - this._nativeRequest.withCredentials = this._withCredentials; this._nativeRequest.onreadystatechange = this._stateChangeHandler; } @@ -280,12 +276,12 @@ CFHTTPRequest.prototype.removeEventListener = function(/*String*/ anEventName, / CFHTTPRequest.prototype.setWithCredentials = function(/*Boolean*/ willSendWithCredentials) { - this.withCredentials = willSendWithCredentials; + this._nativeRequest.withCredentials = willSendWithCredentials; }; CFHTTPRequest.prototype.getWithCredentials = function() { - return this.withCredentials; + return this._nativeRequest.withCredentials; }; function determineAndDispatchHTTPRequestEvents(/*CFHTTPRequest*/ aRequest)