| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (!m_frame) | 298 if (!m_frame) |
| 299 return; | 299 return; |
| 300 | 300 |
| 301 m_applicationCacheHost->finishedLoadingMainResource(); | 301 m_applicationCacheHost->finishedLoadingMainResource(); |
| 302 endWriting(m_writer.get()); | 302 endWriting(m_writer.get()); |
| 303 if (m_state < MainResourceDone) | 303 if (m_state < MainResourceDone) |
| 304 m_state = MainResourceDone; | 304 m_state = MainResourceDone; |
| 305 clearMainResourceHandle(); | 305 clearMainResourceHandle(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void DocumentLoader::redirectReceived( | 308 bool DocumentLoader::redirectReceived( |
| 309 Resource* resource, | 309 Resource* resource, |
| 310 ResourceRequest& request, | 310 const ResourceRequest& request, |
| 311 const ResourceResponse& redirectResponse) { | 311 const ResourceResponse& redirectResponse) { |
| 312 DCHECK_EQ(resource, m_mainResource); | 312 DCHECK_EQ(resource, m_mainResource); |
| 313 DCHECK(!redirectResponse.isNull()); | 313 DCHECK(!redirectResponse.isNull()); |
| 314 m_request = request; | 314 m_request = request; |
| 315 | 315 |
| 316 // If the redirecting url is not allowed to display content from the target | 316 // If the redirecting url is not allowed to display content from the target |
| 317 // origin, then block the redirect. | 317 // origin, then block the redirect. |
| 318 const KURL& requestURL = m_request.url(); | 318 const KURL& requestURL = m_request.url(); |
| 319 RefPtr<SecurityOrigin> redirectingOrigin = | 319 RefPtr<SecurityOrigin> redirectingOrigin = |
| 320 SecurityOrigin::create(redirectResponse.url()); | 320 SecurityOrigin::create(redirectResponse.url()); |
| 321 if (!redirectingOrigin->canDisplay(requestURL)) { | 321 if (!redirectingOrigin->canDisplay(requestURL)) { |
| 322 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); | 322 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); |
| 323 m_fetcher->stopFetching(); | 323 m_fetcher->stopFetching(); |
| 324 return; | 324 return false; |
| 325 } | 325 } |
| 326 if (!frameLoader()->shouldContinueForNavigationPolicy( | 326 if (!frameLoader()->shouldContinueForNavigationPolicy( |
| 327 m_request, SubstituteData(), this, CheckContentSecurityPolicy, | 327 m_request, SubstituteData(), this, CheckContentSecurityPolicy, |
| 328 m_navigationType, NavigationPolicyCurrentTab, | 328 m_navigationType, NavigationPolicyCurrentTab, |
| 329 replacesCurrentHistoryItem(), isClientRedirect(), nullptr)) { | 329 replacesCurrentHistoryItem(), isClientRedirect(), nullptr)) { |
| 330 m_fetcher->stopFetching(); | 330 m_fetcher->stopFetching(); |
| 331 return; | 331 return false; |
| 332 } | 332 } |
| 333 | 333 |
| 334 DCHECK(timing().fetchStart()); | 334 DCHECK(timing().fetchStart()); |
| 335 appendRedirect(requestURL); | 335 appendRedirect(requestURL); |
| 336 didRedirect(redirectResponse.url(), requestURL); | 336 didRedirect(redirectResponse.url(), requestURL); |
| 337 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); | 337 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); |
| 338 |
| 339 return true; |
| 338 } | 340 } |
| 339 | 341 |
| 340 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) { | 342 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) { |
| 341 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == | 343 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == |
| 342 WebMimeRegistry::IsSupported) | 344 WebMimeRegistry::IsSupported) |
| 343 return true; | 345 return true; |
| 344 PluginData* pluginData = frame->pluginData(); | 346 PluginData* pluginData = frame->pluginData(); |
| 345 return !mimeType.isEmpty() && pluginData && | 347 return !mimeType.isEmpty() && pluginData && |
| 346 pluginData->supportsMimeType(mimeType); | 348 pluginData->supportsMimeType(mimeType); |
| 347 } | 349 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 m_writer ? m_writer->encoding() : emptyAtom, true, | 749 m_writer ? m_writer->encoding() : emptyAtom, true, |
| 748 ForceSynchronousParsing); | 750 ForceSynchronousParsing); |
| 749 if (!source.isNull()) | 751 if (!source.isNull()) |
| 750 m_writer->appendReplacingData(source); | 752 m_writer->appendReplacingData(source); |
| 751 endWriting(m_writer.get()); | 753 endWriting(m_writer.get()); |
| 752 } | 754 } |
| 753 | 755 |
| 754 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 756 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 755 | 757 |
| 756 } // namespace blink | 758 } // namespace blink |
| OLD | NEW |