| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 m_fetcher->stopFetching(); | 312 m_fetcher->stopFetching(); |
| 313 return; | 313 return; |
| 314 } | 314 } |
| 315 | 315 |
| 316 ASSERT(timing().fetchStart()); | 316 ASSERT(timing().fetchStart()); |
| 317 timing().addRedirect(redirectResponse.url(), requestURL); | 317 timing().addRedirect(redirectResponse.url(), requestURL); |
| 318 appendRedirect(requestURL); | 318 appendRedirect(requestURL); |
| 319 frameLoader()->receivedMainResourceRedirect(requestURL); | 319 frameLoader()->receivedMainResourceRedirect(requestURL); |
| 320 } | 320 } |
| 321 | 321 |
| 322 static bool canShowMIMEType(const String& mimeType, Page* page) | 322 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) |
| 323 { | 323 { |
| 324 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi
meRegistry::IsSupported) | 324 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi
meRegistry::IsSupported) |
| 325 return true; | 325 return true; |
| 326 PluginData* pluginData = page->pluginData(); | 326 PluginData* pluginData = frame->pluginData(); |
| 327 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim
eType); | 327 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim
eType); |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool DocumentLoader::shouldContinueForResponse() const | 330 bool DocumentLoader::shouldContinueForResponse() const |
| 331 { | 331 { |
| 332 if (m_substituteData.isValid()) | 332 if (m_substituteData.isValid()) |
| 333 return true; | 333 return true; |
| 334 | 334 |
| 335 int statusCode = m_response.httpStatusCode(); | 335 int statusCode = m_response.httpStatusCode(); |
| 336 if (statusCode == 204 || statusCode == 205) { | 336 if (statusCode == 204 || statusCode == 205) { |
| 337 // The server does not want us to replace the page contents. | 337 // The server does not want us to replace the page contents. |
| 338 return false; | 338 return false; |
| 339 } | 339 } |
| 340 | 340 |
| 341 if (getContentDispositionType(m_response.httpHeaderField(HTTPNames::Content_
Disposition)) == ContentDispositionAttachment) { | 341 if (getContentDispositionType(m_response.httpHeaderField(HTTPNames::Content_
Disposition)) == ContentDispositionAttachment) { |
| 342 // The server wants us to download instead of replacing the page content
s. | 342 // The server wants us to download instead of replacing the page content
s. |
| 343 // Downloading is handled by the embedder, but we still get the initial | 343 // Downloading is handled by the embedder, but we still get the initial |
| 344 // response so that we can ignore it and clean up properly. | 344 // response so that we can ignore it and clean up properly. |
| 345 return false; | 345 return false; |
| 346 } | 346 } |
| 347 | 347 |
| 348 if (!canShowMIMEType(m_response.mimeType(), m_frame->page())) | 348 if (!canShowMIMEType(m_response.mimeType(), m_frame)) |
| 349 return false; | 349 return false; |
| 350 return true; | 350 return true; |
| 351 } | 351 } |
| 352 | 352 |
| 353 void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceRespo
nse& response) | 353 void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceRespo
nse& response) |
| 354 { | 354 { |
| 355 InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, ma
inResourceIdentifier(), response, m_mainResource.get()); | 355 InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, ma
inResourceIdentifier(), response, m_mainResource.get()); |
| 356 | 356 |
| 357 setWasBlockedAfterXFrameOptionsOrCSP(); | 357 setWasBlockedAfterXFrameOptionsOrCSP(); |
| 358 | 358 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 { | 685 { |
| 686 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); | 686 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); |
| 687 if (!source.isNull()) | 687 if (!source.isNull()) |
| 688 m_writer->appendReplacingData(source); | 688 m_writer->appendReplacingData(source); |
| 689 endWriting(m_writer.get()); | 689 endWriting(m_writer.get()); |
| 690 } | 690 } |
| 691 | 691 |
| 692 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 692 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 693 | 693 |
| 694 } // namespace blink | 694 } // namespace blink |
| OLD | NEW |