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

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

Issue 2166273002: Only flag the LayoutObject on CSP error if one is attached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/plugins/plugin-without-layout-csp-error-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 if (!document().getSecurityOrigin()->canDisplay(url)) { 561 if (!document().getSecurityOrigin()->canDisplay(url)) {
562 FrameLoader::reportLocalLoadFailed(frame, url.getString()); 562 FrameLoader::reportLocalLoadFailed(frame, url.getString());
563 return false; 563 return false;
564 } 564 }
565 565
566 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ? 566 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ?
567 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) : 567 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) :
568 fastGetAttribute(HTMLNames::typeAttr); 568 fastGetAttribute(HTMLNames::typeAttr);
569 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) 569 if (!document().contentSecurityPolicy()->allowObjectFromSource(url)
570 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) { 570 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) {
571 layoutEmbeddedItem().setPluginUnavailabilityReason(LayoutEmbeddedObject: :PluginBlockedByContentSecurityPolicy); 571 if (LayoutEmbeddedItem layoutItem = layoutEmbeddedItem())
572 layoutItem.setPluginUnavailabilityReason(LayoutEmbeddedObject::Plugi nBlockedByContentSecurityPolicy);
572 return false; 573 return false;
573 } 574 }
574 // If the URL is empty, a plugin could still be instantiated if a MIME-type 575 // If the URL is empty, a plugin could still be instantiated if a MIME-type
575 // is specified. 576 // is specified.
576 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, ResourceRequest::RedirectStatus::NoRedirect, url); 577 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, ResourceRequest::RedirectStatus::NoRedirect, url);
577 } 578 }
578 579
579 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT ype) 580 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT ype)
580 { 581 {
581 if (document().isSandboxed(SandboxPlugins)) { 582 if (document().isSandboxed(SandboxPlugins)) {
(...skipping 21 matching lines...) Expand all
603 604
604 void HTMLPlugInElement::lazyReattachIfNeeded() 605 void HTMLPlugInElement::lazyReattachIfNeeded()
605 { 606 {
606 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) { 607 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) {
607 lazyReattachIfAttached(); 608 lazyReattachIfAttached();
608 setPersistedPluginWidget(nullptr); 609 setPersistedPluginWidget(nullptr);
609 } 610 }
610 } 611 }
611 612
612 } // namespace blink 613 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/plugins/plugin-without-layout-csp-error-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698