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

Unified Diff: Source/core/html/HTMLAppletElement.cpp

Issue 20858002: Merge SubframeLoader::createJavaAppletWidget into HTMLAppletElement::udpateWidget (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: const KURL& - > KURL Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/loader/SubframeLoader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLAppletElement.cpp
diff --git a/Source/core/html/HTMLAppletElement.cpp b/Source/core/html/HTMLAppletElement.cpp
index 23bc61fcdd8975118050d1db7ab4582494e0f0c5..94c8b9f7e752e7d0b57455d3adb1cfc03579a00c 100644
--- a/Source/core/html/HTMLAppletElement.cpp
+++ b/Source/core/html/HTMLAppletElement.cpp
@@ -27,10 +27,13 @@
#include "HTMLNames.h"
#include "core/html/HTMLParamElement.h"
#include "core/loader/FrameLoader.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/page/ContentSecurityPolicy.h"
#include "core/page/Frame.h"
#include "core/page/Settings.h"
#include "core/platform/Widget.h"
#include "core/rendering/RenderApplet.h"
+#include "weborigin/SecurityOrigin.h"
namespace WebCore {
@@ -98,6 +101,9 @@ void HTMLAppletElement::updateWidget(PluginCreationOption)
RenderEmbeddedObject* renderer = renderEmbeddedObject();
+ Frame* frame = document()->frame();
+ ASSERT(frame);
+
LayoutUnit contentWidth = renderer->style()->width().isFixed() ? LayoutUnit(renderer->style()->width().value()) :
renderer->width() - renderer->borderAndPaddingWidth();
LayoutUnit contentHeight = renderer->style()->height().isFixed() ? LayoutUnit(renderer->style()->height().value()) :
@@ -111,6 +117,15 @@ void HTMLAppletElement::updateWidget(PluginCreationOption)
const AtomicString& codeBase = getAttribute(codebaseAttr);
if (!codeBase.isNull()) {
+ KURL codeBaseURL = document()->completeURL(codeBase);
+ if (!document()->securityOrigin()->canDisplay(codeBaseURL)) {
+ FrameLoader::reportLocalLoadFailed(frame, codeBaseURL.string());
+ return;
+ }
+ const char javaAppletMimeType[] = "application/x-java-applet";
+ if (!document()->contentSecurityPolicy()->allowObjectFromSource(codeBaseURL)
+ || !document()->contentSecurityPolicy()->allowPluginType(javaAppletMimeType, javaAppletMimeType, codeBaseURL))
+ return;
paramNames.append("codeBase");
paramValues.append(codeBase.string());
}
@@ -128,7 +143,8 @@ void HTMLAppletElement::updateWidget(PluginCreationOption)
}
paramNames.append("baseURL");
- paramValues.append(document()->baseURL().string());
+ KURL baseURL = document()->baseURL();
+ paramValues.append(baseURL.string());
const AtomicString& mayScript = getAttribute(mayscriptAttr);
if (!mayScript.isNull()) {
@@ -148,10 +164,17 @@ void HTMLAppletElement::updateWidget(PluginCreationOption)
paramValues.append(param->value());
}
- Frame* frame = document()->frame();
- ASSERT(frame);
+ RefPtr<Widget> widget;
+ if (frame->loader()->allowPlugins(AboutToInstantiatePlugin))
+ widget = frame->loader()->client()->createJavaAppletWidget(roundedIntSize(LayoutSize(contentWidth, contentHeight)), this, baseURL, paramNames, paramValues);
- renderer->setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(roundedIntSize(LayoutSize(contentWidth, contentHeight)), this, paramNames, paramValues));
+ if (!widget) {
+ if (!renderer->showsUnavailablePluginIndicator())
+ renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginMissing);
+ return;
+ }
+ frame->loader()->setContainsPlugins();
+ renderer->setWidget(widget);
}
bool HTMLAppletElement::canEmbedJava() const
« no previous file with comments | « no previous file | Source/core/loader/SubframeLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698