Title: [129998] branches/safari-534.58-branch/Source
Revision
129998
Author
aes...@apple.com
Date
2012-09-30 16:31:28 -0700 (Sun, 30 Sep 2012)

Log Message

Merge r123907.

    2012-07-27  Anders Carlsson  <ander...@apple.com>

Show the unavailable plug-in indicator for Java applets as well
https://bugs.webkit.org/show_bug.cgi?id=92521

Reviewed by Sam Weinig.

Source/WebCore: 

Now that <applet> behaves more like <embed> and <object>, make sure that we show the unavailable plug-in indicator
and call the correct error callbacks if we fail to instantiate the plug-in.

* WebCore.exp.in:
Export a symbol needed by WebKit2.

* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::HTMLAppletElement):
Set the correct service type.

* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::createJavaAppletWidget):
Enable the unavailable plug-in indicator if we fail to create the java applet widget.

Source/WebKit/mac: 

Check if the Java plug-in is blocked before trying to instantiate it.

* WebCoreSupport/WebFrameLoaderClient.mm:

Source/WebKit2: 

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::unavailablePluginButtonClicked):
This can now be called on applet elements as well.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::createJavaAppletWidget):
Get the MIME type from the applet element.

Modified Paths

Diff

Modified: branches/safari-534.58-branch/Source/WebCore/ChangeLog (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebCore/ChangeLog	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebCore/ChangeLog	2012-09-30 23:31:28 UTC (rev 129998)
@@ -1,3 +1,28 @@
+2012-09-30  Andy Estes  <aes...@apple.com>
+
+        Merge r123907.
+
+    2012-07-27  Anders Carlsson  <ander...@apple.com>
+
+        Show the unavailable plug-in indicator for Java applets as well
+        https://bugs.webkit.org/show_bug.cgi?id=92521
+
+        Reviewed by Sam Weinig.
+
+        Now that <applet> behaves more like <embed> and <object>, make sure that we show the unavailable plug-in indicator
+        and call the correct error callbacks if we fail to instantiate the plug-in.
+
+        * WebCore.exp.in:
+        Export a symbol needed by WebKit2.
+
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::HTMLAppletElement):
+        Set the correct service type.
+
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::createJavaAppletWidget):
+        Enable the unavailable plug-in indicator if we fail to create the java applet widget.
+
 2012-09-28  Andy Estes  <aes...@apple.com>
 
         Merge r123811.

Modified: branches/safari-534.58-branch/Source/WebCore/WebCore.exp.in (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebCore/WebCore.exp.in	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebCore/WebCore.exp.in	2012-09-30 23:31:28 UTC (rev 129998)
@@ -1027,6 +1027,7 @@
 __ZN7WebCore9HTMLNames8hrefAttrE
 __ZN7WebCore9HTMLNames8inputTagE
 __ZN7WebCore9HTMLNames8videoTagE
+__ZN7WebCore9HTMLNames9appletTagE
 __ZN7WebCore9HTMLNames9iframeTagE
 __ZN7WebCore9HTMLNames9objectTagE
 __ZN7WebCore9HTMLNames9scriptTagE

Modified: branches/safari-534.58-branch/Source/WebCore/html/HTMLAppletElement.cpp (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebCore/html/HTMLAppletElement.cpp	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebCore/html/HTMLAppletElement.cpp	2012-09-30 23:31:28 UTC (rev 129998)
@@ -43,6 +43,8 @@
     : HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages)
 {
     ASSERT(hasTagName(appletTag));
+
+    m_serviceType = "application/x-java-applet";
 }
 
 PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)

Modified: branches/safari-534.58-branch/Source/WebCore/loader/SubframeLoader.cpp (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebCore/loader/SubframeLoader.cpp	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebCore/loader/SubframeLoader.cpp	2012-09-30 23:31:28 UTC (rev 129998)
@@ -220,8 +220,14 @@
     RefPtr<Widget> widget;
     if (allowPlugins(AboutToInstantiatePlugin))
         widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues);
-    if (!widget)
+
+    if (!widget) {
+        RenderEmbeddedObject* renderer = element->renderEmbeddedObject();
+
+        if (!renderer->showsUnavailablePluginIndicator())
+            renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginMissing);
         return 0;
+    }
 
     m_containsPlugins = true;
     return widget;

Modified: branches/safari-534.58-branch/Source/WebKit/mac/ChangeLog (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebKit/mac/ChangeLog	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebKit/mac/ChangeLog	2012-09-30 23:31:28 UTC (rev 129998)
@@ -1,3 +1,18 @@
+2012-09-30  Andy Estes  <aes...@apple.com>
+
+        Merge r123907.
+
+    2012-07-27  Anders Carlsson  <ander...@apple.com>
+
+        Show the unavailable plug-in indicator for Java applets as well
+        https://bugs.webkit.org/show_bug.cgi?id=92521
+
+        Reviewed by Sam Weinig.
+
+        Check if the Java plug-in is blocked before trying to instantiate it.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+
 2012-08-21  Andy Estes  <aes...@apple.com>
 
         Merge r119543.

Modified: branches/safari-534.58-branch/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2012-09-30 23:31:28 UTC (rev 129998)
@@ -1827,47 +1827,55 @@
 
     WebBasePluginPackage *pluginPackage = [webView _pluginForMIMEType:MIMEType];
 
+    int errorCode = WebKitErrorJavaUnavailable;
+
     if (pluginPackage) {
-        if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) {
-            // For some reason, the Java plug-in requires that we pass the dimension of the plug-in as attributes.
-            NSMutableArray *names = kit(paramNames);
-            NSMutableArray *values = kit(paramValues);
-            if (parameterValue(paramNames, paramValues, "width").isNull()) {
-                [names addObject:@"width"];
-                [values addObject:[NSString stringWithFormat:@"%d", size.width()]];
+        if (!WKShouldBlockPlugin([pluginPackage bundleIdentifier], [pluginPackage bundleVersion])) {
+            if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) {
+                // For some reason, the Java plug-in requires that we pass the dimension of the plug-in as attributes.
+                NSMutableArray *names = kit(paramNames);
+                NSMutableArray *values = kit(paramValues);
+                if (parameterValue(paramNames, paramValues, "width").isNull()) {
+                    [names addObject:@"width"];
+                    [values addObject:[NSString stringWithFormat:@"%d", size.width()]];
+                }
+                if (parameterValue(paramNames, paramValues, "height").isNull()) {
+                    [names addObject:@"height"];
+                    [values addObject:[NSString stringWithFormat:@"%d", size.height()]];
+                }
+                view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO);
+                if (view)
+                    return adoptRef(new PluginWidget(view));
             }
-            if (parameterValue(paramNames, paramValues, "height").isNull()) {
-                [names addObject:@"height"];
-                [values addObject:[NSString stringWithFormat:@"%d", size.height()]];
+    #if ENABLE(NETSCAPE_PLUGIN_API)
+            else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) {
+                view = [[[NETSCAPE_PLUGIN_VIEW alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height())
+                    pluginPackage:(WebNetscapePluginPackage *)pluginPackage
+                    URL:nil
+                    baseURL:baseURL
+                    MIMEType:MIMEType
+                    attributeKeys:kit(paramNames)
+                    attributeValues:kit(paramValues)
+                    loadManually:NO
+                    element:element] autorelease];
+                if (view)
+                    return adoptRef(new NetscapePluginWidget(static_cast<WebBaseNetscapePluginView *>(view)));
+            } else {
+                ASSERT_NOT_REACHED();
             }
-            view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO);
-            if (view)
-                return adoptRef(new PluginWidget(view));
-        } 
-#if ENABLE(NETSCAPE_PLUGIN_API)
-        else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) {
-            view = [[[NETSCAPE_PLUGIN_VIEW alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height())
-                pluginPackage:(WebNetscapePluginPackage *)pluginPackage
-                URL:nil
-                baseURL:baseURL
-                MIMEType:MIMEType
-                attributeKeys:kit(paramNames)
-                attributeValues:kit(paramValues)
-                loadManually:NO
-                element:element] autorelease];
-            if (view)
-                return adoptRef(new NetscapePluginWidget(static_cast<WebBaseNetscapePluginView *>(view)));
+    #endif
         } else {
-            ASSERT_NOT_REACHED();
+            errorCode = WebKitErrorBlockedPlugInVersion;
+            if (element->renderer()->isEmbeddedObject())
+                toRenderEmbeddedObject(element->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
         }
-#endif
     }
 
     if (!view) {
         WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(getWebView(m_webFrame.get()));
         if (implementations->plugInFailedWithErrorFunc) {
             NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil;
-            NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType];
+            NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType];
             CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView],
                                      @selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]);
             [error release];

Modified: branches/safari-534.58-branch/Source/WebKit2/ChangeLog (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebKit2/ChangeLog	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebKit2/ChangeLog	2012-09-30 23:31:28 UTC (rev 129998)
@@ -1,3 +1,22 @@
+2012-09-30  Andy Estes  <aes...@apple.com>
+
+        Merge r123907.
+
+    2012-07-27  Anders Carlsson  <ander...@apple.com>
+
+        Show the unavailable plug-in indicator for Java applets as well
+        https://bugs.webkit.org/show_bug.cgi?id=92521
+
+        Reviewed by Sam Weinig.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::unavailablePluginButtonClicked):
+        This can now be called on applet elements as well.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::createJavaAppletWidget):
+        Get the MIME type from the applet element.
+
 2012-08-21  Andy Estes  <aes...@apple.com>
 
         Merge r117634.

Modified: branches/safari-534.58-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-09-30 23:31:28 UTC (rev 129998)
@@ -479,7 +479,7 @@
     
 void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
-    ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag));
+    ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag));
     ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion);
 
     HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element);

Modified: branches/safari-534.58-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (129997 => 129998)


--- branches/safari-534.58-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-09-30 22:51:54 UTC (rev 129997)
+++ branches/safari-534.58-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-09-30 23:31:28 UTC (rev 129998)
@@ -1287,11 +1287,10 @@
 
 PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues)
 {
-    const String mimeType = "application/x-java-applet";
-    RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, mimeType, false);
+    RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, appletElement->serviceType(), false);
     if (!plugin) {
         if (WebPage* webPage = m_frame->page())
-            webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(mimeType));
+            webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(appletElement->serviceType()));
     }
     return plugin.release();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to