| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (!m_frame) | 308 if (!m_frame) |
| 309 return; | 309 return; |
| 310 | 310 |
| 311 m_applicationCacheHost->finishedLoadingMainResource(); | 311 m_applicationCacheHost->finishedLoadingMainResource(); |
| 312 endWriting(m_writer.get()); | 312 endWriting(m_writer.get()); |
| 313 if (m_state < MainResourceDone) | 313 if (m_state < MainResourceDone) |
| 314 m_state = MainResourceDone; | 314 m_state = MainResourceDone; |
| 315 clearMainResourceHandle(); | 315 clearMainResourceHandle(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque
st, const ResourceResponse& redirectResponse) | 318 bool DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque
st, const ResourceResponse& redirectResponse) |
| 319 { | 319 { |
| 320 DCHECK_EQ(resource, m_mainResource); | 320 DCHECK_EQ(resource, m_mainResource); |
| 321 DCHECK(!redirectResponse.isNull()); | 321 DCHECK(!redirectResponse.isNull()); |
| 322 m_request = request; | 322 m_request = request; |
| 323 | 323 |
| 324 // If the redirecting url is not allowed to display content from the target
origin, | 324 // If the redirecting url is not allowed to display content from the target
origin, |
| 325 // then block the redirect. | 325 // then block the redirect. |
| 326 const KURL& requestURL = m_request.url(); | 326 const KURL& requestURL = m_request.url(); |
| 327 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectRe
sponse.url()); | 327 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectRe
sponse.url()); |
| 328 if (!redirectingOrigin->canDisplay(requestURL)) { | 328 if (!redirectingOrigin->canDisplay(requestURL)) { |
| 329 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); | 329 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); |
| 330 m_fetcher->stopFetching(); | 330 return false; |
| 331 return; | |
| 332 } | 331 } |
| 333 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD
ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre
ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { | 332 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD
ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre
ntTab, replacesCurrentHistoryItem(), isClientRedirect())) |
| 334 m_fetcher->stopFetching(); | 333 return false; |
| 335 return; | |
| 336 } | |
| 337 | 334 |
| 338 DCHECK(timing().fetchStart()); | 335 DCHECK(timing().fetchStart()); |
| 339 appendRedirect(requestURL); | 336 appendRedirect(requestURL); |
| 340 didRedirect(redirectResponse.url(), requestURL); | 337 didRedirect(redirectResponse.url(), requestURL); |
| 341 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad(
); | 338 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad(
); |
| 339 |
| 340 return true; |
| 342 } | 341 } |
| 343 | 342 |
| 344 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) | 343 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) |
| 345 { | 344 { |
| 346 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi
meRegistry::IsSupported) | 345 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi
meRegistry::IsSupported) |
| 347 return true; | 346 return true; |
| 348 PluginData* pluginData = frame->pluginData(); | 347 PluginData* pluginData = frame->pluginData(); |
| 349 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim
eType); | 348 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim
eType); |
| 350 } | 349 } |
| 351 | 350 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 { | 719 { |
| 721 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); | 720 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); |
| 722 if (!source.isNull()) | 721 if (!source.isNull()) |
| 723 m_writer->appendReplacingData(source); | 722 m_writer->appendReplacingData(source); |
| 724 endWriting(m_writer.get()); | 723 endWriting(m_writer.get()); |
| 725 } | 724 } |
| 726 | 725 |
| 727 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 726 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 728 | 727 |
| 729 } // namespace blink | 728 } // namespace blink |
| OLD | NEW |