| 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 ASSERT_UNUSED(resource, resource == m_mainResource); | 320 ASSERT_UNUSED(resource, resource == m_mainResource); |
| 321 ASSERT(!redirectResponse.isNull()); | 321 ASSERT(!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 m_fetcher->stopFetching(); |
| 331 return; | 331 return false; |
| 332 } | 332 } |
| 333 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD
ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre
ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { | 333 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD
ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre
ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { |
| 334 m_fetcher->stopFetching(); | 334 m_fetcher->stopFetching(); |
| 335 return; | 335 return false; |
| 336 } | 336 } |
| 337 | 337 |
| 338 ASSERT(timing().fetchStart()); | 338 ASSERT(timing().fetchStart()); |
| 339 appendRedirect(requestURL); | 339 appendRedirect(requestURL); |
| 340 didRedirect(redirectResponse.url(), requestURL); | 340 didRedirect(redirectResponse.url(), requestURL); |
| 341 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad(
); | 341 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad(
); |
| 342 |
| 343 return true; |
| 342 } | 344 } |
| 343 | 345 |
| 344 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) | 346 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) |
| 345 { | 347 { |
| 346 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi
meRegistry::IsSupported) | 348 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi
meRegistry::IsSupported) |
| 347 return true; | 349 return true; |
| 348 PluginData* pluginData = frame->pluginData(); | 350 PluginData* pluginData = frame->pluginData(); |
| 349 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim
eType); | 351 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim
eType); |
| 350 } | 352 } |
| 351 | 353 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 { | 722 { |
| 721 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); | 723 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); |
| 722 if (!source.isNull()) | 724 if (!source.isNull()) |
| 723 m_writer->appendReplacingData(source); | 725 m_writer->appendReplacingData(source); |
| 724 endWriting(m_writer.get()); | 726 endWriting(m_writer.get()); |
| 725 } | 727 } |
| 726 | 728 |
| 727 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 729 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 728 | 730 |
| 729 } // namespace blink | 731 } // namespace blink |
| OLD | NEW |