Don't snapshot plug-ins that come from the same host as the page
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2013 21:48:11 +0000 (21:48 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2013 21:48:11 +0000 (21:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117969
<rdar://problem/12885400>

Reviewed by Tim Horton.

If a page is serving plug-in content directly, then that content
is typically very important to the page. For example, embedding
a video or audio player. In this case, don't snapshot the plug-ins.

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Add a test
that compares the plug-in's URL against the main page's URL and don't snapshot
if they are the same.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151971 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLPlugInImageElement.cpp

index 931e17c..6ba5b1d 100644 (file)
@@ -1,3 +1,20 @@
+2013-06-25  Dean Jackson  <dino@apple.com>
+
+        Don't snapshot plug-ins that come from the same host as the page
+        https://bugs.webkit.org/show_bug.cgi?id=117969
+        <rdar://problem/12885400>
+
+        Reviewed by Tim Horton.
+
+        If a page is serving plug-in content directly, then that content
+        is typically very important to the page. For example, embedding
+        a video or audio player. In this case, don't snapshot the plug-ins.
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Add a test
+        that compares the plug-in's URL against the main page's URL and don't snapshot
+        if they are the same.
+
 2013-06-25  Alex Christensen  <achristensen@apple.com>
 
         Added PLATFORM(WIN) to many places where it was missing for compiling WebGL for Windows.
index fa838e1..0162a65 100644 (file)
@@ -649,6 +649,12 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
         return;
     }
 
+    if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(m_loadedUrl.protocol()) && !m_loadedUrl.host().isEmpty() && m_loadedUrl.host() == document()->page()->mainFrame()->document()->baseURL().host()) {
+        LOG(Plugins, "%p Plug-in is served from page's domain, set to play", this);
+        m_snapshotDecision = NeverSnapshot;
+        return;
+    }
+
     RenderBox* renderEmbeddedObject = toRenderBox(renderer());
     Length styleWidth = renderEmbeddedObject->style()->width();
     Length styleHeight = renderEmbeddedObject->style()->height();