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

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

Issue 1295903005: [DevTools] Implementation of resource requests blocked by specific urls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Explicit approach Created 5 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 #include "core/fetch/ClientHintsPreferences.h" 36 #include "core/fetch/ClientHintsPreferences.h"
37 #include "core/frame/FrameConsole.h" 37 #include "core/frame/FrameConsole.h"
38 #include "core/frame/FrameHost.h" 38 #include "core/frame/FrameHost.h"
39 #include "core/frame/FrameView.h" 39 #include "core/frame/FrameView.h"
40 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
41 #include "core/frame/Settings.h" 41 #include "core/frame/Settings.h"
42 #include "core/html/HTMLFrameOwnerElement.h" 42 #include "core/html/HTMLFrameOwnerElement.h"
43 #include "core/html/imports/HTMLImportsController.h" 43 #include "core/html/imports/HTMLImportsController.h"
44 #include "core/inspector/ConsoleMessage.h" 44 #include "core/inspector/ConsoleMessage.h"
45 #include "core/inspector/InspectorInstrumentation.h" 45 #include "core/inspector/InspectorInstrumentation.h"
46 #include "core/inspector/InspectorResourceAgent.h"
46 #include "core/inspector/InspectorTraceEvents.h" 47 #include "core/inspector/InspectorTraceEvents.h"
48 #include "core/inspector/InstrumentingAgents.h"
47 #include "core/loader/DocumentLoader.h" 49 #include "core/loader/DocumentLoader.h"
48 #include "core/loader/FrameLoader.h" 50 #include "core/loader/FrameLoader.h"
49 #include "core/loader/FrameLoaderClient.h" 51 #include "core/loader/FrameLoaderClient.h"
50 #include "core/loader/LinkLoader.h" 52 #include "core/loader/LinkLoader.h"
51 #include "core/loader/MixedContentChecker.h" 53 #include "core/loader/MixedContentChecker.h"
52 #include "core/loader/NetworkHintsInterface.h" 54 #include "core/loader/NetworkHintsInterface.h"
53 #include "core/loader/PingLoader.h" 55 #include "core/loader/PingLoader.h"
54 #include "core/loader/ProgressTracker.h" 56 #include "core/loader/ProgressTracker.h"
55 #include "core/loader/appcache/ApplicationCacheHost.h" 57 #include "core/loader/appcache/ApplicationCacheHost.h"
56 #include "core/page/Page.h" 58 #include "core/page/Page.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 else if (url.isLocalFile() || m_document->url().isLocalFile()) 343 else if (url.isLocalFile() || m_document->url().isLocalFile())
342 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr ame with URL " + m_document->url().elidedString() + ". 'file:' URLs are treated as unique security origins.\n"; 344 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr ame with URL " + m_document->url().elidedString() + ". 'file:' URLs are treated as unique security origins.\n";
343 else 345 else
344 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po rts must match.\n"; 346 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po rts must match.\n";
345 347
346 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message)); 348 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message));
347 } 349 }
348 350
349 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const 351 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const
350 { 352 {
353 InstrumentingAgents* agents = InspectorInstrumentation::instrumentingAgentsF or(frame());
354 if (agents && agents->inspectorResourceAgent()) {
355 if (agents->inspectorResourceAgent()->shouldBlockRequest(resourceRequest ))
356 return false;
357 }
358
351 SecurityOrigin* securityOrigin = options.securityOrigin.get(); 359 SecurityOrigin* securityOrigin = options.securityOrigin.get();
352 if (!securityOrigin && m_document) 360 if (!securityOrigin && m_document)
353 securityOrigin = m_document->securityOrigin(); 361 securityOrigin = m_document->securityOrigin();
354 362
355 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) { 363 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) {
356 if (!forPreload) 364 if (!forPreload)
357 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); 365 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString());
358 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay"); 366 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay");
359 return false; 367 return false;
360 } 368 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 700
693 701
694 DEFINE_TRACE(FrameFetchContext) 702 DEFINE_TRACE(FrameFetchContext)
695 { 703 {
696 visitor->trace(m_document); 704 visitor->trace(m_document);
697 visitor->trace(m_documentLoader); 705 visitor->trace(m_documentLoader);
698 FetchContext::trace(visitor); 706 FetchContext::trace(visitor);
699 } 707 }
700 708
701 } // namespace blink 709 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698