Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2121433002: Fix navigator.plugins and navigator.mimeTypes for OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 { 694 {
695 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); 695 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing);
696 if (!source.isNull()) 696 if (!source.isNull())
697 m_writer->appendReplacingData(source); 697 m_writer->appendReplacingData(source);
698 endWriting(m_writer.get()); 698 endWriting(m_writer.get());
699 } 699 }
700 700
701 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 701 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
702 702
703 } // namespace blink 703 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp ('k') | third_party/WebKit/Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698