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

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: rebase 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 26 matching lines...) Expand all
37 #include "core/fetch/UniqueIdentifier.h" 37 #include "core/fetch/UniqueIdentifier.h"
38 #include "core/frame/FrameConsole.h" 38 #include "core/frame/FrameConsole.h"
39 #include "core/frame/FrameHost.h" 39 #include "core/frame/FrameHost.h"
40 #include "core/frame/FrameView.h" 40 #include "core/frame/FrameView.h"
41 #include "core/frame/LocalFrame.h" 41 #include "core/frame/LocalFrame.h"
42 #include "core/frame/Settings.h" 42 #include "core/frame/Settings.h"
43 #include "core/html/HTMLFrameOwnerElement.h" 43 #include "core/html/HTMLFrameOwnerElement.h"
44 #include "core/html/imports/HTMLImportsController.h" 44 #include "core/html/imports/HTMLImportsController.h"
45 #include "core/inspector/ConsoleMessage.h" 45 #include "core/inspector/ConsoleMessage.h"
46 #include "core/inspector/InspectorInstrumentation.h" 46 #include "core/inspector/InspectorInstrumentation.h"
47 #include "core/inspector/InspectorResourceAgent.h"
47 #include "core/inspector/InspectorTraceEvents.h" 48 #include "core/inspector/InspectorTraceEvents.h"
49 #include "core/inspector/InstrumentingAgents.h"
48 #include "core/loader/DocumentLoader.h" 50 #include "core/loader/DocumentLoader.h"
49 #include "core/loader/FrameLoader.h" 51 #include "core/loader/FrameLoader.h"
50 #include "core/loader/FrameLoaderClient.h" 52 #include "core/loader/FrameLoaderClient.h"
51 #include "core/loader/LinkLoader.h" 53 #include "core/loader/LinkLoader.h"
52 #include "core/loader/MixedContentChecker.h" 54 #include "core/loader/MixedContentChecker.h"
53 #include "core/loader/NetworkHintsInterface.h" 55 #include "core/loader/NetworkHintsInterface.h"
54 #include "core/loader/PingLoader.h" 56 #include "core/loader/PingLoader.h"
55 #include "core/loader/ProgressTracker.h" 57 #include "core/loader/ProgressTracker.h"
56 #include "core/loader/appcache/ApplicationCacheHost.h" 58 #include "core/loader/appcache/ApplicationCacheHost.h"
57 #include "core/page/Page.h" 59 #include "core/page/Page.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 else if (url.isLocalFile() || m_document->url().isLocalFile()) 340 else if (url.isLocalFile() || m_document->url().isLocalFile())
339 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"; 341 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";
340 else 342 else
341 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"; 343 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";
342 344
343 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message)); 345 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message));
344 } 346 }
345 347
346 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const 348 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const
347 { 349 {
350 InstrumentingAgents* agents = InspectorInstrumentation::instrumentingAgentsF or(frame());
351 if (agents && agents->inspectorResourceAgent()) {
352 if (agents->inspectorResourceAgent()->shouldBlockRequest(resourceRequest ))
353 return false;
354 }
355
348 SecurityOrigin* securityOrigin = options.securityOrigin.get(); 356 SecurityOrigin* securityOrigin = options.securityOrigin.get();
349 if (!securityOrigin && m_document) 357 if (!securityOrigin && m_document)
350 securityOrigin = m_document->securityOrigin(); 358 securityOrigin = m_document->securityOrigin();
351 359
352 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) { 360 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) {
353 if (!forPreload) 361 if (!forPreload)
354 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); 362 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString());
355 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay"); 363 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay");
356 return false; 364 return false;
357 } 365 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 685
678 686
679 DEFINE_TRACE(FrameFetchContext) 687 DEFINE_TRACE(FrameFetchContext)
680 { 688 {
681 visitor->trace(m_document); 689 visitor->trace(m_document);
682 visitor->trace(m_documentLoader); 690 visitor->trace(m_documentLoader);
683 FetchContext::trace(visitor); 691 FetchContext::trace(visitor);
684 } 692 }
685 693
686 } // namespace blink 694 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.cpp ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698