OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
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 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 for (i = 0; i < targetFrames.size(); i++) { | 1326 for (i = 0; i < targetFrames.size(); i++) { |
1327 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) | 1327 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) |
1328 continue; | 1328 continue; |
1329 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
romeClient(), isReload, didAllowNavigation)) | 1329 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
romeClient(), isReload, didAllowNavigation)) |
1330 break; | 1330 break; |
1331 } | 1331 } |
1332 | 1332 |
1333 if (i == targetFrames.size()) | 1333 if (i == targetFrames.size()) |
1334 shouldClose = true; | 1334 shouldClose = true; |
1335 } | 1335 } |
| 1336 |
1336 return shouldClose; | 1337 return shouldClose; |
1337 } | 1338 } |
1338 | 1339 |
1339 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
st, const SubstituteData& substituteData, | 1340 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
st, const SubstituteData& substituteData, |
1340 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl
dContentSecurityPolicy, | 1341 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl
dContentSecurityPolicy, |
1341 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte
m, bool isClientRedirect) | 1342 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte
m, bool isClientRedirect) |
1342 { | 1343 { |
1343 // Don't ask if we are loading an empty URL. | 1344 // Don't ask if we are loading an empty URL. |
1344 if (request.url().isEmpty() || substituteData.isValid()) | 1345 if (request.url().isEmpty() || substituteData.isValid()) |
1345 return true; | 1346 return true; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 ASSERT(client()->hasWebView()); | 1382 ASSERT(client()->hasWebView()); |
1382 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1383 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
1383 return; | 1384 return; |
1384 | 1385 |
1385 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); | 1386 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); |
1386 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); | 1387 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); |
1387 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); | 1388 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); |
1388 ResourceRequest& request = frameLoadRequest.resourceRequest(); | 1389 ResourceRequest& request = frameLoadRequest.resourceRequest(); |
1389 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD
ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na
vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo
adRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect)) | 1390 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD
ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na
vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo
adRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect)) |
1390 return; | 1391 return; |
1391 if (!shouldClose(navigationType == NavigationTypeReload)) | |
1392 return; | |
1393 | 1392 |
1394 m_frame->document()->cancelParsing(); | 1393 m_frame->document()->cancelParsing(); |
1395 detachDocumentLoader(m_provisionalDocumentLoader); | 1394 detachDocumentLoader(m_provisionalDocumentLoader); |
1396 | 1395 |
1397 // beforeunload fired above, and detaching a DocumentLoader can fire | 1396 // beforeunload fired above, and detaching a DocumentLoader can fire |
1398 // events, which can detach this frame. | 1397 // events, which can detach this frame. |
1399 if (!m_frame->host()) | 1398 if (!m_frame->host()) |
1400 return; | 1399 return; |
1401 | 1400 |
1402 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, reques
t, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData
() : defaultSubstituteDataForURL(request.url())); | 1401 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, reques
t, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData
() : defaultSubstituteDataForURL(request.url())); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 // FIXME: We need a way to propagate insecure requests policy flags to | 1530 // FIXME: We need a way to propagate insecure requests policy flags to |
1532 // out-of-process frames. For now, we'll always use default behavior. | 1531 // out-of-process frames. For now, we'll always use default behavior. |
1533 if (!parentFrame->isLocalFrame()) | 1532 if (!parentFrame->isLocalFrame()) |
1534 return nullptr; | 1533 return nullptr; |
1535 | 1534 |
1536 ASSERT(toLocalFrame(parentFrame)->document()); | 1535 ASSERT(toLocalFrame(parentFrame)->document()); |
1537 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1536 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1538 } | 1537 } |
1539 | 1538 |
1540 } // namespace blink | 1539 } // namespace blink |
OLD | NEW |