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

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

Issue 1027623003: Archive loading should be case insensitive to mimetype "multipart/related" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated with small modification Created 5 years, 8 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "platform/weborigin/SecurityPolicy.h" 66 #include "platform/weborigin/SecurityPolicy.h"
67 #include "public/platform/Platform.h" 67 #include "public/platform/Platform.h"
68 #include "public/platform/WebMimeRegistry.h" 68 #include "public/platform/WebMimeRegistry.h"
69 #include "wtf/Assertions.h" 69 #include "wtf/Assertions.h"
70 #include "wtf/text/WTFString.h" 70 #include "wtf/text/WTFString.h"
71 71
72 namespace blink { 72 namespace blink {
73 73
74 static bool isArchiveMIMEType(const String& mimeType) 74 static bool isArchiveMIMEType(const String& mimeType)
75 { 75 {
76 return mimeType == "multipart/related"; 76 return equalIgnoringCase("multipart/related", mimeType);
77 } 77 }
78 78
79 DocumentLoader::DocumentLoader(LocalFrame* frame, const ResourceRequest& req, co nst SubstituteData& substituteData) 79 DocumentLoader::DocumentLoader(LocalFrame* frame, const ResourceRequest& req, co nst SubstituteData& substituteData)
80 : m_frame(frame) 80 : m_frame(frame)
81 , m_fetcher(FrameFetchContext::createContextAndFetcher(this)) 81 , m_fetcher(FrameFetchContext::createContextAndFetcher(this))
82 , m_originalRequest(req) 82 , m_originalRequest(req)
83 , m_substituteData(substituteData) 83 , m_substituteData(substituteData)
84 , m_request(req) 84 , m_request(req)
85 , m_committed(false) 85 , m_committed(false)
86 , m_isClientRedirect(false) 86 , m_isClientRedirect(false)
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // The server wants us to download instead of replacing the page content s. 378 // The server wants us to download instead of replacing the page content s.
379 // Downloading is handled by the embedder, but we still get the initial 379 // Downloading is handled by the embedder, but we still get the initial
380 // response so that we can ignore it and clean up properly. 380 // response so that we can ignore it and clean up properly.
381 return false; 381 return false;
382 } 382 }
383 383
384 if (!canShowMIMEType(m_response.mimeType(), m_frame->page())) 384 if (!canShowMIMEType(m_response.mimeType(), m_frame->page()))
385 return false; 385 return false;
386 386
387 // Prevent remote web archives from loading because they can claim to be fro m any domain and thus avoid cross-domain security checks. 387 // Prevent remote web archives from loading because they can claim to be fro m any domain and thus avoid cross-domain security checks.
388 if (equalIgnoringCase("multipart/related", m_response.mimeType()) && !Scheme Registry::shouldTreatURLSchemeAsLocal(m_request.url().protocol())) 388 if (isArchiveMIMEType(m_response.mimeType()) && !SchemeRegistry::shouldTreat URLSchemeAsLocal(m_request.url().protocol()))
389 return false; 389 return false;
390 390
391 return true; 391 return true;
392 } 392 }
393 393
394 void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceRespo nse& response) 394 void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceRespo nse& response)
395 { 395 {
396 InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, ma inResourceIdentifier(), response); 396 InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, ma inResourceIdentifier(), response);
397 397
398 frame()->document()->enforceSandboxFlags(SandboxOrigin); 398 frame()->document()->enforceSandboxFlags(SandboxOrigin);
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L() 783 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L()
784 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument) 784 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument)
785 { 785 {
786 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 786 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
787 if (!source.isNull()) 787 if (!source.isNull())
788 m_writer->appendReplacingData(source); 788 m_writer->appendReplacingData(source);
789 endWriting(m_writer.get()); 789 endWriting(m_writer.get());
790 } 790 }
791 791
792 } // namespace blink 792 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698