| 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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1249 |
| 1250 if (i == target_frames.size()) | 1250 if (i == target_frames.size()) |
| 1251 should_close = true; | 1251 should_close = true; |
| 1252 } | 1252 } |
| 1253 | 1253 |
| 1254 return should_close; | 1254 return should_close; |
| 1255 } | 1255 } |
| 1256 | 1256 |
| 1257 NavigationPolicy FrameLoader::ShouldContinueForNavigationPolicy( | 1257 NavigationPolicy FrameLoader::ShouldContinueForNavigationPolicy( |
| 1258 const ResourceRequest& request, | 1258 const ResourceRequest& request, |
| 1259 Document* origin_document, |
| 1259 const SubstituteData& substitute_data, | 1260 const SubstituteData& substitute_data, |
| 1260 DocumentLoader* loader, | 1261 DocumentLoader* loader, |
| 1261 ContentSecurityPolicyDisposition | 1262 ContentSecurityPolicyDisposition |
| 1262 should_check_main_world_content_security_policy, | 1263 should_check_main_world_content_security_policy, |
| 1263 NavigationType type, | 1264 NavigationType type, |
| 1264 NavigationPolicy policy, | 1265 NavigationPolicy policy, |
| 1265 FrameLoadType frame_load_type, | 1266 FrameLoadType frame_load_type, |
| 1266 bool is_client_redirect, | 1267 bool is_client_redirect, |
| 1267 HTMLFormElement* form) { | 1268 HTMLFormElement* form) { |
| 1268 // Don't ask if we are loading an empty URL. | 1269 // Don't ask if we are loading an empty URL. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1284 kCheckContentSecurityPolicy, | 1285 kCheckContentSecurityPolicy, |
| 1285 settings && settings->GetBrowserSideNavigationEnabled(), | 1286 settings && settings->GetBrowserSideNavigationEnabled(), |
| 1286 ContentSecurityPolicy::CheckHeaderType::kCheckEnforce) == | 1287 ContentSecurityPolicy::CheckHeaderType::kCheckEnforce) == |
| 1287 kNavigationPolicyIgnore) { | 1288 kNavigationPolicyIgnore) { |
| 1288 return kNavigationPolicyIgnore; | 1289 return kNavigationPolicyIgnore; |
| 1289 } | 1290 } |
| 1290 | 1291 |
| 1291 bool replaces_current_history_item = | 1292 bool replaces_current_history_item = |
| 1292 frame_load_type == kFrameLoadTypeReplaceCurrentItem; | 1293 frame_load_type == kFrameLoadTypeReplaceCurrentItem; |
| 1293 policy = Client()->DecidePolicyForNavigation( | 1294 policy = Client()->DecidePolicyForNavigation( |
| 1294 request, loader, type, policy, replaces_current_history_item, | 1295 request, origin_document, loader, type, policy, |
| 1295 is_client_redirect, form, | 1296 replaces_current_history_item, is_client_redirect, form, |
| 1296 should_check_main_world_content_security_policy); | 1297 should_check_main_world_content_security_policy); |
| 1297 if (policy == kNavigationPolicyCurrentTab || | 1298 if (policy == kNavigationPolicyCurrentTab || |
| 1298 policy == kNavigationPolicyIgnore || | 1299 policy == kNavigationPolicyIgnore || |
| 1299 policy == kNavigationPolicyHandledByClient || | 1300 policy == kNavigationPolicyHandledByClient || |
| 1300 policy == kNavigationPolicyHandledByClientForInitialHistory) { | 1301 policy == kNavigationPolicyHandledByClientForInitialHistory) { |
| 1301 return policy; | 1302 return policy; |
| 1302 } | 1303 } |
| 1303 | 1304 |
| 1304 Client()->LoadURLExternally(request, policy, String(), | 1305 Client()->LoadURLExternally(request, policy, String(), |
| 1305 replaces_current_history_item); | 1306 replaces_current_history_item); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1318 bool is_client_redirect, | 1319 bool is_client_redirect, |
| 1319 HTMLFormElement* form) { | 1320 HTMLFormElement* form) { |
| 1320 Settings* settings = frame_->GetSettings(); | 1321 Settings* settings = frame_->GetSettings(); |
| 1321 // Check report-only CSP policies, which are not checked by | 1322 // Check report-only CSP policies, which are not checked by |
| 1322 // ShouldContinueForNavigationPolicy. | 1323 // ShouldContinueForNavigationPolicy. |
| 1323 MaybeCheckCSP(request, type, frame_, policy, | 1324 MaybeCheckCSP(request, type, frame_, policy, |
| 1324 should_check_main_world_content_security_policy == | 1325 should_check_main_world_content_security_policy == |
| 1325 kCheckContentSecurityPolicy, | 1326 kCheckContentSecurityPolicy, |
| 1326 settings && settings->GetBrowserSideNavigationEnabled(), | 1327 settings && settings->GetBrowserSideNavigationEnabled(), |
| 1327 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); | 1328 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); |
| 1329 |
| 1328 return ShouldContinueForNavigationPolicy( | 1330 return ShouldContinueForNavigationPolicy( |
| 1329 request, substitute_data, loader, | 1331 request, |
| 1330 should_check_main_world_content_security_policy, type, policy, | 1332 // |origin_document| is not set. It doesn't really matter here. It is |
| 1331 frame_load_type, is_client_redirect, form); | 1333 // useful for PlzNavigate (aka browser-side-navigation). It is used |
| 1334 // during the first navigation and not during redirects. |
| 1335 nullptr, // origin_document |
| 1336 substitute_data, loader, should_check_main_world_content_security_policy, |
| 1337 type, policy, frame_load_type, is_client_redirect, form); |
| 1332 } | 1338 } |
| 1333 | 1339 |
| 1334 NavigationPolicy FrameLoader::CheckLoadCanStart( | 1340 NavigationPolicy FrameLoader::CheckLoadCanStart( |
| 1335 FrameLoadRequest& frame_load_request, | 1341 FrameLoadRequest& frame_load_request, |
| 1336 FrameLoadType type, | 1342 FrameLoadType type, |
| 1337 NavigationPolicy navigation_policy, | 1343 NavigationPolicy navigation_policy, |
| 1338 NavigationType navigation_type) { | 1344 NavigationType navigation_type) { |
| 1339 if (frame_->GetDocument()->PageDismissalEventBeingDispatched() != | 1345 if (frame_->GetDocument()->PageDismissalEventBeingDispatched() != |
| 1340 Document::kNoDismissal) { | 1346 Document::kNoDismissal) { |
| 1341 return kNavigationPolicyIgnore; | 1347 return kNavigationPolicyIgnore; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1355 Settings* settings = frame_->GetSettings(); | 1361 Settings* settings = frame_->GetSettings(); |
| 1356 MaybeCheckCSP( | 1362 MaybeCheckCSP( |
| 1357 resource_request, navigation_type, frame_, navigation_policy, | 1363 resource_request, navigation_type, frame_, navigation_policy, |
| 1358 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy() == | 1364 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy() == |
| 1359 kCheckContentSecurityPolicy, | 1365 kCheckContentSecurityPolicy, |
| 1360 settings && settings->GetBrowserSideNavigationEnabled(), | 1366 settings && settings->GetBrowserSideNavigationEnabled(), |
| 1361 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); | 1367 ContentSecurityPolicy::CheckHeaderType::kCheckReportOnly); |
| 1362 ModifyRequestForCSP(resource_request, nullptr); | 1368 ModifyRequestForCSP(resource_request, nullptr); |
| 1363 | 1369 |
| 1364 return ShouldContinueForNavigationPolicy( | 1370 return ShouldContinueForNavigationPolicy( |
| 1365 resource_request, frame_load_request.GetSubstituteData(), nullptr, | 1371 resource_request, frame_load_request.OriginDocument(), |
| 1372 frame_load_request.GetSubstituteData(), nullptr, |
| 1366 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy(), | 1373 frame_load_request.ShouldCheckMainWorldContentSecurityPolicy(), |
| 1367 navigation_type, navigation_policy, type, | 1374 navigation_type, navigation_policy, type, |
| 1368 frame_load_request.ClientRedirect() == | 1375 frame_load_request.ClientRedirect() == |
| 1369 ClientRedirectPolicy::kClientRedirect, | 1376 ClientRedirectPolicy::kClientRedirect, |
| 1370 frame_load_request.Form()); | 1377 frame_load_request.Form()); |
| 1371 } | 1378 } |
| 1372 | 1379 |
| 1373 void FrameLoader::StartLoad(FrameLoadRequest& frame_load_request, | 1380 void FrameLoader::StartLoad(FrameLoadRequest& frame_load_request, |
| 1374 FrameLoadType type, | 1381 FrameLoadType type, |
| 1375 NavigationPolicy navigation_policy, | 1382 NavigationPolicy navigation_policy, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 // TODO(japhet): This is needed because the browser process DCHECKs if the | 1685 // TODO(japhet): This is needed because the browser process DCHECKs if the |
| 1679 // first entry we commit in a new frame has replacement set. It's unclear | 1686 // first entry we commit in a new frame has replacement set. It's unclear |
| 1680 // whether the DCHECK is right, investigate removing this special case. | 1687 // whether the DCHECK is right, investigate removing this special case. |
| 1681 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1688 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
| 1682 (!Opener() || !request.Url().IsEmpty()); | 1689 (!Opener() || !request.Url().IsEmpty()); |
| 1683 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1690 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
| 1684 return loader; | 1691 return loader; |
| 1685 } | 1692 } |
| 1686 | 1693 |
| 1687 } // namespace blink | 1694 } // namespace blink |
| OLD | NEW |