[webkit-changes] cvs commit: WebKit/WebView.subproj WebFrame.m
Maciej
mjs at opensource.apple.com
Mon Dec 26 13:46:28 PST 2005
mjs 05/12/26 13:46:28
Modified: . ChangeLog
kwq WebCoreBridge.h WebCoreBridge.mm
. ChangeLog
WebCoreSupport.subproj WebBridge.h WebBridge.m
WebView.subproj WebFrame.m
Log:
WebCore:
Reviewed by Geoff.
- Remove WebFrame's parent frame pointer, instead rely on WebCore's parent concept
http://bugzilla.opendarwin.org/show_bug.cgi?id=6241
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge parent]): New method, relies on the KHTMLPart's
parent pointer.
WebKit:
Reviewed by Geoff
- Remove WebFrame's parent frame pointer, instead rely on WebCore's parent concept
http://bugzilla.opendarwin.org/show_bug.cgi?id=6241
* WebCoreSupport.subproj/WebBridge.h:
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge canTargetLoadInFrame:]): Use bridge parent method instead of needlessly
asking for parent via WebFrame
(-[WebBridge frameDetached]): Don't call _removeChild on the parent frame any more
because WebFame's _detachFromParent takes care of that now.
* WebView.subproj/WebFrame.m:
(-[WebFrame _createItemTreeWithTargetFrame:clippedAtTarget:]): Fix stray spaces
(-[WebFrame _detachChildren]): Don't remove children as we loop any more, they
can remove themselves.
(-[WebFrame _detachFromParent]): Remove self from parent; don't nil out bridge
until we are done with it.
(-[WebFrame _transitionToCommitted:]): Remove some extra braces.
(-[WebFrame _goToItem:withLoadType:]): Use parentFrame method in assert instead of parent
field directly.
(-[WebFrame _addChild:]): Don't poke at parent frame pointer in _private
since it is not there any more.
(-[WebFrame _removeChild:]): Remove extra braces and don't clear parent pointer
explicitly any more.
(-[WebFrame _addFramePathToString:]): Get parentFrame from method, not field.
(-[WebFrame _loadDataSource:withLoadType:formState:]): Remove extra braces.
(-[WebFrame _nextFrameWithWrap:]): Get parent in the proper way and clean up the
coding style.
(-[WebFrame _previousFrameWithWrap:]): Ditto.
(-[WebFrame parentFrame]): Get parent from the bridge.
Revision Changes Path
1.42 +12 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- ChangeLog 25 Dec 2005 18:28:22 -0000 1.41
+++ ChangeLog 26 Dec 2005 21:46:16 -0000 1.42
@@ -1,3 +1,15 @@
+2005-12-25 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Geoff.
+
+ - Remove WebFrame's parent frame pointer, instead rely on WebCore's parent concept
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6241
+
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge parent]): New method, relies on the KHTMLPart's
+ parent pointer.
+
2005-12-24 Mitz Pettel <opendarwin.org at mitzpettel.com>
Reviewed by eseidel.
1.356 +1 -0 WebCore/kwq/WebCoreBridge.h
Index: WebCoreBridge.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.h,v
retrieving revision 1.355
retrieving revision 1.356
diff -u -r1.355 -r1.356
--- WebCoreBridge.h 20 Dec 2005 17:05:53 -0000 1.355
+++ WebCoreBridge.h 26 Dec 2005 21:46:17 -0000 1.356
@@ -207,6 +207,7 @@
- (KWQKHTMLPart *)part;
- (void)setParent:(WebCoreBridge *)parent;
+- (WebCoreBridge *)parent;
- (void)provisionalLoadStarted;
1.446 +8 -0 WebCore/kwq/WebCoreBridge.mm
Index: WebCoreBridge.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.mm,v
retrieving revision 1.445
retrieving revision 1.446
diff -u -r1.445 -r1.446
--- WebCoreBridge.mm 22 Dec 2005 04:11:39 -0000 1.445
+++ WebCoreBridge.mm 26 Dec 2005 21:46:17 -0000 1.446
@@ -334,6 +334,14 @@
_part->setParent([parent part]);
}
+- (WebCoreBridge *)parent
+{
+ KWQKHTMLPart *parentPart = KWQ(_part->parentPart());
+ if (!parentPart)
+ return nil;
+ return parentPart->bridge();
+}
+
- (void)provisionalLoadStarted
{
_part->provisionalLoadStarted();
1.3429 +33 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3428
retrieving revision 1.3429
diff -u -r1.3428 -r1.3429
--- ChangeLog 26 Dec 2005 08:06:06 -0000 1.3428
+++ ChangeLog 26 Dec 2005 21:46:19 -0000 1.3429
@@ -1,5 +1,38 @@
2005-12-25 Maciej Stachowiak <mjs at apple.com>
+ Reviewed by Geoff
+
+ - Remove WebFrame's parent frame pointer, instead rely on WebCore's parent concept
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6241
+
+ * WebCoreSupport.subproj/WebBridge.h:
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge canTargetLoadInFrame:]): Use bridge parent method instead of needlessly
+ asking for parent via WebFrame
+ (-[WebBridge frameDetached]): Don't call _removeChild on the parent frame any more
+ because WebFame's _detachFromParent takes care of that now.
+ * WebView.subproj/WebFrame.m:
+ (-[WebFrame _createItemTreeWithTargetFrame:clippedAtTarget:]): Fix stray spaces
+ (-[WebFrame _detachChildren]): Don't remove children as we loop any more, they
+ can remove themselves.
+ (-[WebFrame _detachFromParent]): Remove self from parent; don't nil out bridge
+ until we are done with it.
+ (-[WebFrame _transitionToCommitted:]): Remove some extra braces.
+ (-[WebFrame _goToItem:withLoadType:]): Use parentFrame method in assert instead of parent
+ field directly.
+ (-[WebFrame _addChild:]): Don't poke at parent frame pointer in _private
+ since it is not there any more.
+ (-[WebFrame _removeChild:]): Remove extra braces and don't clear parent pointer
+ explicitly any more.
+ (-[WebFrame _addFramePathToString:]): Get parentFrame from method, not field.
+ (-[WebFrame _loadDataSource:withLoadType:formState:]): Remove extra braces.
+ (-[WebFrame _nextFrameWithWrap:]): Get parent in the proper way and clean up the
+ coding style.
+ (-[WebFrame _previousFrameWithWrap:]): Ditto.
+ (-[WebFrame parentFrame]): Get parent from the bridge.
+
+2005-12-25 Maciej Stachowiak <mjs at apple.com>
+
Reviewed by Hyatt.
- fixed REGRESSION: world leak of WebDataSource
1.30 +1 -0 WebKit/WebCoreSupport.subproj/WebBridge.h
Index: WebBridge.h
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- WebBridge.h 5 Jun 2005 17:54:39 -0000 1.29
+++ WebBridge.h 26 Dec 2005 21:46:26 -0000 1.30
@@ -34,6 +34,7 @@
@interface WebBridge : WebCoreBridge <WebCoreBridge>
{
+ WebBridge *_parentBridge;
WebFrame *_frame;
WebCoreKeyboardUIMode _keyboardUIMode;
BOOL _keyboardUIModeAccessed;
1.381 +9 -17 WebKit/WebCoreSupport.subproj/WebBridge.m
Index: WebBridge.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
retrieving revision 1.380
retrieving revision 1.381
diff -u -r1.380 -r1.381
--- WebBridge.m 20 Dec 2005 20:41:52 -0000 1.380
+++ WebBridge.m 26 Dec 2005 21:46:26 -0000 1.381
@@ -694,9 +694,8 @@
// <rdar://problem/3715785> multiple frame injection vulnerability reported by Secunia, affects almost all browsers
// don't mess with navigation purely within the same frame
- if ([[self webFrame] webView] == [targetFrame webView]) {
+ if ([[self webFrame] webView] == [targetFrame webView])
return YES;
- }
// Normally, domain should be called on the DOMDocument since it is a DOM method, but this fix is needed for
// Jaguar as well where the DOM API doesn't exist.
@@ -706,17 +705,15 @@
return YES;
}
- WebFrame *parentFrame = [targetFrame parentFrame];
- if (parentFrame == nil) {
- // Allow if target is an entire window.
+ WebBridge *parentBridge = (WebBridge *)[[targetFrame _bridge] parent];
+ // Allow if target is an entire window.
+ if (!parentBridge)
return YES;
- }
- NSString *parentDomain = [[parentFrame _bridge] domain];
- if (parentDomain != nil && [thisDomain _webkit_isCaseInsensitiveEqualToString:parentDomain]) {
- // Allow if the domain of the parent of the targeted frame equals this domain.
+ NSString *parentDomain = [parentBridge domain];
+ // Allow if the domain of the parent of the targeted frame equals this domain.
+ if (parentDomain && [thisDomain _webkit_isCaseInsensitiveEqualToString:parentDomain])
return YES;
- }
return NO;
}
@@ -1329,13 +1326,8 @@
- (void)frameDetached
{
- // Put _frame into a local variable because _detachFromParent
- // will disconnect the bridge from the frame and make _frame nil.
- WebFrame *frame = _frame;
-
- [frame stopLoading];
- [frame _detachFromParent];
- [[frame parentFrame] _removeChild:frame];
+ [_frame stopLoading];
+ [_frame _detachFromParent];
}
- (void)setHasBorder:(BOOL)hasBorder
1.264 +36 -49 WebKit/WebView.subproj/WebFrame.m
Index: WebFrame.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
retrieving revision 1.263
retrieving revision 1.264
diff -u -r1.263 -r1.264
--- WebFrame.m 25 Dec 2005 11:05:04 -0000 1.263
+++ WebFrame.m 26 Dec 2005 21:46:27 -0000 1.264
@@ -202,7 +202,6 @@
WebView *webView;
WebFrameState state;
WebFrameLoadType loadType;
- WebFrame *parent;
NSMutableArray *children;
WebHistoryItem *currentItem; // BF item for our current content
WebHistoryItem *provisionalItem; // BF item for where we're trying to go
@@ -513,7 +512,7 @@
*/
- (WebHistoryItem *)_createItemTreeWithTargetFrame:(WebFrame *)targetFrame clippedAtTarget:(BOOL)doClip
{
- WebHistoryItem *bfItem = [self _createItem: [self parentFrame]?YES:NO];
+ WebHistoryItem *bfItem = [self _createItem:[self parentFrame] ? YES : NO];
[self _saveScrollPositionAndViewStateToItem:[_private previousItem]];
if (!(doClip && self == targetFrame)) {
@@ -578,15 +577,10 @@
- (void)_detachChildren
{
- // Note we have to be careful to remove the kids as we detach each one,
- // since detaching stops loading, which checks loadComplete, which runs the whole
- // frame tree, at which point we don't want to trip on already detached kids.
if (_private->children) {
int i;
- for (i = [_private->children count]-1; i >=0; i--) {
+ for (i = [_private->children count]-1; i >=0; i--)
[[_private->children objectAtIndex:i] _detachFromParent];
- [_private->children removeObjectAtIndex:i];
- }
[_private->children release];
_private->children = nil;
}
@@ -608,7 +602,6 @@
- (void)_detachFromParent
{
WebBridge *bridge = _private->bridge;
- _private->bridge = nil;
[self stopLoading];
[self _saveScrollPositionAndViewStateToItem:[_private currentItem]];
@@ -626,9 +619,14 @@
[self _setDataSource:nil];
[_private setWebFrameView:nil];
+ [self retain]; // retain self temporarily because dealloc can re-enter this method
+
+ [[self parentFrame] _removeChild:self];
[bridge close];
-
[bridge release];
+ _private->bridge = nil;
+
+ [self release];
}
- (void)_setDataSource:(WebDataSource *)ds
@@ -872,9 +870,8 @@
WebHistoryItem *parentItem = [parentFrame->_private currentItem];
// The only case where parentItem==nil should be when a parent frame loaded an
// empty URL, which doesn't set up a current item in that parent.
- if (parentItem) {
+ if (parentItem)
[parentItem addChildItem:[self _createItem: YES]];
- }
} else {
// See 3556159. It's not clear if it's valid to be in WebFrameLoadTypeOnLoadEvent
// for a top-level frame, but that was a likely explanation for those crashes,
@@ -1527,9 +1524,9 @@
// Main funnel for navigating to a previous location (back/forward, non-search snap-back)
// This includes recursion to handle loading into framesets properly
-- (void)_goToItem: (WebHistoryItem *)item withLoadType: (WebFrameLoadType)type
+- (void)_goToItem:(WebHistoryItem *)item withLoadType:(WebFrameLoadType)type
{
- ASSERT(!_private->parent);
+ ASSERT(![self parentFrame]);
// shouldGoToHistoryItem is a private delegate method. This is needed to fix:
// <rdar://problem/3951283> can view pages from the back/forward cache that should be disallowed by Parental Controls
// Ultimately, history item navigations should go through the policy delegate. That's covered in:
@@ -2205,7 +2202,6 @@
_private->children = [[NSMutableArray alloc] init];
[_private->children addObject:child];
- child->_private->parent = self;
[[child _bridge] setParent:_private->bridge];
[[child dataSource] _setOverrideEncoding:[[self dataSource] _overrideEncoding]];
@@ -2225,16 +2221,13 @@
{
// move corresponding previous and next WebFrame sibling pointers to their new positions
// when we remove a child we may have to reattach the previous frame's next frame and visa versa
- if (child->_private->previousSibling) {
+ if (child->_private->previousSibling)
child->_private->previousSibling->_private->nextSibling = child->_private->nextSibling;
- }
- if (child->_private->nextSibling) {
+ if (child->_private->nextSibling)
child->_private->nextSibling->_private->previousSibling = child->_private->previousSibling;
- }
[_private->children removeObject:child];
- child->_private->parent = nil;
}
- (void)_addFramePathToString:(NSMutableString *)path
@@ -2245,9 +2238,7 @@
[path appendString:[_private->name substringWithRange:ourPathRange]];
} else {
// we don't have a generated name - just add our simple name to the end
- if (_private->parent) {
- [_private->parent _addFramePathToString:path];
- }
+ [[self parentFrame] _addFramePathToString:path];
[path appendString:@"/"];
if (_private->name) {
[path appendString:_private->name];
@@ -2440,9 +2431,8 @@
_private->policyLoadType = loadType;
WebFrame *parentFrame = [self parentFrame];
- if (parentFrame) {
+ if (parentFrame)
[newDataSource _setOverrideEncoding:[[parentFrame dataSource] _overrideEncoding]];
- }
[newDataSource _setWebView:[self webView]];
// FIXME: shouldn't this set the WebFrame too? who sets it?
@@ -2506,20 +2496,17 @@
// Return next frame to be traversed, visiting children after parent
- (WebFrame *)_nextFrameWithWrap:(BOOL)wrapFlag
{
- if (_private->children && [_private->children count]) {
+ if (_private->children && [_private->children count])
return [_private->children objectAtIndex:0];
- } else if (_private->parent) {
- WebFrame *frame;
- for (frame = self; frame->_private->parent; frame = frame->_private->parent) {
- WebFrame *nextSibling = frame->_private->nextSibling;
- if (nextSibling) {
- return nextSibling;
- }
- }
- return wrapFlag ? frame : nil; // made it all the way to the top
- } else {
- return wrapFlag ? self : nil; // self is the top and we have no kids
+
+ WebFrame * frame;
+ for (frame = self; [frame parentFrame]; frame = [frame parentFrame]) {
+ WebFrame *nextSibling = frame->_private->nextSibling;
+ if (nextSibling)
+ return nextSibling;
}
+
+ return wrapFlag ? frame : nil; // made it all the way to the top
}
// Return previous frame to be traversed, exact reverse order of _nextFrame
@@ -2529,18 +2516,18 @@
if (prevSibling) {
WebFrame *prevSiblingLastChild = [prevSibling _lastChild];
return prevSiblingLastChild ? prevSiblingLastChild : prevSibling;
- } else if (_private->parent) {
- return _private->parent;
- } else {
- // no siblings, no parent, self==top
- if (wrapFlag) {
- WebFrame *selfLastChild = [self _lastChild];
- return selfLastChild ? selfLastChild : self;
- } else {
- // top view is always the last one in this ordering, so prev is nil without wrap
- return nil;
- }
+ }
+ if ([self parentFrame])
+ return [self parentFrame];
+
+ // no siblings, no parent, self==top
+ if (wrapFlag) {
+ WebFrame *selfLastChild = [self _lastChild];
+ return selfLastChild ? selfLastChild : self;
}
+
+ // top view is always the last one in this ordering, so prev is nil without wrap
+ return nil;
}
- (void)_setShouldCreateRenderers:(BOOL)f
@@ -3310,7 +3297,7 @@
- (WebFrame *)parentFrame
{
- return [[_private->parent retain] autorelease];
+ return [[[(WebBridge *)[[self _bridge] parent] webFrame] retain] autorelease];
}
- (NSArray *)childFrames
More information about the webkit-changes
mailing list