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

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: 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 else if (url.isLocalFile() || m_document->url().isLocalFile()) 341 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"; 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";
343 else 343 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"; 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";
345 345
346 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message)); 346 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message));
347 } 347 }
348 348
349 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const 349 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const
350 { 350 {
351 if (InspectorInstrumentation::shouldBlockRequest(frame(), resourceRequest))
352 return false;
353
351 SecurityOrigin* securityOrigin = options.securityOrigin.get(); 354 SecurityOrigin* securityOrigin = options.securityOrigin.get();
352 if (!securityOrigin && m_document) 355 if (!securityOrigin && m_document)
353 securityOrigin = m_document->securityOrigin(); 356 securityOrigin = m_document->securityOrigin();
354 357
355 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) { 358 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) {
356 if (!forPreload) 359 if (!forPreload)
357 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); 360 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString());
358 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay"); 361 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay");
359 return false; 362 return false;
360 } 363 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 695
693 696
694 DEFINE_TRACE(FrameFetchContext) 697 DEFINE_TRACE(FrameFetchContext)
695 { 698 {
696 visitor->trace(m_document); 699 visitor->trace(m_document);
697 visitor->trace(m_documentLoader); 700 visitor->trace(m_documentLoader);
698 FetchContext::trace(visitor); 701 FetchContext::trace(visitor);
699 } 702 }
700 703
701 } // namespace blink 704 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698