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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 28 matching lines...) Expand all
39 #include "core/fetch/ImageResource.h" 39 #include "core/fetch/ImageResource.h"
40 #include "core/fetch/MemoryCache.h" 40 #include "core/fetch/MemoryCache.h"
41 #include "core/fetch/RawResource.h" 41 #include "core/fetch/RawResource.h"
42 #include "core/fetch/ResourceLoader.h" 42 #include "core/fetch/ResourceLoader.h"
43 #include "core/fetch/ResourceLoaderSet.h" 43 #include "core/fetch/ResourceLoaderSet.h"
44 #include "core/fetch/ScriptResource.h" 44 #include "core/fetch/ScriptResource.h"
45 #include "core/fetch/XSLStyleSheetResource.h" 45 #include "core/fetch/XSLStyleSheetResource.h"
46 #include "core/html/HTMLElement.h" 46 #include "core/html/HTMLElement.h"
47 #include "core/html/HTMLFrameOwnerElement.h" 47 #include "core/html/HTMLFrameOwnerElement.h"
48 #include "core/html/imports/HTMLImportsController.h" 48 #include "core/html/imports/HTMLImportsController.h"
49 #include "core/inspector/ConsoleMessage.h"
49 #include "core/inspector/InspectorInstrumentation.h" 50 #include "core/inspector/InspectorInstrumentation.h"
50 #include "core/loader/DocumentLoader.h" 51 #include "core/loader/DocumentLoader.h"
51 #include "core/loader/FrameLoader.h" 52 #include "core/loader/FrameLoader.h"
52 #include "core/loader/FrameLoaderClient.h" 53 #include "core/loader/FrameLoaderClient.h"
53 #include "core/loader/PingLoader.h" 54 #include "core/loader/PingLoader.h"
54 #include "core/loader/SubstituteData.h" 55 #include "core/loader/SubstituteData.h"
55 #include "core/loader/UniqueIdentifier.h" 56 #include "core/loader/UniqueIdentifier.h"
56 #include "core/loader/appcache/ApplicationCacheHost.h" 57 #include "core/loader/appcache/ApplicationCacheHost.h"
57 #include "core/frame/LocalDOMWindow.h" 58 #include "core/frame/LocalDOMWindow.h"
58 #include "core/frame/LocalFrame.h" 59 #include "core/frame/LocalFrame.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 619
619 if (sourceOrigin->canRequest(url)) 620 if (sourceOrigin->canRequest(url))
620 return true; 621 return true;
621 622
622 String errorDescription; 623 String errorDescription;
623 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { 624 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) {
624 if (resource->type() == Resource::Font) 625 if (resource->type() == Resource::Font)
625 toFontResource(resource)->setCORSFailed(); 626 toFontResource(resource)->setCORSFailed();
626 if (frame() && frame()->document()) { 627 if (frame() && frame()->document()) {
627 String resourceType = Resource::resourceTypeToString(resource->type( ), resource->options().initiatorInfo); 628 String resourceType = Resource::resourceTypeToString(resource->type( ), resource->options().initiatorInfo);
628 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessage Level, resourceType + " from origin '" + SecurityOrigin::create(url)->toString() + "' has been blocked from loading by Cross-Origin Resource Sharing policy: " + errorDescription); 629 frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMess ageSource, ErrorMessageLevel, resourceType + " from origin '" + SecurityOrigin:: create(url)->toString() + "' has been blocked from loading by Cross-Origin Resou rce Sharing policy: " + errorDescription));
629 } 630 }
630 return false; 631 return false;
631 } 632 }
632 return true; 633 return true;
633 } 634 }
634 635
635 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const 636 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const
636 { 637 {
637 if (!frame()) 638 if (!frame())
638 return false; 639 return false;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 1066
1066 if (!frame()) 1067 if (!frame())
1067 return; 1068 return;
1068 1069
1069 String message; 1070 String message;
1070 if (!m_document || m_document->url().isNull()) 1071 if (!m_document || m_document->url().isNull())
1071 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; 1072 message = "Unsafe attempt to load URL " + url.elidedString() + '.';
1072 else 1073 else
1073 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"; 1074 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";
1074 1075
1075 frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLe vel, message); 1076 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message));
1076 } 1077 }
1077 1078
1078 void ResourceFetcher::setAutoLoadImages(bool enable) 1079 void ResourceFetcher::setAutoLoadImages(bool enable)
1079 { 1080 {
1080 if (enable == m_autoLoadImages) 1081 if (enable == m_autoLoadImages)
1081 return; 1082 return;
1082 1083
1083 m_autoLoadImages = enable; 1084 m_autoLoadImages = enable;
1084 1085
1085 if (!m_autoLoadImages) 1086 if (!m_autoLoadImages)
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 if (options.corsEnabled == IsCORSEnabled) { 1400 if (options.corsEnabled == IsCORSEnabled) {
1400 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); 1401 SecurityOrigin* sourceOrigin = options.securityOrigin.get();
1401 if (!sourceOrigin && document()) 1402 if (!sourceOrigin && document())
1402 sourceOrigin = document()->securityOrigin(); 1403 sourceOrigin = document()->securityOrigin();
1403 1404
1404 String errorMessage; 1405 String errorMessage;
1405 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re quest, redirectResponse, options, errorMessage)) { 1406 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re quest, redirectResponse, options, errorMessage)) {
1406 if (resource->type() == Resource::Font) 1407 if (resource->type() == Resource::Font)
1407 toFontResource(resource)->setCORSFailed(); 1408 toFontResource(resource)->setCORSFailed();
1408 if (frame() && frame()->document()) 1409 if (frame() && frame()->document())
1409 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMes sageLevel, errorMessage); 1410 frame()->document()->addConsoleMessage(ConsoleMessage::create(JS MessageSource, ErrorMessageLevel, errorMessage));
1410 return false; 1411 return false;
1411 } 1412 }
1412 } 1413 }
1413 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url( ))) 1414 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url( )))
1414 return false; 1415 return false;
1415 return true; 1416 return true;
1416 } 1417 }
1417 1418
1418 #if !ENABLE(OILPAN) 1419 #if !ENABLE(OILPAN)
1419 void ResourceFetcher::refResourceLoaderHost() 1420 void ResourceFetcher::refResourceLoaderHost()
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 } 1519 }
1519 } 1520 }
1520 1521
1521 void ResourceFetcher::trace(Visitor* visitor) 1522 void ResourceFetcher::trace(Visitor* visitor)
1522 { 1523 {
1523 visitor->trace(m_document); 1524 visitor->trace(m_document);
1524 ResourceLoaderHost::trace(visitor); 1525 ResourceLoaderHost::trace(visitor);
1525 } 1526 }
1526 1527
1527 } 1528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698