diff options
| author | battre@chromium.org <battre@chromium.org> | 2015-08-26 08:44:03 +0000 |
|---|---|---|
| committer | battre@chromium.org <battre@chromium.org> | 2015-08-26 08:44:03 +0000 |
| commit | de50230291178cd315636d6a16696e28386a54f1 (patch) | |
| tree | 66ad29acd32d67d4a12761a9b61cc5c12a4faaea | |
| parent | 57bc2e663cb44f6380adf1aff3d32b92cfaa80be (diff) | |
| download | chromium_src-de50230291178cd315636d6a16696e28386a54f1.zip chromium_src-de50230291178cd315636d6a16696e28386a54f1.tar.gz chromium_src-de50230291178cd315636d6a16696e28386a54f1.tar.bz2 | |
Revert of Remove javaEnabled setting. (patchset #1 id:1 of https://codereview.chromium.org/1306403003/ )
Reason for revert:
Reverting to see whether this fixes the compilation.
Original issue's description:
> Remove javaEnabled setting.
>
> As of M45, NPAPI support is (almost) completely gone, so Java will never
> be supported anyway.
>
> BUG=none
>
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=201211
TBR=haraken@chromium.org,dcheng@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=none
Review URL: https://codereview.chromium.org/1318703002
git-svn-id: svn://svn.chromium.org/blink/trunk@201217 bbb929c8-8fbe-4397-9dbb-9b2b20218538
11 files changed, 49 insertions, 4 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder-explicit-size.html b/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder-explicit-size.html index 6a2ff70..465ce24 100644 --- a/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder-explicit-size.html +++ b/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder-explicit-size.html @@ -18,6 +18,8 @@ applet, embed, object { display: block; margin: 10px; } </template> <script> +internals.settings.setJavaEnabled(true); + var templateContent = document.getElementById('placeholder-template').content; Array.prototype.forEach.call(document.querySelectorAll("applet, embed, object"), function(plugin) { internals.forcePluginPlaceholder(plugin, templateContent); diff --git a/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder.html b/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder.html index 823bed1..fd59c04 100644 --- a/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder.html +++ b/third_party/WebKit/LayoutTests/fast/plugins/plugin-placeholder.html @@ -18,6 +18,8 @@ applet, embed, object { display: block; margin: 10px; } </template> <script> +internals.settings.setJavaEnabled(true); + var templateContent = document.getElementById('placeholder-template').content; Array.prototype.forEach.call(document.querySelectorAll("applet, embed, object"), function(plugin) { internals.forcePluginPlaceholder(plugin, templateContent); diff --git a/third_party/WebKit/Source/core/frame/Settings.in b/third_party/WebKit/Source/core/frame/Settings.in index 8fe8b25..b21450a 100644 --- a/third_party/WebKit/Source/core/frame/Settings.in +++ b/third_party/WebKit/Source/core/frame/Settings.in @@ -266,6 +266,7 @@ backgroundHtmlParserPendingTokenLimit type=unsigned, initial=0 # be loaded later. doHtmlPreloadScanning initial=true +javaEnabled initial=false pluginsEnabled initial=false viewportEnabled initial=false, invalidate=ViewportDescription diff --git a/third_party/WebKit/Source/core/html/HTMLAppletElement.cpp b/third_party/WebKit/Source/core/html/HTMLAppletElement.cpp index 7d63cb4..af9de0c 100644 --- a/third_party/WebKit/Source/core/html/HTMLAppletElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLAppletElement.cpp @@ -92,12 +92,20 @@ bool HTMLAppletElement::layoutObjectIsNeeded(const ComputedStyle& style) LayoutObject* HTMLAppletElement::createLayoutObject(const ComputedStyle& style) { - return LayoutObject::createObject(this, style); + if (!canEmbedJava() || openShadowRoot()) + return LayoutObject::createObject(this, style); + + if (usePlaceholderContent()) + return new LayoutBlockFlow(this); + + return new LayoutApplet(this); } LayoutPart* HTMLAppletElement::layoutPartForJSBindings() const { - return nullptr; + if (!canEmbedJava()) + return nullptr; + return HTMLPlugInElement::layoutPartForJSBindings(); } LayoutPart* HTMLAppletElement::existingLayoutPart() const @@ -201,6 +209,21 @@ void HTMLAppletElement::updateWidgetInternal() } } +bool HTMLAppletElement::canEmbedJava() const +{ + if (document().isSandboxed(SandboxPlugins)) + return false; + + Settings* settings = document().settings(); + if (!settings) + return false; + + if (!settings->javaEnabled()) + return false; + + return true; +} + bool HTMLAppletElement::canEmbedURL(const KURL& url) const { if (!document().securityOrigin()->canDisplay(url)) { diff --git a/third_party/WebKit/Source/core/html/HTMLAppletElement.h b/third_party/WebKit/Source/core/html/HTMLAppletElement.h index 397aa54..296ab31 100644 --- a/third_party/WebKit/Source/core/html/HTMLAppletElement.h +++ b/third_party/WebKit/Source/core/html/HTMLAppletElement.h @@ -50,6 +50,7 @@ private: LayoutPart* existingLayoutPart() const override; void updateWidgetInternal() override; + bool canEmbedJava() const; bool canEmbedURL(const KURL&) const; bool shouldRegisterAsNamedItem() const override { return true; } diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp index d102832..cde57a8 100644 --- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp @@ -619,7 +619,7 @@ bool HTMLPlugInElement::pluginIsLoadable(const KURL& url, const String& mimeType if (!settings) return false; - if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) + if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType) && !settings->javaEnabled()) return false; if (document().isSandboxed(SandboxPlugins)) diff --git a/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.cpp b/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.cpp index c86cd06..bf48d9c 100644 --- a/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.cpp +++ b/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.cpp @@ -60,7 +60,7 @@ DOMMimeTypeArray* NavigatorPlugins::mimeTypes(Navigator& navigator) // static bool NavigatorPlugins::javaEnabled(Navigator& navigator) { - return false; + return NavigatorPlugins::from(navigator).javaEnabled(navigator.frame()); } DOMPluginArray* NavigatorPlugins::plugins(LocalFrame* frame) const @@ -77,6 +77,14 @@ DOMMimeTypeArray* NavigatorPlugins::mimeTypes(LocalFrame* frame) const return m_mimeTypes.get(); } +bool NavigatorPlugins::javaEnabled(LocalFrame* frame) const +{ + if (!frame || !frame->settings()) + return false; + + return frame->settings()->javaEnabled(); +} + DEFINE_TRACE(NavigatorPlugins) { visitor->trace(m_plugins); diff --git a/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.h b/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.h index e91cd16..635d096 100644 --- a/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.h +++ b/third_party/WebKit/Source/modules/plugins/NavigatorPlugins.h @@ -36,6 +36,7 @@ private: DOMPluginArray* plugins(LocalFrame*) const; DOMMimeTypeArray* mimeTypes(LocalFrame*) const; + bool javaEnabled(LocalFrame*) const; mutable Member<DOMPluginArray> m_plugins; mutable Member<DOMMimeTypeArray> m_mimeTypes; diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.cpp b/third_party/WebKit/Source/web/WebSettingsImpl.cpp index 92b11bb..8de095d 100644 --- a/third_party/WebKit/Source/web/WebSettingsImpl.cpp +++ b/third_party/WebKit/Source/web/WebSettingsImpl.cpp @@ -344,6 +344,11 @@ void WebSettingsImpl::setTextAreasAreResizable(bool areResizable) m_settings->setTextAreasAreResizable(areResizable); } +void WebSettingsImpl::setJavaEnabled(bool enabled) +{ + m_settings->setJavaEnabled(enabled); +} + void WebSettingsImpl::setAllowScriptsToCloseWindows(bool allow) { m_settings->setAllowScriptsToCloseWindows(allow); diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.h b/third_party/WebKit/Source/web/WebSettingsImpl.h index 45f5895..781088d 100644 --- a/third_party/WebKit/Source/web/WebSettingsImpl.h +++ b/third_party/WebKit/Source/web/WebSettingsImpl.h @@ -106,6 +106,7 @@ public: void setImagesEnabled(bool) override; void setInlineTextBoxAccessibilityEnabled(bool) override; void setInvertViewportScrollOrder(bool) override; + void setJavaEnabled(bool) override; void setJavaScriptCanAccessClipboard(bool) override; void setJavaScriptCanOpenWindowsAutomatically(bool) override; void setJavaScriptEnabled(bool) override; diff --git a/third_party/WebKit/public/web/WebSettings.h b/third_party/WebKit/public/web/WebSettings.h index ec7bc3f..da2fd18 100644 --- a/third_party/WebKit/public/web/WebSettings.h +++ b/third_party/WebKit/public/web/WebSettings.h @@ -181,6 +181,7 @@ public: virtual void setImagesEnabled(bool) = 0; virtual void setInlineTextBoxAccessibilityEnabled(bool) = 0; virtual void setInvertViewportScrollOrder(bool) = 0; + virtual void setJavaEnabled(bool) = 0; virtual void setJavaScriptCanAccessClipboard(bool) = 0; virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; virtual void setJavaScriptEnabled(bool) = 0; |
