Title: [124937] branches/safari-536.26-branch/Source/WebCore

Diff

Modified: branches/safari-536.26-branch/Source/WebCore/ChangeLog (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-07 23:30:07 UTC (rev 124937)
@@ -1,5 +1,45 @@
 2012-08-06  Lucas Forschler  <[email protected]>
 
+    Merge 123930
+
+    2012-07-27  Jer Noble  <[email protected]>
+
+            Add diagnostic logging for plugins-per-page.
+            https://bugs.webkit.org/show_bug.cgi?id=92538
+
+            Reviewed by Anders Carlsson.
+
+            Add some diagnostic logging for whether a page has seen a plugin, and 
+            whether a page has seen a plugin of a specific type.
+
+            Move the diagnostic logging out of the elemements themselves:
+            * html/HTMLEmbedElement.cpp:
+            (WebCore::HTMLEmbedElement::updateWidget):
+            * html/HTMLObjectElement.cpp:
+            (WebCore::HTMLObjectElement::updateWidget):
+
+            Instead, log when the plugin is requested, thereby catching plugins which are
+            rejected because, e.g., Java is disabled or not installed:
+            * loader/SubframeLoader.cpp:
+            (WebCore::logPluginRequest):
+            (WebCore::SubframeLoader::requestObject):
+            (WebCore::SubframeLoader::createJavaAppletWidget):
+
+            Add new diagnostic key values:
+            * page/DiagnosticLoggingKeys.cpp:
+            (WebCore::DiagnosticLoggingKeys::pageContainsPluginKey):
+            (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey):
+            * page/DiagnosticLoggingKeys.h:
+
+            Add a map of plugin types seen per-page for diagnostic purposes:
+            * page/Page.cpp:
+            (WebCore::Page::hasSeenAnyPlugin):
+            (WebCore::Page::hasSeenPlugin):
+            (WebCore::Page::sawPlugin):
+            * page/Page.h:
+
+2012-08-06  Lucas Forschler  <[email protected]>
+
     Merge 123907
 
     2012-07-27  Anders Carlsson  <[email protected]>

Modified: branches/safari-536.26-branch/Source/WebCore/html/HTMLEmbedElement.cpp (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/html/HTMLEmbedElement.cpp	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/html/HTMLEmbedElement.cpp	2012-08-07 23:30:07 UTC (rev 124937)
@@ -26,9 +26,6 @@
 
 #include "Attribute.h"
 #include "CSSPropertyNames.h"
-#include "Chrome.h"
-#include "ChromeClient.h"
-#include "DiagnosticLoggingKeys.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
 #include "HTMLDocument.h"
@@ -37,7 +34,6 @@
 #include "HTMLObjectElement.h"
 #include "HTMLParserIdioms.h"
 #include "MainResourceLoader.h"
-#include "Page.h"
 #include "PluginDocument.h"
 #include "RenderEmbeddedObject.h"
 #include "RenderImage.h"
@@ -178,10 +174,7 @@
 
     SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
     // FIXME: beforeLoad could have detached the renderer!  Just like in the <object> case above.
-    bool success = loader->requestObject(this, m_url, getNameAttribute(), m_serviceType, paramNames, paramValues);
-
-    if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
-        document()->page()->chrome()->client()->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), m_serviceType, DiagnosticLoggingKeys::noopKey());
+    loader->requestObject(this, m_url, getNameAttribute(), m_serviceType, paramNames, paramValues);
 }
 
 bool HTMLEmbedElement::rendererIsNeeded(const NodeRenderingContext& context)

Modified: branches/safari-536.26-branch/Source/WebCore/html/HTMLObjectElement.cpp (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/html/HTMLObjectElement.cpp	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/html/HTMLObjectElement.cpp	2012-08-07 23:30:07 UTC (rev 124937)
@@ -28,7 +28,6 @@
 #include "CSSValueKeywords.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
-#include "DiagnosticLoggingKeys.h"
 #include "EventNames.h"
 #include "ExceptionCode.h"
 #include "FormDataList.h"
@@ -319,9 +318,6 @@
     bool success = beforeLoadAllowedLoad && hasValidClassId() && loader->requestObject(this, url, getNameAttribute(), serviceType, paramNames, paramValues);
     if (!success && fallbackContent)
         renderFallbackContent();
-
-    if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
-        document()->page()->chrome()->client()->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), serviceType, DiagnosticLoggingKeys::noopKey());
 }
 
 bool HTMLObjectElement::rendererIsNeeded(const NodeRenderingContext& context)

Modified: branches/safari-536.26-branch/Source/WebCore/loader/SubframeLoader.cpp (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/loader/SubframeLoader.cpp	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/loader/SubframeLoader.cpp	2012-08-07 23:30:07 UTC (rev 124937)
@@ -33,7 +33,10 @@
 #include "config.h"
 #include "SubframeLoader.h"
 
+#include "Chrome.h"
+#include "ChromeClient.h"
 #include "ContentSecurityPolicy.h"
+#include "DiagnosticLoggingKeys.h"
 #include "Frame.h"
 #include "FrameLoaderClient.h"
 #include "HTMLAppletElement.h"
@@ -130,7 +133,24 @@
     ASSERT(ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag));
     return loadPlugin(ownerElement, url, mimeType, paramNames, paramValues, useFallback);
 }
- 
+
+static void logPluginRequest(Page* page, const String& mimeType, bool success)
+{
+    if (!page || !page->settings()->diagnosticLoggingEnabled())
+        return;
+    
+    ChromeClient* client = page->chrome()->client();
+    client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), mimeType, DiagnosticLoggingKeys::noopKey());
+    
+    if (!page->hasSeenAnyPlugin())
+        client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
+    
+    if (!page->hasSeenPlugin(mimeType))
+        client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), mimeType, DiagnosticLoggingKeys::noopKey());
+
+    page->sawPlugin(mimeType);
+}
+
 bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const String& url, const AtomicString& frameName, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
 {
     if (url.isEmpty() && mimeType.isEmpty())
@@ -147,8 +167,11 @@
         completedURL = completeURL(url);
 
     bool useFallback;
-    if (shouldUsePlugin(completedURL, mimeType, ownerElement->shouldPreferPlugInsForImages(), renderer->hasFallbackContent(), useFallback))
-        return requestPlugin(ownerElement, completedURL, mimeType, paramNames, paramValues, useFallback);
+    if (shouldUsePlugin(completedURL, mimeType, ownerElement->shouldPreferPlugInsForImages(), renderer->hasFallbackContent(), useFallback)) {
+        bool success = requestPlugin(ownerElement, completedURL, mimeType, paramNames, paramValues, useFallback);
+        logPluginRequest(document()->page(), mimeType, success);
+        return success;
+    }
 
     // If the plug-in element already contains a subframe, loadOrRedirectSubframe will re-use it. Otherwise,
     // it will create a new frame and set it as the RenderPart's widget, causing what was previously 
@@ -230,6 +253,8 @@
     if (allowPlugins(AboutToInstantiatePlugin))
         widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues);
 
+    logPluginRequest(document()->page(), element->serviceType(), widget);
+
     if (!widget) {
         RenderEmbeddedObject* renderer = element->renderEmbeddedObject();
 

Modified: branches/safari-536.26-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2012-08-07 23:30:07 UTC (rev 124937)
@@ -52,6 +52,18 @@
     return key;
 }
 
+const String& DiagnosticLoggingKeys::pageContainsPluginKey()
+{
+    DEFINE_STATIC_LOCAL(const String, key, ("pageContainsPlugin"));
+    return key;
+}
+
+const String& DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey()
+{
+    DEFINE_STATIC_LOCAL(const String, key, ("pageContainsAtLeastOnePlugin"));
+    return key;
+}
+
 const String& DiagnosticLoggingKeys::passKey()
 {
     DEFINE_STATIC_LOCAL(const String, key, ("pass"));

Modified: branches/safari-536.26-branch/Source/WebCore/page/DiagnosticLoggingKeys.h (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/page/DiagnosticLoggingKeys.h	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/page/DiagnosticLoggingKeys.h	2012-08-07 23:30:07 UTC (rev 124937)
@@ -37,6 +37,8 @@
     static const String& mediaLoadingFailedKey();
     static const String& pluginLoadedKey();
     static const String& pluginLoadingFailedKey();
+    static const String& pageContainsPluginKey();
+    static const String& pageContainsAtLeastOnePluginKey();
     
     // Success keys
     static const String& passKey();

Modified: branches/safari-536.26-branch/Source/WebCore/page/Page.cpp (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/page/Page.cpp	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/page/Page.cpp	2012-08-07 23:30:07 UTC (rev 124937)
@@ -1152,6 +1152,21 @@
         frame->resumeActiveDOMObjectsAndAnimations();
 }
 
+bool Page::hasSeenAnyPlugin() const
+{
+    return !m_seenPlugins.isEmpty();
+}
+
+bool Page::hasSeenPlugin(const String& serviceType) const
+{
+    return m_seenPlugins.contains(serviceType);
+}
+
+void Page::sawPlugin(const String& serviceType)
+{
+    m_seenPlugins.add(serviceType);
+}
+
 Page::PageClients::PageClients()
     : alternativeTextClient(0)
     , chromeClient(0)

Modified: branches/safari-536.26-branch/Source/WebCore/page/Page.h (124936 => 124937)


--- branches/safari-536.26-branch/Source/WebCore/page/Page.h	2012-08-07 23:24:14 UTC (rev 124936)
+++ branches/safari-536.26-branch/Source/WebCore/page/Page.h	2012-08-07 23:30:07 UTC (rev 124937)
@@ -351,6 +351,10 @@
 
         AlternativeTextClient* alternativeTextClient() const { return m_alternativeTextClient; }
 
+        bool hasSeenPlugin(const String& serviceType) const;
+        bool hasSeenAnyPlugin() const;
+        void sawPlugin(const String& serviceType);
+
     private:
         void initGroup();
 
@@ -454,6 +458,8 @@
         AlternativeTextClient* m_alternativeTextClient;
 
         bool m_scriptedAnimationsSuspended;
+
+        HashSet<String> m_seenPlugins;
     };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to