| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 | 1259 |
| 1260 if (i == target_frames.size()) | 1260 if (i == target_frames.size()) |
| 1261 should_close = true; | 1261 should_close = true; |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 return should_close; | 1264 return should_close; |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 NavigationPolicy FrameLoader::ShouldContinueForNavigationPolicy( | 1267 NavigationPolicy FrameLoader::ShouldContinueForNavigationPolicy( |
| 1268 const ResourceRequest& request, | 1268 const ResourceRequest& request, |
| 1269 Document* origin_document, |
| 1269 const SubstituteData& substitute_data, | 1270 const SubstituteData& substitute_data, |
| 1270 DocumentLoader* loader, | 1271 DocumentLoader* loader, |
| 1271 ContentSecurityPolicyDisposition | 1272 ContentSecurityPolicyDisposition |
| 1272 should_check_main_world_content_security_policy, | 1273 should_check_main_world_content_security_policy, |
| 1273 NavigationType type, | 1274 NavigationType type, |
| 1274 NavigationPolicy policy, | 1275 NavigationPolicy policy, |
| 1275 FrameLoadType frame_load_type, | 1276 FrameLoadType frame_load_type, |
| 1276 bool is_client_redirect, | 1277 bool is_client_redirect, |
| 1277 HTMLFormElement* form) { | 1278 HTMLFormElement* form) { |
| 1278 // Don't ask if we are loading an empty URL. | 1279 // Don't ask if we are loading an empty URL. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1294 kCheckContentSecurityPolicy, | 1295 kCheckContentSecurityPolicy, |
| 1295 settings && settings->GetBrowserSideNavigationEnabled(), | 1296 settings && settings->GetBrowserSideNavigationEnabled(), |
| 1296 ContentSecurityPolicy::CheckHeaderType::kCheckEnforce) == | 1297 ContentSecurityPolicy::CheckHeaderType::kCheckEnforce) == |
| 1297 kNavigationPolicyIgnore) { | 1298 kNavigationPolicyIgnore) { |
| 1298 return kNavigationPolicyIgnore; | 1299 return kNavigationPolicyIgnore; |
| 1299 } | 1300 } |
| 1300 | 1301 |
| 1301 bool replaces_current_history_item = | 1302 bool replaces_current_history_item = |
| 1302 frame_load_type == kFrameLoadTypeReplaceCurrentItem; | 1303 frame_load_type == kFrameLoadTypeReplaceCurrentItem; |
| 1303 policy = Client()->DecidePolicyForNavigation( | 1304 policy = Client()->DecidePolicyForNavigation( |
| 1304 request, loader, type, policy, replaces_current_history_item, | 1305 request, origin_document, loader, type, policy, |
| 1305 is_client_redirect, form, | 1306 replaces_current_history_item, is_client_redirect, form, |
| 1306 should_check_main_world_content_security_policy); | 1307 should_check_main_world_content_security_policy); |
| 1307 if (policy == kNavigationPolicyCurrentTab || | 1308 if (policy == kNavigationPolicyCurrentTab || |
| 1308 policy == kNavigationPolicyIgnore || | 1309 policy == kNavigationPolicyIgnore || |
| 1309 policy == kNavigationPolicyHandledByClient || | 1310 policy == kNavigationPolicyHandledByClient || |
| 1310 policy == kNavigationPolicyHandledByClientForInitialHistory) { | 1311 policy == kNavigationPolicyHandledByClientForInitialHistory) { |
| 1311 return policy; | 1312 return policy; |
| 1312 } | 1313 } |
| 1313 | 1314 |
| 1314 Client()->LoadURLExternally(request, policy, String(), | 1315 Client()->LoadURLExternally(request, policy, String(), |
| 1315 replaces_current_history_item); | 1316 replaces_current_history_item); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1328 bool is_client_redirect, | 1329 bool is_client_redirect, |
| 1329 HTMLFormElement* form) { | 1330 HTMLFormElement* form) { |
| 1330 Settings* settings = frame_->GetSettings(); | 1331 Settings* settings = frame_->GetSettings(); |
| 1331 // Check report-only CSP policies, which are not checked by | 1332 // Check report-only CSP policies, which are not checked by |
| 1332 // ShouldContinueForNavigationPolicy. | 1333 // ShouldContinueForNavigationPolicy. |
| 1333 MaybeCheckCSP(request, type, frame_, policy, | 1334 MaybeCheckCSP(request, type, frame_, policy, |
| 1334 should_check_main_world_content_security_policy == | 1335 should_check_main_world_content_security_policy == |
| 1335 kCheckContentSecurityPolicy, | 1336 kCheckContentSecurityPolicy, |
| 1336 settings && settings->GetBrowserSideNavigationEnabled(), | 1337 settings && settings->GetBrowserSideNavigationEnabled(), |
| 1337 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); | 1338 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); |
| 1339 |
| 1338 return ShouldContinueForNavigationPolicy( | 1340 return ShouldContinueForNavigationPolicy( |
| 1339 request, substitute_data, loader, | 1341 request, |
| 1340 should_check_main_world_content_security_policy, type, policy, | 1342 // |origin_document| is not set. It doesn't really matter here. It is |
| 1341 frame_load_type, is_client_redirect, form); | 1343 // useful for PlzNavigate (aka browser-side-navigation). It is used |
| 1344 // during the first navigation and not during redirects. |
| 1345 nullptr, // origin_document |
| 1346 substitute_data, loader, should_check_main_world_content_security_policy, |
| 1347 type, policy, frame_load_type, is_client_redirect, form); |
| 1342 } | 1348 } |
| 1343 | 1349 |
| 1344 NavigationPolicy FrameLoader::CheckLoadCanStart( | 1350 NavigationPolicy FrameLoader::CheckLoadCanStart( |
| 1345 FrameLoadRequest& frame_load_request, | 1351 FrameLoadRequest& frame_load_request, |
| 1346 FrameLoadType type, | 1352 FrameLoadType type, |
| 1347 NavigationPolicy navigation_policy, | 1353 NavigationPolicy navigation_policy, |
| 1348 NavigationType navigation_type) { | 1354 NavigationType navigation_type) { |
| 1349 if (frame_->GetDocument()->PageDismissalEventBeingDispatched() != | 1355 if (frame_->GetDocument()->PageDismissalEventBeingDispatched() != |
| 1350 Document::kNoDismissal) { | 1356 Document::kNoDismissal) { |
| 1351 return kNavigationPolicyIgnore; | 1357 return kNavigationPolicyIgnore; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1365 Settings* settings = frame_->GetSettings(); | 1371 Settings* settings = frame_->GetSettings(); |
| 1366 MaybeCheckCSP( | 1372 MaybeCheckCSP( |
| 1367 resource_request, navigation_type, frame_, navigation_policy, | 1373 resource_request, navigation_type, frame_, navigation_policy, |
| 1368 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy() == | 1374 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy() == |
| 1369 kCheckContentSecurityPolicy, | 1375 kCheckContentSecurityPolicy, |
| 1370 settings && settings->GetBrowserSideNavigationEnabled(), | 1376 settings && settings->GetBrowserSideNavigationEnabled(), |
| 1371 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); | 1377 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); |
| 1372 ModifyRequestForCSP(resource_request, nullptr); | 1378 ModifyRequestForCSP(resource_request, nullptr); |
| 1373 | 1379 |
| 1374 return ShouldContinueForNavigationPolicy( | 1380 return ShouldContinueForNavigationPolicy( |
| 1375 resource_request, frame_load_request.GetSubstituteData(), nullptr, | 1381 resource_request, frame_load_request.OriginDocument(), |
| 1382 frame_load_request.GetSubstituteData(), nullptr, |
| 1376 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy(), | 1383 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy(), |
| 1377 navigation_type, navigation_policy, type, | 1384 navigation_type, navigation_policy, type, |
| 1378 frame_load_request.ClientRedirect() == | 1385 frame_load_request.ClientRedirect() == |
| 1379 ClientRedirectPolicy::kClientRedirect, | 1386 ClientRedirectPolicy::kClientRedirect, |
| 1380 frame_load_request.Form()); | 1387 frame_load_request.Form()); |
| 1381 } | 1388 } |
| 1382 | 1389 |
| 1383 void FrameLoader::StartLoad(FrameLoadRequest& frame_load_request, | 1390 void FrameLoader::StartLoad(FrameLoadRequest& frame_load_request, |
| 1384 FrameLoadType type, | 1391 FrameLoadType type, |
| 1385 NavigationPolicy navigation_policy, | 1392 NavigationPolicy navigation_policy, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 // TODO(japhet): This is needed because the browser process DCHECKs if the | 1695 // TODO(japhet): This is needed because the browser process DCHECKs if the |
| 1689 // first entry we commit in a new frame has replacement set. It's unclear | 1696 // first entry we commit in a new frame has replacement set. It's unclear |
| 1690 // whether the DCHECK is right, investigate removing this special case. | 1697 // whether the DCHECK is right, investigate removing this special case. |
| 1691 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1698 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
| 1692 (!Opener() || !request.Url().IsEmpty()); | 1699 (!Opener() || !request.Url().IsEmpty()); |
| 1693 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1700 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
| 1694 return loader; | 1701 return loader; |
| 1695 } | 1702 } |
| 1696 | 1703 |
| 1697 } // namespace blink | 1704 } // namespace blink |
| OLD | NEW |