Changeset 18399 in webkit


Ignore:
Timestamp:
Dec 22, 2006 4:19:06 PM (17 years ago)
Author:
ggaren
Message:

LayoutTests:

Reviewed by Brady Eidson.


Test for <rdar://problem/4871518> Leopard9A321: Crash visiting www.audible.com
(WebCore::FrameLoader::loadSubframe)


Tests an onload handler for a synchronously loaded iframe removing the iframe
from the document.

  • fast/frames/onload-remove-iframe-crash-expected.txt: Added.
  • fast/frames/onload-remove-iframe-crash.html: Added.

WebCore:

Reviewed by Brady Eidson.


Fixed <rdar://problem/4871518> Leopard9A321: Crash visiting www.audible.com
(WebCore::FrameLoader::loadSubframe)

  • loader/mac/FrameLoaderMac.mm: (WebCore::FrameLoader::createFrame): Updated to reflect the fact that createChildFrameNamed: now returns a WebCore::Frame* instead of a WebCoreFrameBridge *.
  • page/mac/WebCoreFrameBridge.h:

WebKit:

Reviewed by Brady Eidson.


Fixed <rdar://problem/4871518> Leopard9A321: Crash visiting www.audible.com
(WebCore::FrameLoader::loadSubframe)

  • WebCoreSupport/WebFrameBridge.mm: (-[WebFrameBridge createChildFrameNamed:withURL:referrer:ownerElement:allowsScrolling:marginWidth:marginHeight:]):
  • The fix:

Changed to re-fetch the child frame we're trying to load before returning it,
since its onload handler may have removed it from the document. This
allows us to treat a removed frame like a frame that never loaded.


  • Plus some cleanup:
    • Changed to return a WebCore::Frame* instead of a WebFrameBridge *, to simplify some code.
    • Grouped ObjC objects by usage, and moved calls to -release so that they immediately follow the calls that retain.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18393 r18399  
     12006-12-22  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Brady Eidson.
     4       
     5        Test for <rdar://problem/4871518> Leopard9A321: Crash visiting www.audible.com
     6        (WebCore::FrameLoader::loadSubframe)
     7       
     8        Tests an onload handler for a synchronously loaded iframe removing the iframe
     9        from the document.
     10
     11        * fast/frames/onload-remove-iframe-crash-expected.txt: Added.
     12        * fast/frames/onload-remove-iframe-crash.html: Added.
     13
    1142006-12-22  Nikolas Zimmermann  <zimmermann@kde.org>
    215
  • trunk/WebCore/ChangeLog

    r18398 r18399  
     12006-12-22  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Brady Eidson.
     4       
     5        Fixed <rdar://problem/4871518> Leopard9A321: Crash visiting www.audible.com
     6        (WebCore::FrameLoader::loadSubframe)
     7
     8        * loader/mac/FrameLoaderMac.mm:
     9        (WebCore::FrameLoader::createFrame): Updated to reflect the fact that
     10        createChildFrameNamed: now returns a WebCore::Frame* instead of a
     11        WebCoreFrameBridge *.
     12        * page/mac/WebCoreFrameBridge.h:
     13
    1142006-12-22  David Hyatt  <hyatt@apple.com>
    215
  • trunk/WebCore/loader/mac/FrameLoaderMac.mm

    r18242 r18399  
    12591259    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    12601260   
    1261     return [[Mac(m_frame)->bridge() createChildFrameNamed:name
    1262                                                              withURL:url.getNSURL()
    1263                                                             referrer:referrer
    1264                                                           ownerElement:ownerElement
    1265                                                      allowsScrolling:allowsScrolling
    1266                                                          marginWidth:marginWidth
    1267                                                         marginHeight:marginHeight] _frame];
     1261    return [Mac(m_frame)->bridge() createChildFrameNamed:name
     1262                                                 withURL:url.getNSURL()
     1263                                                referrer:referrer
     1264                                              ownerElement:ownerElement
     1265                                         allowsScrolling:allowsScrolling
     1266                                             marginWidth:marginWidth
     1267                                            marginHeight:marginHeight];
    12681268
    12691269    END_BLOCK_OBJC_EXCEPTIONS;
  • trunk/WebCore/page/mac/WebCoreFrameBridge.h

    r18302 r18399  
    279279- (void)setStatusText:(NSString *)status;
    280280
    281 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL referrer:(const WebCore::String&)referrer
     281- (WebCore::Frame*)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL referrer:(const WebCore::String&)referrer
    282282    ownerElement:(WebCore::HTMLFrameOwnerElement *)ownerElement allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
    283283
  • trunk/WebKit/ChangeLog

    r18388 r18399  
     12006-12-22  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Brady Eidson.
     4       
     5        Fixed <rdar://problem/4871518> Leopard9A321: Crash visiting www.audible.com
     6        (WebCore::FrameLoader::loadSubframe)
     7
     8        * WebCoreSupport/WebFrameBridge.mm:
     9        (-[WebFrameBridge createChildFrameNamed:withURL:referrer:ownerElement:allowsScrolling:marginWidth:marginHeight:]):
     10        - The fix:
     11            Changed to re-fetch the child frame we're trying to load before returning it,
     12            since its onload handler may have removed it from the document. This
     13            allows us to treat a removed frame like a frame that never loaded.
     14       
     15        - Plus some cleanup:
     16            - Changed to return a WebCore::Frame* instead of a WebFrameBridge *,
     17            to simplify some code.
     18            - Grouped ObjC objects by usage, and moved calls to -release so that they
     19            immediately follow the calls that retain.
     20
    1212006-12-21  John Sullivan  <sullivan@apple.com>
    222
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.mm

    r18302 r18399  
    380380}
    381381
    382 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName
     382- (Frame*)createChildFrameNamed:(NSString *)frameName
    383383                                      withURL:(NSURL *)URL
    384384                                     referrer:(const String&)referrer
     
    390390    bool hideReferrer;
    391391    if (!m_frame->loader()->canLoad(URL, referrer, hideReferrer))
    392         return nil;
     392        return 0;
    393393
    394394    ASSERT(_frame);
     
    396396    WebFrameView *childView = [[WebFrameView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
    397397    [childView setAllowsScrolling:allowsScrolling];
    398     WebFrameBridge *newBridge = [[WebFrameBridge alloc] initSubframeWithOwnerElement:ownerElement frameName:frameName frameView:childView];
    399     [_frame _addChild:[newBridge webFrame]];
    400     [childView release];
    401 
    402398    [childView _setMarginWidth:width];
    403399    [childView _setMarginHeight:height];
    404400
     401    WebFrameBridge *newBridge = [[WebFrameBridge alloc] initSubframeWithOwnerElement:ownerElement frameName:frameName frameView:childView];
     402    [childView release];
     403
     404    if (!newBridge)
     405        return 0;
     406
     407    [_frame _addChild:[newBridge webFrame]];
    405408    [newBridge release];
    406409
    407     if (!newBridge)
    408         return nil;
    409 
    410410    [_frame _loadURL:URL referrer:(hideReferrer ? String() : referrer) intoChild:[newBridge webFrame]];
    411411
    412     return newBridge;
     412    // Re-fetch the child frame, since its onload handler may have removed it from the document.
     413    return m_frame->tree()->child(frameName);
    413414}
    414415
Note: See TracChangeset for help on using the changeset viewer.