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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp

Issue 2002943002: CSP violation reports should report the pre-redirect URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 6 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/layout/LayoutPart.h" 42 #include "core/layout/LayoutPart.h"
43 #include "core/loader/FrameLoaderClient.h" 43 #include "core/loader/FrameLoaderClient.h"
44 #include "core/loader/MixedContentChecker.h" 44 #include "core/loader/MixedContentChecker.h"
45 #include "core/page/Page.h" 45 #include "core/page/Page.h"
46 #include "core/page/scrolling/ScrollingCoordinator.h" 46 #include "core/page/scrolling/ScrollingCoordinator.h"
47 #include "core/plugins/PluginView.h" 47 #include "core/plugins/PluginView.h"
48 #include "platform/Logging.h" 48 #include "platform/Logging.h"
49 #include "platform/MIMETypeFromURL.h" 49 #include "platform/MIMETypeFromURL.h"
50 #include "platform/MIMETypeRegistry.h" 50 #include "platform/MIMETypeRegistry.h"
51 #include "platform/Widget.h" 51 #include "platform/Widget.h"
52 #include "platform/network/ResourceRequest.h"
52 #include "platform/plugins/PluginData.h" 53 #include "platform/plugins/PluginData.h"
53 #include "public/platform/WebURLRequest.h" 54 #include "public/platform/WebURLRequest.h"
54 55
55 namespace blink { 56 namespace blink {
56 57
57 using namespace HTMLNames; 58 using namespace HTMLNames;
58 59
59 HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document& doc , bool createdByParser, PreferPlugInsForImagesOption preferPlugInsForImagesOptio n) 60 HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document& doc , bool createdByParser, PreferPlugInsForImagesOption preferPlugInsForImagesOptio n)
60 : HTMLFrameOwnerElement(tagName, doc) 61 : HTMLFrameOwnerElement(tagName, doc)
61 , m_isDelayingLoadEvent(false) 62 , m_isDelayingLoadEvent(false)
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ? 561 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ?
561 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) : 562 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) :
562 fastGetAttribute(HTMLNames::typeAttr); 563 fastGetAttribute(HTMLNames::typeAttr);
563 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) 564 if (!document().contentSecurityPolicy()->allowObjectFromSource(url)
564 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) { 565 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) {
565 layoutEmbeddedItem().setPluginUnavailabilityReason(LayoutEmbeddedObject: :PluginBlockedByContentSecurityPolicy); 566 layoutEmbeddedItem().setPluginUnavailabilityReason(LayoutEmbeddedObject: :PluginBlockedByContentSecurityPolicy);
566 return false; 567 return false;
567 } 568 }
568 // If the URL is empty, a plugin could still be instantiated if a MIME-type 569 // If the URL is empty, a plugin could still be instantiated if a MIME-type
569 // is specified. 570 // is specified.
570 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, url); 571 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, ResourceRequest::RedirectStatus::NoRedirect, url);
571 } 572 }
572 573
573 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT ype) 574 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT ype)
574 { 575 {
575 if (document().isSandboxed(SandboxPlugins)) { 576 if (document().isSandboxed(SandboxPlugins)) {
576 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSourc e, ErrorMessageLevel, 577 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSourc e, ErrorMessageLevel,
577 "Failed to load '" + url.elidedString() + "' as a plugin, because th e frame into which the plugin is loading is sandboxed.")); 578 "Failed to load '" + url.elidedString() + "' as a plugin, because th e frame into which the plugin is loading is sandboxed."));
578 return false; 579 return false;
579 } 580 }
580 return true; 581 return true;
(...skipping 16 matching lines...) Expand all
597 598
598 void HTMLPlugInElement::lazyReattachIfNeeded() 599 void HTMLPlugInElement::lazyReattachIfNeeded()
599 { 600 {
600 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) { 601 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) {
601 lazyReattachIfAttached(); 602 lazyReattachIfAttached();
602 setPersistedPluginWidget(nullptr); 603 setPersistedPluginWidget(nullptr);
603 } 604 }
604 } 605 }
605 606
606 } // namespace blink 607 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698