Changeset 35377 in webkit


Ignore:
Timestamp:
Jul 26, 2008 8:49:29 PM (16 years ago)
Author:
mrowe@apple.com
Message:

2008-07-26 Daniel Jalkut <jalkut@red-sweater.com>

Reviewed by Geoff Garen.

Revised the FrameLoader class to clean up a variety of load methods, and hopefully
move things closer to integrating into a smaller set of load methods. To this
end, I renamed many of the overloaded load() methods to have more meaningful and
easier to search names. I added comments to the header file to provide clues as
to how many of the load methods are being used, and how they fit into the loading
process. I suspect that the renamed methods and comments indicating their present
usage will facilitate easier cleanup by myself and others as inspiration strikes.

Updated clients of FrameLoader where necessary to adapt to the new method names and signatures.

Combined the 3 canLoad() methods into a single canLoad which expresses the
intended logic of the 3 with a single method interface.

Removed unnecessary "treatAsLocal" attribute of CachedResource. It was only called from
one place in FrameLoader.cpp, and it derived at initialization time by calling back to FrameLoader.

Removed unused userGesture parameter to one variant of the urlSelected method, and
moved one of the urlSelected methods so that it lives nearer to its overloaded
sibling.

  • WebCore.base.exp:
  • loader/Cache.cpp: (WebCore::Cache::requestResource):
  • loader/CachedResource.cpp: (WebCore::CachedResource::CachedResource):
  • loader/CachedResource.h: (WebCore::CachedResource::errorOccurred):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::createWindow): (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadPlugin): (WebCore::FrameLoader::loadFrameRequestWithFormState): (WebCore::FrameLoader::loadFrameRequestWithFormAndValues): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::canLoad): (WebCore::FrameLoader::reloadAllowingStaleData): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::continueLoadAfterWillSubmitForm): (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): (WebCore::FrameLoader::loadItem):
  • loader/FrameLoader.h:
  • loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::create):
  • page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected):

2008-07-26 Daniel Jalkut <jalkut@red-sweater.com>

Reviewed by Geoff Garen.

Changes to accommodate newly named/signatured loading methods in WebCore.

  • Plugins/WebNetscapePluginStream.mm: (-[WebNetscapePluginStream initWithRequest:plugin:notifyData:sendNotification:]):
  • Plugins/WebPluginContainerCheck.mm: (-[WebPluginContainerCheck _isForbiddenFileLoad]):
  • WebView/WebPDFView.mm: (-[WebPDFView PDFViewWillClickOnLink:withURL:]):

2008-07-26 Matt Lilek <webkit@mattlilek.com>

Reviewed by Geoff Garen.

Changes to accommodate newly named/signatured loading methods in WebCore.

  • WebCoreSupport/WebContextMenuClient.cpp: (WebContextMenuClient::searchWithGoogle):
  • WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::loadURLIntoChild):
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r35376 r35377  
     12008-07-26  Daniel Jalkut  <jalkut@red-sweater.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Revised the FrameLoader class to clean up a variety of load methods, and hopefully
     6        move things closer to integrating into a smaller set of load methods. To this
     7        end, I renamed many of the overloaded load() methods to have more meaningful and
     8        easier to search names.  I added comments to the header file to provide clues as
     9        to how many of the load methods are being used, and how they fit into the loading
     10        process. I suspect that the renamed methods and comments indicating their present
     11        usage will facilitate easier cleanup by myself and others as inspiration strikes.
     12
     13        Updated clients of FrameLoader where necessary to adapt to the new method names and signatures.
     14
     15        Combined the 3 canLoad() methods into a single canLoad which expresses the
     16        intended logic of the 3 with a single method interface.
     17
     18        Removed unnecessary "treatAsLocal" attribute of CachedResource. It was only called from
     19        one place in FrameLoader.cpp, and it derived at initialization time by calling back to FrameLoader.
     20
     21        Removed unused userGesture parameter to one variant of the urlSelected method, and
     22        moved one of the urlSelected methods so that it lives nearer to its overloaded
     23        sibling.
     24
     25        * WebCore.base.exp:
     26        * loader/Cache.cpp:
     27        (WebCore::Cache::requestResource):
     28        * loader/CachedResource.cpp:
     29        (WebCore::CachedResource::CachedResource):
     30        * loader/CachedResource.h:
     31        (WebCore::CachedResource::errorOccurred):
     32        * loader/FrameLoader.cpp:
     33        (WebCore::FrameLoader::createWindow):
     34        (WebCore::FrameLoader::urlSelected):
     35        (WebCore::FrameLoader::loadURLIntoChildFrame):
     36        (WebCore::FrameLoader::loadPlugin):
     37        (WebCore::FrameLoader::loadFrameRequestWithFormState):
     38        (WebCore::FrameLoader::loadFrameRequestWithFormAndValues):
     39        (WebCore::FrameLoader::loadURL):
     40        (WebCore::FrameLoader::loadWithNavigationAction):
     41        (WebCore::FrameLoader::load):
     42        (WebCore::FrameLoader::loadWithDocumentLoader):
     43        (WebCore::FrameLoader::canLoad):
     44        (WebCore::FrameLoader::reloadAllowingStaleData):
     45        (WebCore::FrameLoader::reload):
     46        (WebCore::FrameLoader::continueLoadAfterWillSubmitForm):
     47        (WebCore::FrameLoader::submitForm):
     48        (WebCore::FrameLoader::loadPostRequest):
     49        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
     50        (WebCore::FrameLoader::loadItem):
     51        * loader/FrameLoader.h:
     52        * loader/SubresourceLoader.cpp:
     53        (WebCore::SubresourceLoader::create):
     54        * page/ContextMenuController.cpp:
     55        (WebCore::ContextMenuController::contextMenuItemSelected):
     56
    1572008-07-26  Sam Weinig  <sam@webkit.org>
    258
  • trunk/WebCore/WebCore.base.exp

    r35363 r35377  
    162162__ZN7WebCore11FrameLoader26saveDocumentAndScrollStateEv
    163163__ZN7WebCore11FrameLoader36saveScrollPositionAndViewStateToItemEPNS_11HistoryItemE
     164__ZN7WebCore11FrameLoader33loadFrameRequestWithFormAndValuesERKNS_16FrameLoadRequestEbPNS_5EventEPNS_15HTMLFormElementERKN3WTF7HashMapINS_6StringESA_NS_10StringHashENS8_10HashTraitsISA_EESD_EE
    164165__ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
    165 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
    166166__ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestE
    167167__ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_14SubstituteDataE
    168 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_16NavigationActionENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
    169168__ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_6StringE
    170 __ZN7WebCore11FrameLoader4loadERKNS_4KURLEPNS_5EventE
    171 __ZN7WebCore11FrameLoader4loadERKNS_4KURLERKNS_6StringENS_13FrameLoadTypeES6_PNS_5EventEN3WTF10PassRefPtrINS_9FormStateEEE
    172169__ZN7WebCore11FrameLoader5clearEbb
    173170__ZN7WebCore11FrameLoader6reloadEv
    174171__ZN7WebCore11FrameLoader7addDataEPKci
    175 __ZN7WebCore11FrameLoader7canLoadERKNS_4KURLEPKNS_8DocumentE
     172__ZN7WebCore11FrameLoader7canLoadERKNS_4KURLERKNS_6StringEPKNS_8DocumentE
    176173__ZN7WebCore11HistoryItem12addChildItemEN3WTF10PassRefPtrIS0_EE
    177174__ZN7WebCore11HistoryItem12setURLStringERKNS_6StringE
  • trunk/WebCore/loader/Cache.cpp

    r35128 r35377  
    102102        if (isPreload && !resource->isPreloaded())
    103103            return 0;
    104         if (FrameLoader::restrictAccessToLocal() && !FrameLoader::canLoad(*resource, docLoader->doc())) {
     104        if (FrameLoader::restrictAccessToLocal() && !FrameLoader::canLoad(url, String(), docLoader->doc())) {
    105105            Document* doc = docLoader->doc();
    106106            if(doc && !isPreload)
     
    109109        }
    110110    } else {
    111         if (FrameLoader::restrictAccessToLocal() && !FrameLoader::canLoad(url, docLoader->doc())) {
     111        if (FrameLoader::restrictAccessToLocal() && !FrameLoader::canLoad(url, String(), docLoader->doc())) {
    112112            Document* doc = docLoader->doc();
    113113            if(doc && !isPreload)
  • trunk/WebCore/loader/CachedResource.cpp

    r32812 r35377  
    6767#endif
    6868    m_errorOccurred = false;
    69     m_shouldTreatAsLocal = FrameLoader::shouldTreatURLAsLocal(m_url);
    7069}
    7170
  • trunk/WebCore/loader/CachedResource.h

    r31834 r35377  
    144144
    145145    bool errorOccurred() const { return m_errorOccurred; }
    146     bool treatAsLocal() const { return m_shouldTreatAsLocal; }
    147146    bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
    148147   
     
    203202    CachedResource* m_prevInLiveResourcesList;
    204203
    205     bool m_shouldTreatAsLocal;
    206 
    207204    DocLoader* m_docLoader; // only non-0 for resources that are not in the cache
    208205};
  • trunk/WebCore/loader/FrameLoader.cpp

    r35317 r35377  
    320320        if (frame && shouldAllowNavigation(frame)) {
    321321            if (!request.resourceRequest().url().isEmpty())
    322                 frame->loader()->load(request, false, true, 0, 0, HashMap<String, String>());
     322                frame->loader()->loadFrameRequestWithFormAndValues(request, false, 0, 0, HashMap<String, String>());
    323323            if (Page* page = frame->page())
    324324                page->chrome()->focus();
     
    382382}
    383383
     384
    384385void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool lockHistory, bool userGesture)
    385386{
     
    394395}
    395396
     397void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event, bool lockHistory)
     398{
     399    FrameLoadRequest copy = request;
     400    if (copy.resourceRequest().httpReferrer().isEmpty())
     401        copy.resourceRequest().setHTTPReferrer(m_outgoingReferrer);
     402
     403    loadFrameRequestWithFormAndValues(copy, lockHistory, event, 0, HashMap<String, String>());
     404}
     405   
    396406void FrameLoader::urlSelected(const ResourceRequest& request, const String& _target, Event* triggeringEvent, bool lockHistory, bool userGesture)
    397407{
     
    405415    FrameLoadRequest frameRequest(request, target);
    406416
    407     if (frameRequest.resourceRequest().httpReferrer().isEmpty())
    408         frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer);
    409 
    410     urlSelected(frameRequest, triggeringEvent, lockHistory, userGesture);
     417    urlSelected(frameRequest, triggeringEvent, lockHistory);
    411418}
    412419
     
    15591566        childFrame->loader()->loadArchive(subframeArchive.release());
    15601567    else
    1561         childFrame->loader()->load(workingURL, referer, childLoadType, String(), 0, 0);
     1568        childFrame->loader()->loadURL(workingURL, referer, String(), childLoadType, 0, 0);
    15621569}
    15631570
     
    17231730            pluginElement = static_cast<Element*>(renderer->node());
    17241731
    1725         if (!canLoad(url, frame()->document())) {
     1732        if (!canLoad(url, String(), frame()->document())) {
    17261733            FrameLoader::reportLocalLoadFailed(m_frame, url.string());
    17271734            return false;
     
    20422049}
    20432050
    2044 void FrameLoader::load(const KURL& url, Event* event)
    2045 {
    2046     load(ResourceRequest(url), false, true, event, 0, HashMap<String, String>());
    2047 }
    2048 
    2049 void FrameLoader::load(const FrameLoadRequest& request, bool lockHistory, bool userGesture, Event* event,
    2050     HTMLFormElement* submitForm, const HashMap<String, String>& formValues)
    2051 {
     2051void FrameLoader::loadFrameRequestWithFormState(const FrameLoadRequest& request, bool lockHistory, Event* event, PassRefPtr<FormState> prpFormState)
     2052{
     2053    RefPtr<FormState> formState = prpFormState;
    20522054    KURL url = request.resourceRequest().url();
    20532055 
     
    20612063    ASSERT(frame()->document());
    20622064    if (url.protocolIs("file")) {
    2063         if (!canLoad(url, frame()->document()) && !canLoad(url, referrer)) {
     2065        if (!canLoad(url, String(), frame()->document()) && !canLoad(url, referrer)) {
    20642066            FrameLoader::reportLocalLoadFailed(m_frame, url.string());
    20652067            return;
     
    20712073   
    20722074    Frame* targetFrame = findFrameForNavigation(request.frameName());
    2073        
     2075
    20742076    if (request.resourceRequest().httpMethod() != "POST") {
    20752077        FrameLoadType loadType;
     
    20812083            loadType = FrameLoadTypeStandard;   
    20822084   
    2083         RefPtr<FormState> formState;
    2084         if (submitForm && !formValues.isEmpty())
    2085             formState = FormState::create(submitForm, formValues, m_frame);
    2086        
    2087         load(request.resourceRequest().url(), referrer, loadType,
    2088             request.frameName(), event, formState.release());
     2085        loadURL(request.resourceRequest().url(), referrer, request.frameName(), loadType,
     2086            event, formState.release());
    20892087    } else
    2090         post(request.resourceRequest().url(), referrer, request.frameName(),
    2091             request.resourceRequest().httpBody(), request.resourceRequest().httpContentType(), event, submitForm, formValues);
     2088        loadPostRequest(request.resourceRequest(), referrer, request.frameName(), event, formState.release());
    20922089
    20932090    if (targetFrame && targetFrame != m_frame)
     
    20952092            page->chrome()->focus();
    20962093}
    2097 
    2098 void FrameLoader::load(const KURL& newURL, const String& referrer, FrameLoadType newLoadType,
    2099     const String& frameName, Event* event, PassRefPtr<FormState> formState)
    2100 {
     2094       
     2095void FrameLoader::loadFrameRequestWithFormAndValues(const FrameLoadRequest& request, bool lockHistory, Event* event,
     2096    HTMLFormElement* submitForm, const HashMap<String, String>& formValues)
     2097{
     2098    RefPtr<FormState> formState;
     2099    if (submitForm && !formValues.isEmpty())
     2100        formState = FormState::create(submitForm, formValues, m_frame);
     2101   
     2102    loadFrameRequestWithFormState(request, lockHistory, event, formState.release());       
     2103}
     2104
     2105void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const String& frameName, FrameLoadType newLoadType,
     2106    Event* event, PassRefPtr<FormState> prpFormState)
     2107{
     2108    RefPtr<FormState> formState = prpFormState;
    21012109    bool isFormSubmission = formState;
    21022110   
     
    21142122    if (!frameName.isEmpty()) {
    21152123        if (Frame* targetFrame = findFrameForNavigation(frameName))
    2116             targetFrame->loader()->load(newURL, referrer, newLoadType, String(), event, formState);
     2124            targetFrame->loader()->loadURL(newURL, referrer, String(), newLoadType, event, formState);
    21172125        else
    21182126            checkNewWindowPolicy(action, request, formState, frameName);
     
    21352143        // must grab this now, since this load may stop the previous load and clear this flag
    21362144        bool isRedirect = m_quickRedirectComing;
    2137         load(request, action, newLoadType, formState);
     2145        loadWithNavigationAction(request, action, newLoadType, formState);
    21382146        if (isRedirect) {
    21392147            m_quickRedirectComing = false;
     
    21792187}
    21802188
    2181 void FrameLoader::load(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState)
     2189void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState)
    21822190{
    21832191    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, SubstituteData());
     
    21872195        loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
    21882196
    2189     load(loader.get(), type, formState);
     2197    loadWithDocumentLoader(loader.get(), type, formState);
    21902198}
    21912199
     
    22062214   
    22072215    // When we loading alternate content for an unreachable URL that we're
    2208     // visiting in the b/f list, we treat it as a reload so the b/f list
     2216    // visiting in the history list, we treat it as a reload so the history list
    22092217    // is appropriately maintained.
     2218    //
     2219    // FIXME: This seems like a dangerous overloading of the meaning of "FrameLoadTypeReload" ...
     2220    // shouldn't a more explicit type of reload be defined, that means roughly
     2221    // "load without affecting history" ?
    22102222    if (shouldReloadToHandleUnreachableURL(newDocumentLoader)) {
    22112223        ASSERT(type == FrameLoadTypeStandard);
     
    22132225    }
    22142226
    2215     load(newDocumentLoader, type, 0);
    2216 }
    2217 
    2218 void FrameLoader::load(DocumentLoader* loader, FrameLoadType type, PassRefPtr<FormState> formState)
     2227    loadWithDocumentLoader(newDocumentLoader, type, nil);
     2228}
     2229
     2230void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, PassRefPtr<FormState> prpFormState)
    22192231{
    22202232    ASSERT(m_client->hasWebView());
     
    22262238
    22272239    m_policyLoadType = type;
    2228 
     2240    RefPtr<FormState> formState = prpFormState;
    22292241    bool isFormSubmission = formState;
     2242
    22302243    const KURL& newURL = loader->request().url();
    22312244
     
    22502263}
    22512264
    2252 // FIXME: It would be nice if we could collapse these into one or two functions.
    2253 bool FrameLoader::canLoad(const KURL& url, const String& referrer)
    2254 {
     2265bool FrameLoader::canLoad(const KURL& url, const String& referrer, const Document* doc)
     2266{
     2267    // We can always load any URL that isn't considered local (e.g. http URLs)
    22552268    if (!shouldTreatURLAsLocal(url.string()))
    22562269        return true;
    22572270
    2258     return shouldTreatURLAsLocal(referrer);
    2259 }
    2260 
    2261 bool FrameLoader::canLoad(const KURL& url, const Document* doc)
    2262 {
    2263     if (!shouldTreatURLAsLocal(url.string()))
    2264         return true;
    2265 
    2266     return doc && doc->securityOrigin()->canLoadLocalResources();
    2267 }
    2268 
    2269 bool FrameLoader::canLoad(const CachedResource& resource, const Document* doc)
    2270 {
    2271     if (!resource.treatAsLocal())
    2272         return true;
    2273 
    2274     return doc && doc->securityOrigin()->canLoadLocalResources();
     2271    // If we were provided a document, we let its local file policy dictate the result,
     2272    // otherwise we allow local loads only if the supplied referrer is also local.
     2273    if (doc)
     2274        return doc->securityOrigin()->canLoadLocalResources();
     2275    else if (!referrer.isEmpty())
     2276        return shouldTreatURLAsLocal(referrer);
     2277    else
     2278        return false;
    22752279}
    22762280
     
    23972401    loader->setOverrideEncoding(encoding);
    23982402
    2399     load(loader.get(), FrameLoadTypeReloadAllowingStaleData, 0);
     2403    loadWithDocumentLoader(loader.get(), FrameLoadTypeReloadAllowingStaleData, 0);
    24002404}
    24012405
     
    24172421        initialRequest = ResourceRequest(unreachableURL);
    24182422   
     2423    // Create a new document loader for the reload, this will become m_documentLoader eventually,
     2424    // but first it has to be the "policy" document loader, and then the "provisional" document loader.
    24192425    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(initialRequest, SubstituteData());
    24202426
     
    24302436    loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
    24312437   
    2432     load(loader.get(), FrameLoadTypeReload, 0);
     2438    loadWithDocumentLoader(loader.get(), FrameLoadTypeReload, 0);
    24332439}
    24342440
     
    31393145        return;
    31403146
     3147    // DocumentLoader calls back to our prepareForLoadStart
    31413148    m_provisionalDocumentLoader->prepareForLoadStart();
    31423149   
     
    32643271
    32653272    // FIXME: We should probably call userGestureHint() to tell whether this form submission was the result of a user gesture.
    3266     load(request, false, true, event, m_formAboutToBeSubmitted.get(), m_formValuesAboutToBeSubmitted);
     3273    loadFrameRequestWithFormAndValues(request, false, event, m_formAboutToBeSubmitted.get(), m_formValuesAboutToBeSubmitted);
    32673274
    32683275    clearRecordedFormValues();
    32693276}
    32703277
    3271 void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event, bool lockHistory, bool userGesture)
    3272 {
    3273     FrameLoadRequest copy = request;
    3274     if (copy.resourceRequest().httpReferrer().isEmpty())
    3275         copy.resourceRequest().setHTTPReferrer(m_outgoingReferrer);
    3276 
    3277     load(copy, lockHistory, userGesture, event, 0, HashMap<String, String>());
    3278 }
    3279    
    32803278String FrameLoader::userAgent(const KURL& url) const
    32813279{
     
    33653363}
    33663364
    3367 void FrameLoader::post(const KURL& url, const String& referrer, const String& frameName, PassRefPtr<FormData> formData,
    3368     const String& contentType, Event* event, HTMLFormElement* form, const HashMap<String, String>& formValues)
    3369 {
     3365void FrameLoader::loadPostRequest(const ResourceRequest& inRequest, const String& referrer, const String& frameName,
     3366    Event* event, PassRefPtr<FormState> prpFormState)
     3367{
     3368    RefPtr<FormState> formState = prpFormState;
     3369
    33703370    // When posting, use the NSURLRequestReloadIgnoringCacheData load flag.
    33713371    // This prevents a potential bug which may cause a page with a form that uses itself
     
    33743374    // FIXME: Where's the code that implements what the comment above says?
    33753375
    3376     ResourceRequest request(url);
    3377     addExtraFieldsToRequest(request, true, true);
     3376    // Previously when this method was reached, the original FrameLoadRequest had been deconstructed to build a
     3377    // bunch of parameters that would come in here and then be built back up to a ResourceRequest.  In case
     3378    // any caller depends on the immutability of the original ResourceRequest, I'm rebuilding a ResourceRequest
     3379    // from scratch as it did all along.
     3380    const KURL& url = inRequest.url();
     3381    RefPtr<FormData> formData = inRequest.httpBody();
     3382    const String& contentType = inRequest.httpContentType();
     3383
     3384    ResourceRequest workingResourceRequest(url);   
     3385    addExtraFieldsToRequest(workingResourceRequest, true, true);
    33783386
    33793387    if (!referrer.isEmpty())
    3380         request.setHTTPReferrer(referrer);
    3381     request.setHTTPMethod("POST");
    3382     request.setHTTPBody(formData);
    3383     request.setHTTPContentType(contentType);
     3388        workingResourceRequest.setHTTPReferrer(referrer);
     3389    workingResourceRequest.setHTTPMethod("POST");
     3390    workingResourceRequest.setHTTPBody(formData);
     3391    workingResourceRequest.setHTTPContentType(contentType);
    33843392
    33853393    NavigationAction action(url, FrameLoadTypeStandard, true, event);
    3386 
    3387     RefPtr<FormState> formState;
    3388     if (form && !formValues.isEmpty())
    3389         formState = FormState::create(form, formValues, m_frame);
    33903394
    33913395    if (!frameName.isEmpty()) {
    33923396        if (Frame* targetFrame = findFrameForNavigation(frameName))
    3393             targetFrame->loader()->load(request, action, FrameLoadTypeStandard, formState.release());
     3397            targetFrame->loader()->loadWithNavigationAction(workingResourceRequest, action, FrameLoadTypeStandard, formState.release());
    33943398        else
    3395             checkNewWindowPolicy(action, request, formState.release(), frameName);
     3399            checkNewWindowPolicy(action, workingResourceRequest, formState.release(), frameName);
    33963400    } else
    3397         load(request, action, FrameLoadTypeStandard, formState.release());
     3401        loadWithNavigationAction(workingResourceRequest, action, FrameLoadTypeStandard, formState.release());   
    33983402}
    33993403
     
    38163820    mainFrame->loader()->m_client->dispatchShow();
    38173821    mainFrame->loader()->setOpener(frame.get());
    3818     mainFrame->loader()->load(request, NavigationAction(), FrameLoadTypeStandard, formState);
     3822    mainFrame->loader()->loadWithNavigationAction(request, NavigationAction(), FrameLoadTypeStandard, formState);
    38193823}
    38203824
     
    42254229            // Or we should remove WebKitBackForwardCacheExpirationIntervalKey.
    42264230            if (interval <= 1800) {
    4227                 load(cachedPage->documentLoader(), loadType, 0);   
     4231                loadWithDocumentLoader(cachedPage->documentLoader(), loadType, 0);   
    42284232                inPageCache = true;
    42294233            } else {
     
    42884292            }
    42894293
    4290             load(request, action, loadType, 0);
     4294            loadWithNavigationAction(request, action, loadType, 0);
    42914295        }
    42924296    }
  • trunk/WebCore/loader/FrameLoader.h

    r35151 r35377  
    139139        Frame* frame() const { return m_frame; }
    140140
    141         // FIXME: This is not cool, people.
     141        // FIXME: This is not cool, people. We should aim to consolidate these variety of loading related methods into a smaller set,
     142        // and try to reuse more of the same logic by extracting common code paths.
    142143        void prepareForLoadStart();
    143144        void setupForReplace();
    144145        void setupForReplaceByMIMEType(const String& newMIMEType);
    145         void load(const KURL&, Event*);
    146         void load(const FrameLoadRequest&, bool lockHistory, bool userGesture,
     146
     147        void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>);         // Calls continueLoadAfterNavigationPolicy
     148        void load(DocumentLoader*);                                                                 // Calls loadWithDocumentLoader   
     149
     150        void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&,              // Calls loadWithDocumentLoader()
     151            FrameLoadType, PassRefPtr<FormState>);
     152
     153        void loadPostRequest(const ResourceRequest& inRequest, const String& referrer,              // Called by loadFrameRequestWithFormAndValues(), calls loadWithNavigationAction
     154            const String& frameName, Event* event, PassRefPtr<FormState> prpFormState);
     155
     156        void loadURL(const KURL& newURL, const String& referrer, const String& frameName,           // Called by loadFrameRequestWithFormAndValues(), calls loadWithNavigationAction or else dispatches to navigation policy delegate   
     157            FrameLoadType, Event* event, PassRefPtr<FormState> prpFormState);                                                         
     158        void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*);
     159
     160        void loadFrameRequestWithFormState(const FrameLoadRequest&, bool lockHistory, Event*, PassRefPtr<FormState>);
     161        void loadFrameRequestWithFormAndValues(const FrameLoadRequest&, bool lockHistory,           // Called by submitForm, calls loadPostRequest()
    147162            Event*, HTMLFormElement*, const HashMap<String, String>& formValues);
    148         void load(const KURL&, const String& referrer, FrameLoadType, const String& target,
    149             Event*, PassRefPtr<FormState>);
    150         void post(const KURL&, const String& referrer, const String& target,
    151             PassRefPtr<FormData>, const String& contentType,
    152             Event*, HTMLFormElement*, const HashMap<String, String>& formValues);
    153 
    154         void load(const ResourceRequest&);
    155         void load(const ResourceRequest&, const SubstituteData&);
    156         void load(const ResourceRequest&, const String& frameName);
    157         void load(const ResourceRequest&, const NavigationAction&, FrameLoadType, PassRefPtr<FormState>);
    158        
    159         void load(DocumentLoader*);
    160         void load(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>);
    161        
    162         void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*);
     163
     164        void load(const ResourceRequest&);                                                          // Called by WebFrame, calls (ResourceRequest, SubstituteData)
     165        void load(const ResourceRequest&, const SubstituteData&);                                   // Called both by WebFrame and internally, calls (DocumentLoader*)
     166        void load(const ResourceRequest&, const String& frameName);                                 // Called by WebPluginController
     167       
    163168        void loadArchive(PassRefPtr<Archive> archive);
    164169
    165         static bool canLoad(const KURL&, const String& referrer);
    166         static bool canLoad(const KURL&, const Document*);
    167         static bool canLoad(const CachedResource&, const Document*);
     170        // Returns true for any non-local URL. If Document parameter is supplied, its local load policy dictates,
     171        // otherwise if referrer is non-empty and represents a local file, then the local load is allowed.
     172        static bool canLoad(const KURL&, const String& referrer, const Document* theDocument = nil);
    168173        static void reportLocalLoadFailed(Frame*, const String& url);
    169174
    170175        static bool shouldHideReferrer(const KURL& url, const String& referrer);
    171176
     177        // Called by createWindow in JSDOMWindowBase.cpp, e.g. to fulfill a modal dialog creation
    172178        Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest&, const WindowFeatures&, bool& created);
    173179
     
    280286        void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool userGesture = false);
    281287        void urlSelected(const ResourceRequest&, const String& target, Event*, bool lockHistory, bool userGesture);
    282         void urlSelected(const FrameLoadRequest&, Event*, bool lockHistory, bool userGesture);
     288        void urlSelected(const FrameLoadRequest&, Event*, bool lockHistory);
    283289     
    284290        bool requestFrame(HTMLFrameOwnerElement*, const String& url, const AtomicString& frameName);
     
    569575        FrameLoadType m_loadType;
    570576
     577        // Document loaders for the three phases of frame loading. Note that while
     578        // a new request is being loaded, the old document loader may still be referenced.
     579        // E.g. while a new request is in the "policy" state, the old document loader may
     580        // be consulted in particular as it makes sense to imply certain settings on the new loader.
    571581        RefPtr<DocumentLoader> m_documentLoader;
    572582        RefPtr<DocumentLoader> m_provisionalDocumentLoader;
    573583        RefPtr<DocumentLoader> m_policyDocumentLoader;
    574584
     585        // This identifies the type of navigation action which prompted this load. Note
     586        // that WebKit conveys this value as the WebActionNavigationTypeKey value
     587        // on navigation action delegate callbacks.
    575588        FrameLoadType m_policyLoadType;
    576589        PolicyCheck m_policyCheck;
  • trunk/WebCore/loader/SubresourceLoader.cpp

    r35148 r35377  
    8585    if (!skipCanLoadCheck
    8686            && FrameLoader::restrictAccessToLocal()
    87             && !FrameLoader::canLoad(request.url(), frame->document())) {
     87            && !FrameLoader::canLoad(request.url(), String(), frame->document())) {
    8888        FrameLoader::reportLocalLoadFailed(frame, request.url().string());
    8989        return 0;
  • trunk/WebCore/page/ContextMenuController.cpp

    r34935 r35377  
    217217        case ContextMenuItemTagOpenLink:
    218218            if (Frame* targetFrame = result.targetFrame())
    219                 targetFrame->loader()->load(FrameLoadRequest(ResourceRequest(result.absoluteLinkURL(),
    220                     frame->loader()->outgoingReferrer())), false, true, 0, 0, HashMap<String, String>());
     219                targetFrame->loader()->loadFrameRequestWithFormAndValues(FrameLoadRequest(ResourceRequest(result.absoluteLinkURL(),
     220                    frame->loader()->outgoingReferrer())), false, 0, 0, HashMap<String, String>());
    221221            else
    222222                openNewWindow(result.absoluteLinkURL(), frame);
  • trunk/WebKit/mac/ChangeLog

    r35278 r35377  
     12008-07-26  Daniel Jalkut  <jalkut@red-sweater.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Changes to accommodate newly named/signatured loading methods in WebCore.
     6
     7        * Plugins/WebNetscapePluginStream.mm:
     8        (-[WebNetscapePluginStream initWithRequest:plugin:notifyData:sendNotification:]):
     9        * Plugins/WebPluginContainerCheck.mm:
     10        (-[WebPluginContainerCheck _isForbiddenFileLoad]):
     11        * WebView/WebPDFView.mm:
     12        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
     13
    1142008-07-21  Mark Rowe  <mrowe@apple.com>
    215
  • trunk/WebKit/mac/Plugins/WebNetscapePluginStream.mm

    r31014 r35377  
    7373    WebBaseNetscapePluginView *view = (WebBaseNetscapePluginView *)thePlugin->ndata;
    7474
    75     if (!core([view webFrame])->loader()->canLoad([theRequest URL], core([view webFrame])->document()))
     75    if (!core([view webFrame])->loader()->canLoad([theRequest URL], String(), core([view webFrame])->document()))
    7676        return nil;
    7777
  • trunk/WebKit/mac/Plugins/WebPluginContainerCheck.mm

    r34956 r35377  
    9595   Frame* coreFrame = core([_controller webFrame]);
    9696   ASSERT(coreFrame);
    97    if (!coreFrame->loader()->canLoad([_request URL], coreFrame->document())) {
     97   if (!coreFrame->loader()->canLoad([_request URL], String(), coreFrame->document())) {
    9898       [self _continueWithPolicy:PolicyIgnore];
    9999       return YES;
  • trunk/WebKit/mac/WebView/WebPDFView.mm

    r34956 r35377  
    5050#import <WebCore/Frame.h>
    5151#import <WebCore/FrameLoader.h>
     52#import <WebCore/FrameLoadRequest.h>
    5253#import <WebCore/KURL.h>
    5354#import <WebCore/KeyboardEvent.h>
     
    951952
    952953    // Call to the frame loader because this is where our security checks are made.
    953     core([dataSource webFrame])->loader()->load(URL, event.get());
     954    core([dataSource webFrame])->loader()->loadFrameRequestWithFormAndValues(ResourceRequest(URL), false, event.get(), 0, HashMap<String, String>());
    954955}
    955956
  • trunk/WebKit/win/ChangeLog

    r35349 r35377  
     12008-07-26  Matt Lilek  <webkit@mattlilek.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Changes to accommodate newly named/signatured loading methods in WebCore.
     6
     7        * WebCoreSupport/WebContextMenuClient.cpp:
     8        (WebContextMenuClient::searchWithGoogle):
     9        * WebCoreSupport/WebFrameLoaderClient.cpp:
     10        (WebFrameLoaderClient::loadURLIntoChild):
     11
    1122008-07-25  Adam Roben  <aroben@apple.com>
    213
  • trunk/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp

    r32704 r35377  
    161161    ResourceRequest request = ResourceRequest(url);
    162162    if (Page* page = frame->page())
    163         page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false, true);
     163        page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false);
    164164}
    165165
  • trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r34544 r35377  
    612612
    613613    // FIXME: Handle loading WebArchives here
    614 
    615     core(childFrame)->loader()->load(url, referrer, childLoadType, String(), 0, 0);
     614    String frameName = core(childFrame)->tree()->name();
     615    core(childFrame)->loader()->loadURL(url, referrer, frameName, childLoadType, 0, 0);
    616616}
    617617
Note: See TracChangeset for help on using the changeset viewer.