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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 if (!m_frame) | 314 if (!m_frame) |
315 return; | 315 return; |
316 | 316 |
317 m_applicationCacheHost->finishedLoadingMainResource(); | 317 m_applicationCacheHost->finishedLoadingMainResource(); |
318 endWriting(m_writer.get()); | 318 endWriting(m_writer.get()); |
319 if (m_state < MainResourceDone) | 319 if (m_state < MainResourceDone) |
320 m_state = MainResourceDone; | 320 m_state = MainResourceDone; |
321 clearMainResourceHandle(); | 321 clearMainResourceHandle(); |
322 } | 322 } |
323 | 323 |
324 void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque st, const ResourceResponse& redirectResponse) | 324 bool DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque st, const ResourceResponse& redirectResponse) |
325 { | 325 { |
326 ASSERT_UNUSED(resource, resource == m_mainResource); | 326 ASSERT_UNUSED(resource, resource == m_mainResource); |
327 ASSERT(!redirectResponse.isNull()); | 327 ASSERT(!redirectResponse.isNull()); |
328 m_request = request; | 328 m_request = request; |
329 | 329 |
330 // If the redirecting url is not allowed to display content from the target origin, | 330 // If the redirecting url is not allowed to display content from the target origin, |
331 // then block the redirect. | 331 // then block the redirect. |
332 const KURL& requestURL = m_request.url(); | 332 const KURL& requestURL = m_request.url(); |
333 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectRe sponse.url()); | 333 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectRe sponse.url()); |
334 if (!redirectingOrigin->canDisplay(requestURL)) { | 334 if (!redirectingOrigin->canDisplay(requestURL)) { |
335 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); | 335 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); |
336 m_fetcher->stopFetching(); | 336 m_fetcher->stopFetching(); |
337 return; | 337 return true; |
Nate Chapin
2016/09/06 16:46:14
If you return false here, you can probably remove
tyoshino (SeeGerritForStatus)
2016/09/07 10:52:28
I agree that we can change the return value here a
Nate Chapin
2016/09/07 17:05:45
Hrm, maybe ResourceLoader::willFollowRedirect() sh
tyoshino (SeeGerritForStatus)
2016/09/14 14:53:47
Any issue with only failing this RawResource? At t
Nate Chapin
2016/09/14 22:25:27
Subresources can only be loaded once this Document
tyoshino (SeeGerritForStatus)
2016/09/16 07:19:58
OK. Removing stopFetching() calls here and at L340
| |
338 } | 338 } |
339 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { | 339 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { |
340 m_fetcher->stopFetching(); | 340 m_fetcher->stopFetching(); |
341 return; | 341 return true; |
342 } | 342 } |
343 | 343 |
344 ASSERT(timing().fetchStart()); | 344 ASSERT(timing().fetchStart()); |
345 appendRedirect(requestURL); | 345 appendRedirect(requestURL); |
346 didRedirect(redirectResponse.url(), requestURL); | 346 didRedirect(redirectResponse.url(), requestURL); |
347 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad( ); | 347 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad( ); |
348 | |
349 return true; | |
348 } | 350 } |
349 | 351 |
350 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) | 352 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) |
351 { | 353 { |
352 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi meRegistry::IsSupported) | 354 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi meRegistry::IsSupported) |
353 return true; | 355 return true; |
354 PluginData* pluginData = frame->pluginData(); | 356 PluginData* pluginData = frame->pluginData(); |
355 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim eType); | 357 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim eType); |
356 } | 358 } |
357 | 359 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 { | 733 { |
732 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); | 734 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); |
733 if (!source.isNull()) | 735 if (!source.isNull()) |
734 m_writer->appendReplacingData(source); | 736 m_writer->appendReplacingData(source); |
735 endWriting(m_writer.get()); | 737 endWriting(m_writer.get()); |
736 } | 738 } |
737 | 739 |
738 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 740 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
739 | 741 |
740 } // namespace blink | 742 } // namespace blink |
OLD | NEW |