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

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

Issue 2162473003: Only flag the LayoutObject on CSP error if one is attached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 if (!document().getSecurityOrigin()->canDisplay(url)) { 548 if (!document().getSecurityOrigin()->canDisplay(url)) {
549 FrameLoader::reportLocalLoadFailed(frame, url.getString()); 549 FrameLoader::reportLocalLoadFailed(frame, url.getString());
550 return false; 550 return false;
551 } 551 }
552 552
553 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ? 553 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ?
554 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) : 554 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) :
555 fastGetAttribute(HTMLNames::typeAttr); 555 fastGetAttribute(HTMLNames::typeAttr);
556 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) 556 if (!document().contentSecurityPolicy()->allowObjectFromSource(url)
557 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) { 557 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) {
558 layoutEmbeddedItem().setPluginUnavailabilityReason(LayoutEmbeddedObject: :PluginBlockedByContentSecurityPolicy); 558 if (LayoutEmbeddedItem layoutItem = layoutEmbeddedItem())
559 layoutItem.setPluginUnavailabilityReason(LayoutEmbeddedObject::Plugi nBlockedByContentSecurityPolicy);
559 return false; 560 return false;
560 } 561 }
561 // If the URL is empty, a plugin could still be instantiated if a MIME-type 562 // If the URL is empty, a plugin could still be instantiated if a MIME-type
562 // is specified. 563 // is specified.
563 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, ResourceRequest::RedirectStatus::NoRedirect, url); 564 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, ResourceRequest::RedirectStatus::NoRedirect, url);
564 } 565 }
565 566
566 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT ype) 567 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT ype)
567 { 568 {
568 if (document().isSandboxed(SandboxPlugins)) { 569 if (document().isSandboxed(SandboxPlugins)) {
(...skipping 21 matching lines...) Expand all
590 591
591 void HTMLPlugInElement::lazyReattachIfNeeded() 592 void HTMLPlugInElement::lazyReattachIfNeeded()
592 { 593 {
593 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) { 594 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) {
594 lazyReattachIfAttached(); 595 lazyReattachIfAttached();
595 setPersistedPluginWidget(nullptr); 596 setPersistedPluginWidget(nullptr);
596 } 597 }
597 } 598 }
598 599
599 } // namespace blink 600 } // 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