Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: third_party/WebKit/WebCore/loader/FrameLoader.cpp

Issue 1116002: Test CL for WebKit try bot. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 , m_shouldCallCheckCompleted(false) 196 , m_shouldCallCheckCompleted(false)
197 , m_shouldCallCheckLoadComplete(false) 197 , m_shouldCallCheckLoadComplete(false)
198 , m_opener(0) 198 , m_opener(0)
199 , m_creatingInitialEmptyDocument(false) 199 , m_creatingInitialEmptyDocument(false)
200 , m_isDisplayingInitialEmptyDocument(false) 200 , m_isDisplayingInitialEmptyDocument(false)
201 , m_committedFirstRealDocumentLoad(false) 201 , m_committedFirstRealDocumentLoad(false)
202 , m_didPerformFirstNavigation(false) 202 , m_didPerformFirstNavigation(false)
203 , m_loadingFromCachedPage(false) 203 , m_loadingFromCachedPage(false)
204 , m_suppressOpenerInNewFrame(false) 204 , m_suppressOpenerInNewFrame(false)
205 , m_sandboxFlags(SandboxAll) 205 , m_sandboxFlags(SandboxAll)
206 , m_userGestureSet(false)
207 , m_userGesture(false)
206 #ifndef NDEBUG 208 #ifndef NDEBUG
207 , m_didDispatchDidCommitLoad(false) 209 , m_didDispatchDidCommitLoad(false)
208 #endif 210 #endif
209 { 211 {
210 } 212 }
211 213
212 FrameLoader::~FrameLoader() 214 FrameLoader::~FrameLoader()
213 { 215 {
214 setOpener(0); 216 setOpener(0);
215 217
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 return; 465 return;
464 466
465 if (protocolIsJavaScript(u)) { 467 if (protocolIsJavaScript(u)) {
466 m_isExecutingJavaScriptFormAction = true; 468 m_isExecutingJavaScriptFormAction = true;
467 m_frame->script()->executeIfJavaScriptURL(u, false, false); 469 m_frame->script()->executeIfJavaScriptURL(u, false, false);
468 m_isExecutingJavaScriptFormAction = false; 470 m_isExecutingJavaScriptFormAction = false;
469 return; 471 return;
470 } 472 }
471 473
472 FrameLoadRequest frameRequest; 474 FrameLoadRequest frameRequest;
475 frameRequest.setIsFromUserGesture(isProcessingUserGesture());
473 476
474 String targetOrBaseTarget = target.isEmpty() ? m_frame->document()->baseTarg et() : target; 477 String targetOrBaseTarget = target.isEmpty() ? m_frame->document()->baseTarg et() : target;
475 Frame* targetFrame = m_frame->tree()->find(targetOrBaseTarget); 478 Frame* targetFrame = m_frame->tree()->find(targetOrBaseTarget);
476 if (!shouldAllowNavigation(targetFrame)) 479 if (!shouldAllowNavigation(targetFrame))
477 return; 480 return;
478 if (!targetFrame) { 481 if (!targetFrame) {
482 if (!DOMWindow::allowPopUp(m_frame) && !isProcessingUserGesture())
483 return;
484
479 targetFrame = m_frame; 485 targetFrame = m_frame;
480 frameRequest.setFrameName(targetOrBaseTarget); 486 frameRequest.setFrameName(targetOrBaseTarget);
481 } 487 }
482 if (!targetFrame->page()) 488 if (!targetFrame->page())
483 return; 489 return;
484 490
485 // FIXME: We'd like to remove this altogether and fix the multiple form subm ission issue another way. 491 // FIXME: We'd like to remove this altogether and fix the multiple form subm ission issue another way.
486 492
487 // We do not want to submit more than one form from the same page, nor do we want to submit a single 493 // We do not want to submit more than one form from the same page, nor do we want to submit a single
488 // form more than once. This flag prevents these from happening; not sure ho w other browsers prevent this. 494 // form more than once. This flag prevents these from happening; not sure ho w other browsers prevent this.
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 m_firstLayoutDone = false; 1520 m_firstLayoutDone = false;
1515 m_frame->redirectScheduler()->cancel(true); 1521 m_frame->redirectScheduler()->cancel(true);
1516 m_client->provisionalLoadStarted(); 1522 m_client->provisionalLoadStarted();
1517 } 1523 }
1518 1524
1519 bool FrameLoader::isProcessingUserGesture() 1525 bool FrameLoader::isProcessingUserGesture()
1520 { 1526 {
1521 Frame* frame = m_frame->tree()->top(); 1527 Frame* frame = m_frame->tree()->top();
1522 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 1528 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
1523 return true; // If JavaScript is disabled, a user gesture must have init iated the navigation. 1529 return true; // If JavaScript is disabled, a user gesture must have init iated the navigation.
1530 // Check to see if we're using an override because the frame load was
1531 // initiated by a non-current script context.
1532 if (m_userGestureSet)
1533 return m_userGesture;
1524 return frame->script()->processingUserGesture(mainThreadNormalWorld()); // F IXME: Use pageIsProcessingUserGesture. 1534 return frame->script()->processingUserGesture(mainThreadNormalWorld()); // F IXME: Use pageIsProcessingUserGesture.
1525 } 1535 }
1526 1536
1527 void FrameLoader::resetMultipleFormSubmissionProtection() 1537 void FrameLoader::resetMultipleFormSubmissionProtection()
1528 { 1538 {
1529 m_submittedFormURL = KURL(); 1539 m_submittedFormURL = KURL();
1530 } 1540 }
1531 1541
1532 void FrameLoader::setEncoding(const String& name, bool userChosen) 1542 void FrameLoader::setEncoding(const String& name, bool userChosen)
1533 { 1543 {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 referrer = String(); 1952 referrer = String();
1943 1953
1944 FrameLoadType loadType; 1954 FrameLoadType loadType;
1945 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) 1955 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
1946 loadType = FrameLoadTypeReload; 1956 loadType = FrameLoadTypeReload;
1947 else if (lockBackForwardList) 1957 else if (lockBackForwardList)
1948 loadType = FrameLoadTypeRedirectWithLockedBackForwardList; 1958 loadType = FrameLoadTypeRedirectWithLockedBackForwardList;
1949 else 1959 else
1950 loadType = FrameLoadTypeStandard; 1960 loadType = FrameLoadTypeStandard;
1951 1961
1962 // For things like form POSTs, the resulting frame load here is occurring
1963 // asynchronously. If necessary, consider the user gesture status from the
1964 // original context.
1965 if (request.isFromUserGestureSet()) {
1966 m_userGestureSet = true;
1967 m_userGesture = request.isFromUserGesture();
1968 }
1952 if (request.resourceRequest().httpMethod() == "POST") 1969 if (request.resourceRequest().httpMethod() == "POST")
1953 loadPostRequest(request.resourceRequest(), referrer, request.frameName() , lockHistory, loadType, event, formState.get()); 1970 loadPostRequest(request.resourceRequest(), referrer, request.frameName() , lockHistory, loadType, event, formState.get());
1954 else 1971 else
1955 loadURL(request.resourceRequest().url(), referrer, request.frameName(), lockHistory, loadType, event, formState.get()); 1972 loadURL(request.resourceRequest().url(), referrer, request.frameName(), lockHistory, loadType, event, formState.get());
1973 m_userGestureSet = false;
1974 m_userGesture = false;
1956 1975
1957 // FIXME: It's possible this targetFrame will not be the same frame that was targeted by the actual 1976 // FIXME: It's possible this targetFrame will not be the same frame that was targeted by the actual
1958 // load if frame names have changed. 1977 // load if frame names have changed.
1959 Frame* sourceFrame = formState ? formState->sourceFrame() : m_frame; 1978 Frame* sourceFrame = formState ? formState->sourceFrame() : m_frame;
1960 Frame* targetFrame = sourceFrame->loader()->findFrameForNavigation(request.f rameName()); 1979 Frame* targetFrame = sourceFrame->loader()->findFrameForNavigation(request.f rameName());
1961 if (targetFrame && targetFrame != sourceFrame) { 1980 if (targetFrame && targetFrame != sourceFrame) {
1962 if (Page* page = targetFrame->page()) 1981 if (Page* page = targetFrame->page())
1963 page->chrome()->focus(); 1982 page->chrome()->focus();
1964 } 1983 }
1965 } 1984 }
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
4120 m_client->dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, resource->response(), resource->encodedSize()); 4139 m_client->dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, resource->response(), resource->encodedSize());
4121 } 4140 }
4122 } 4141 }
4123 4142
4124 bool FrameLoaderClient::hasHTMLView() const 4143 bool FrameLoaderClient::hasHTMLView() const
4125 { 4144 {
4126 return true; 4145 return true;
4127 } 4146 }
4128 4147
4129 } // namespace WebCore 4148 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/loader/FrameLoader.h ('k') | third_party/WebKit/WebCore/page/FrameLoadRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698