Changeset 21618 in webkit


Ignore:
Timestamp:
May 21, 2007, 4:04:51 AM (17 years ago)
Author:
mjs
Message:

Reviewed by Geoff.


<rdar://problem/5205358> REGRESSION (r21367): All messages appear entirely blank when running Mail off of tip of tree WebKit


The fix is to return nil from [WebFrame dataSource] when it has not loaded anything but the fake
empty initial document. However, WebKit still needs the real data source internally, so I also
added a [WebFrame _dataSource] method that skips this check, and made WebKit use it throughout.

  • Misc/WebNSAttributedStringExtras.mm: (fileWrapperForElement):
  • Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView dataSource]):
  • Plugins/WebNullPluginView.mm: (-[WebNullPluginView viewDidMoveToWindow]):
  • Plugins/WebPluginController.mm: (-[WebPluginController URLPolicyCheckReferrer]):
  • WebCoreSupport/WebFrameBridge.mm: (-[WebFrameBridge dataSource]): (-[WebFrameBridge redirectDataToPlugin:]):
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::makeDocumentView): (WebFrameLoaderClient::forceLayoutForNonHTML): (WebFrameLoaderClient::prepareForDataSourceReplacement): (WebFrameLoaderClient::canCachePage):
  • WebCoreSupport/WebViewFactory.mm: (-[WebViewFactory bridgeForView:]):
  • WebKit.xcodeproj/project.pbxproj:
  • WebView/WebArchiver.mm: (+[WebArchiver archiveFrame:]): (+[WebArchiver archiveMainResourceForFrame:]): (+[WebArchiver _archiveWithMarkupString:fromFrame:nodes:]): (+[WebArchiver archiveSelectionInFrame:]):
  • WebView/WebFrame.mm: (-[WebFrame _loadURL:referrer:intoChild:]): (-[WebFrame _addChild:]): (-[WebFrame _dataSource]): (-[WebFrame DOMDocument]): (-[WebFrame dataSource]):
  • WebView/WebFrameInternal.h:
  • WebView/WebHTMLView.mm: (-[WebHTMLView _setPrinting:minimumPageWidth:maximumPageWidth:adjustViewSize:]):
  • WebView/WebRenderNode.mm: (-[WebRenderNode initWithWebFrameView:]):
  • WebView/WebView.mm: (-[WebView _mainFrameOverrideEncoding]): (-[WebView mainFrameURL]): (-[WebView mainFrameTitle]): (-[WebView mainFrameIcon]): (-[WebView validateUserInterfaceItemWithoutDelegate:]): (-[WebView replaceSelectionWithArchive:]): (-[WebView _isLoading]): (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]): (-[WebView _notifyTextSizeMultiplierChanged]):
Location:
trunk/WebKit
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r21596 r21618  
     12007-05-19  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Geoff.
     4       
     5        <rdar://problem/5205358> REGRESSION (r21367): All messages appear entirely blank when running Mail off of tip of tree WebKit
     6       
     7        The fix is to return nil from [WebFrame dataSource] when it has not loaded anything but the fake
     8        empty initial document. However, WebKit still needs the real data source internally, so I also
     9        added a [WebFrame _dataSource] method that skips this check, and made WebKit use it throughout.
     10
     11        * Misc/WebNSAttributedStringExtras.mm:
     12        (fileWrapperForElement):
     13        * Plugins/WebBaseNetscapePluginView.mm:
     14        (-[WebBaseNetscapePluginView dataSource]):
     15        * Plugins/WebNullPluginView.mm:
     16        (-[WebNullPluginView viewDidMoveToWindow]):
     17        * Plugins/WebPluginController.mm:
     18        (-[WebPluginController URLPolicyCheckReferrer]):
     19        * WebCoreSupport/WebFrameBridge.mm:
     20        (-[WebFrameBridge dataSource]):
     21        (-[WebFrameBridge redirectDataToPlugin:]):
     22        * WebCoreSupport/WebFrameLoaderClient.mm:
     23        (WebFrameLoaderClient::makeDocumentView):
     24        (WebFrameLoaderClient::forceLayoutForNonHTML):
     25        (WebFrameLoaderClient::prepareForDataSourceReplacement):
     26        (WebFrameLoaderClient::canCachePage):
     27        * WebCoreSupport/WebViewFactory.mm:
     28        (-[WebViewFactory bridgeForView:]):
     29        * WebKit.xcodeproj/project.pbxproj:
     30        * WebView/WebArchiver.mm:
     31        (+[WebArchiver archiveFrame:]):
     32        (+[WebArchiver archiveMainResourceForFrame:]):
     33        (+[WebArchiver _archiveWithMarkupString:fromFrame:nodes:]):
     34        (+[WebArchiver archiveSelectionInFrame:]):
     35        * WebView/WebFrame.mm:
     36        (-[WebFrame _loadURL:referrer:intoChild:]):
     37        (-[WebFrame _addChild:]):
     38        (-[WebFrame _dataSource]):
     39        (-[WebFrame DOMDocument]):
     40        (-[WebFrame dataSource]):
     41        * WebView/WebFrameInternal.h:
     42        * WebView/WebHTMLView.mm:
     43        (-[WebHTMLView _setPrinting:minimumPageWidth:maximumPageWidth:adjustViewSize:]):
     44        * WebView/WebRenderNode.mm:
     45        (-[WebRenderNode initWithWebFrameView:]):
     46        * WebView/WebView.mm:
     47        (-[WebView _mainFrameOverrideEncoding]):
     48        (-[WebView mainFrameURL]):
     49        (-[WebView mainFrameTitle]):
     50        (-[WebView mainFrameIcon]):
     51        (-[WebView validateUserInterfaceItemWithoutDelegate:]):
     52        (-[WebView replaceSelectionWithArchive:]):
     53        (-[WebView _isLoading]):
     54        (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]):
     55        (-[WebView _notifyTextSizeMultiplierChanged]):
     56
    1572007-05-18  Oliver Hunt  <oliver@apple.com>
    258
  • trunk/WebKit/Misc/WebNSAttributedStringExtras.mm

    r20930 r21618  
    9595    if (!attr.isEmpty()) {
    9696        NSURL *URL = KURL(e->document()->completeURL(attr.deprecatedString())).getNSURL();
    97         wrapper = [[kit(e->document()->frame()) dataSource] _fileWrapperForURL:URL];
     97        wrapper = [[kit(e->document()->frame()) _dataSource] _fileWrapperForURL:URL];
    9898    }
    9999    if (!wrapper) {
  • trunk/WebKit/Plugins/WebBaseNetscapePluginView.mm

    r21500 r21618  
    14481448{
    14491449    WebFrame *webFrame = kit(core(element)->document()->frame());
    1450     return [webFrame dataSource];
     1450    return [webFrame _dataSource];
    14511451}
    14521452
  • trunk/WebKit/Plugins/WebNullPluginView.mm

    r21159 r21618  
    7676        WebFrame *webFrame = kit(core(element)->document()->frame());
    7777        WebView *webView = [webFrame webView];
    78         WebDataSource *dataSource = [webFrame dataSource];
     78        WebDataSource *dataSource = [webFrame _dataSource];
    7979
    8080        id resourceLoadDelegate = [webView resourceLoadDelegate];
  • trunk/WebKit/Plugins/WebPluginController.mm

    r20104 r21618  
    380380- (NSString *)URLPolicyCheckReferrer
    381381{
    382     NSURL *responseURL = [[[[self webFrame] dataSource] response] URL];
     382    NSURL *responseURL = [[[[self webFrame] _dataSource] response] URL];
    383383    ASSERT(responseURL);
    384384    return [responseURL _web_originalDataAsString];
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.mm

    r21503 r21618  
    322322{
    323323    ASSERT(_frame != nil);
    324     WebDataSource *dataSource = [_frame dataSource];
     324    WebDataSource *dataSource = [_frame _dataSource];
    325325
    326326    ASSERT(dataSource != nil);
     
    531531- (void)redirectDataToPlugin:(NSView *)pluginView
    532532{
    533     WebHTMLRepresentation *representation = (WebHTMLRepresentation *)[[_frame dataSource] representation];
     533    WebHTMLRepresentation *representation = (WebHTMLRepresentation *)[[_frame _dataSource] representation];
    534534
    535535    if ([pluginView isKindOfClass:[WebNetscapePluginEmbeddedView class]])
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.mm

    r21582 r21618  
    160160{
    161161    WebFrameView *v = m_webFrame->_private->webFrameView;
    162     WebDataSource *ds = [m_webFrame.get() dataSource];
     162    WebDataSource *ds = [m_webFrame.get() _dataSource];
    163163
    164164    NSView <WebDocumentView> *documentView = [v _makeDocumentViewForDataSource:ds];
     
    211211    // Tell the just loaded document to layout.  This may be necessary
    212212    // for non-html content that needs a layout message.
    213     if (!([[m_webFrame.get() dataSource] _isDocumentHTML])) {
     213    if (!([[m_webFrame.get() _dataSource] _isDocumentHTML])) {
    214214        [thisDocumentView setNeedsLayout:YES];
    215215        [thisDocumentView layout];
     
    955955void WebFrameLoaderClient::prepareForDataSourceReplacement()
    956956{
    957     if (![m_webFrame.get() dataSource]) {
     957    if (![m_webFrame.get() _dataSource]) {
    958958        ASSERT(!core(m_webFrame.get())->tree()->childCount());
    959959        return;
     
    11481148{
    11491149    // We can only cache HTML pages right now
    1150     return [[[m_webFrame.get() dataSource] representation] isKindOfClass:[WebHTMLRepresentation class]];
     1150    return [[[m_webFrame.get() _dataSource] representation] isKindOfClass:[WebHTMLRepresentation class]];
    11511151}
    11521152
  • trunk/WebKit/WebCoreSupport/WebViewFactory.mm

    r19919 r21618  
    9191    while (aView) {
    9292        if ([aView isKindOfClass:[WebHTMLView class]]) {
    93             return [[[(WebHTMLView *)aView _frame] dataSource] _bridge];
     93            return [[[(WebHTMLView *)aView _frame] _dataSource] _bridge];
    9494        }
    9595        aView = [aView superview];
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r21596 r21618  
    13181318                        isa = PBXProject;
    13191319                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
     1320                        compatibilityVersion = "Xcode 2.4";
    13201321                        hasScannedForEncodings = 1;
    13211322                        knownRegions = (
     
    13321333                        projectDirPath = "";
    13331334                        projectRoot = "";
     1335                        shouldCheckCompatibility = 1;
    13341336                        targets = (
    13351337                                9398100A0824BF01008DF038 /* WebKit */,
  • trunk/WebKit/WebView/WebArchiver.mm

    r20018 r21618  
    6262+ (WebArchive *)archiveFrame:(WebFrame *)frame;
    6363{
    64     return [[[WebArchive alloc] initWithMainResource:[[frame dataSource] mainResource]
    65                                         subresources:[[frame dataSource] subresources]
     64    return [[[WebArchive alloc] initWithMainResource:[[frame _dataSource] mainResource]
     65                                        subresources:[[frame _dataSource] subresources]
    6666                                    subframeArchives:[self _subframeArchivesForFrame:frame]] autorelease];
    6767}
     
    6969+ (WebArchive *)archiveMainResourceForFrame:(WebFrame *)frame;
    7070{
    71     return [[[WebArchive alloc] initWithMainResource:[[frame dataSource] mainResource]
     71    return [[[WebArchive alloc] initWithMainResource:[[frame _dataSource] mainResource]
    7272                                        subresources:nil
    7373                                    subframeArchives:nil] autorelease];
     
    8484+ (WebArchive *)_archiveWithMarkupString:(NSString *)markupString fromFrame:(WebFrame *)frame nodes:(NSArray *)nodes
    8585{
    86     NSURLResponse *response = [[frame dataSource] response];
     86    NSURLResponse *response = [[frame _dataSource] response];
    8787    WebResource *mainResource = [[WebResource alloc] initWithData:[markupString dataUsingEncoding:NSUTF8StringEncoding]
    8888                                                              URL:[response URL]
     
    110110                    continue;
    111111                [uniqueSubresources addObject:URL];
    112                 WebResource *subresource = [[frame dataSource] subresourceForURL:URL];
     112                WebResource *subresource = [[frame _dataSource] subresourceForURL:URL];
    113113                if (subresource)
    114114                    [subresources addObject:subresource];
     
    162162        // another document (which will have a body or frameset of its own).
    163163
    164         NSString *iframeMarkup = [[NSString alloc] initWithFormat:@"<iframe frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\" width=\"98%%\" height=\"98%%\" src=\"%@\"></iframe>", [[[frame dataSource] response] URL]];
     164        NSString *iframeMarkup = [[NSString alloc] initWithFormat:@"<iframe frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\" width=\"98%%\" height=\"98%%\" src=\"%@\"></iframe>", [[[frame _dataSource] response] URL]];
    165165        WebResource *iframeResource = [[WebResource alloc] initWithData:[iframeMarkup dataUsingEncoding:NSUTF8StringEncoding]
    166166                                                                  URL:[NSURL URLWithString:@"about:blank"]
  • trunk/WebKit/WebView/WebFrame.mm

    r21529 r21618  
    321321    }
    322322
    323     WebArchive *archive = [[self dataSource] _popSubframeArchiveWithName:[childFrame name]];
     323    WebArchive *archive = [[self _dataSource] _popSubframeArchiveWithName:[childFrame name]];
    324324    if (archive)
    325325        [childFrame loadArchive:archive];
     
    347347{
    348348    core(self)->tree()->appendChild(adoptRef(core(child)));
    349     if ([child dataSource])
    350         [[child dataSource] _documentLoader]->setOverrideEncoding([[self dataSource] _documentLoader]->overrideEncoding()); 
     349    if ([child _dataSource])
     350        [[child _dataSource] _documentLoader]->setOverrideEncoding([[self _dataSource] _documentLoader]->overrideEncoding()); 
    351351}
    352352
     
    575575}
    576576
     577- (WebDataSource *)_dataSource
     578{
     579    FrameLoader* frameLoader = [self _frameLoader];
     580
     581    if (!frameLoader)
     582        return nil;
     583
     584    return dataSource(frameLoader->documentLoader());
     585}
     586
    577587@end
    578588
     
    736746    // into a web frame, the old document can still be around. This makes sure that
    737747    // we'll return nil in those cases.
    738     if (![[self dataSource] _isDocumentHTML])
     748    if (![[self _dataSource] _isDocumentHTML])
    739749        return nil;
    740750
     
    766776- (WebDataSource *)dataSource
    767777{
    768     FrameLoader* frameLoader = [self _frameLoader];
    769     return frameLoader ? dataSource(frameLoader->documentLoader()) : nil;
     778    if (![self _frameLoader]->frameHasLoaded())
     779        return nil;
     780
     781    return [self _dataSource];
    770782}
    771783
  • trunk/WebKit/WebView/WebFrameInternal.h

    r20179 r21618  
    165165- (void)_detachScriptDebugger;
    166166
     167// dataSource reports null for the initial empty document's data source; this is needed
     168// to preserve compatibility with Mail and Safari among others. But internal to WebKit,
     169// we need to be able to get the initial data source as well, so the _dataSource method
     170// should be used instead.
     171- (WebDataSource *)_dataSource;
     172
    167173@end
    168174
  • trunk/WebKit/WebView/WebHTMLView.mm

    r21596 r21618  
    30883088        WebFrame *subframe = [subframes objectAtIndex:i];
    30893089        WebFrameView *frameView = [subframe frameView];
    3090         if ([[subframe dataSource] _isDocumentHTML]) {
     3090        if ([[subframe _dataSource] _isDocumentHTML]) {
    30913091            [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0.0f maximumPageWidth:0.0f adjustViewSize:adjustViewSize];
    30923092        }
  • trunk/WebKit/WebView/WebRenderNode.mm

    r18725 r21618  
    3434#import <WebKit/WebDataSourceInternal.h>
    3535#import <WebKit/WebNSViewExtras.h>
     36#import "WebFrameInternal.h"
    3637
    3738@interface WebKitRenderTreeCopier : NSObject <WebCoreRenderTreeCopier>
     
    8283   
    8384    copier = [[WebKitRenderTreeCopier alloc] init];
    84     self = [[[[[view webFrame] dataSource] _bridge] copyRenderTree:copier] retain];
     85    self = [[[[[view webFrame] _dataSource] _bridge] copyRenderTree:copier] retain];
    8586    [copier release];
    8687   
  • trunk/WebKit/WebView/WebView.mm

    r21533 r21618  
    21642164    WebDataSource *dataSource = [[self mainFrame] provisionalDataSource];
    21652165    if (dataSource == nil)
    2166         dataSource = [[self mainFrame] dataSource];
     2166        dataSource = [[self mainFrame] _dataSource];
    21672167    if (dataSource == nil)
    21682168        return nil;
     
    24882488    ds = [[self mainFrame] provisionalDataSource];
    24892489    if (!ds)
    2490         ds = [[self mainFrame] dataSource];
     2490        ds = [[self mainFrame] _dataSource];
    24912491    return [[[ds request] URL] _web_originalDataAsString];
    24922492}
     
    25002500- (NSString *)mainFrameTitle
    25012501{
    2502     NSString *mainFrameTitle = [[[self mainFrame] dataSource] pageTitle];
     2502    NSString *mainFrameTitle = [[[self mainFrame] _dataSource] pageTitle];
    25032503    return (mainFrameTitle != nil) ? mainFrameTitle : (NSString *)@"";
    25042504}
     
    25062506- (NSImage *)mainFrameIcon
    25072507{
    2508     return [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[self mainFrame] dataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
     2508    return [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[self mainFrame] _dataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
    25092509}
    25102510
     
    26842684        return [self canMakeTextStandardSize];
    26852685    } else if (action == @selector(reload:)) {
    2686         return [[self mainFrame] dataSource] != nil;
     2686        return [[self mainFrame] _dataSource] != nil;
    26872687    } else if (action == @selector(stopLoading:)) {
    26882688        return [self _isLoading];
     
    33713371- (void)replaceSelectionWithArchive:(WebArchive *)archive
    33723372{
    3373     [[[[self _bridgeForSelectedOrMainFrame] webFrame] dataSource] _replaceSelectionWithArchive:archive selectReplacement:YES];
     3373    [[[[self _bridgeForSelectedOrMainFrame] webFrame] _dataSource] _replaceSelectionWithArchive:archive selectReplacement:YES];
    33743374}
    33753375
     
    34953495{
    34963496    WebFrame *mainFrame = [self mainFrame];
    3497     return [[mainFrame dataSource] isLoading]
     3497    return [[mainFrame _dataSource] isLoading]
    34983498        || [[mainFrame provisionalDataSource] isLoading];
    34993499}
     
    36093609- (BOOL)_performTextSizingSelector:(SEL)sel withObject:(id)arg onTrackingDocs:(BOOL)doTrackingViews selForNonTrackingDocs:(SEL)testSel newScaleFactor:(float)newScaleFactor
    36103610{
    3611     if ([[self mainFrame] dataSource] == nil)
     3611    if ([[self mainFrame] _dataSource] == nil)
    36123612        return NO;
    36133613   
     
    36453645- (void)_notifyTextSizeMultiplierChanged
    36463646{
    3647     if ([[self mainFrame] dataSource] == nil)
     3647    if ([[self mainFrame] _dataSource] == nil)
    36483648        return;
    36493649
Note: See TracChangeset for help on using the changeset viewer.