Title: [194367] trunk/Source
Revision
194367
Author
[email protected]
Date
2015-12-22 11:37:50 -0800 (Tue, 22 Dec 2015)

Log Message

Allow _javascript_ to iterate over plugins for local SecurityOrigins
https://bugs.webkit.org/show_bug.cgi?id=152489

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Instead of calling 'isLocalFile' on the URL, we check the Document's SecurityOrigin. If
no origin exists, we construct a SecurityOrigin from the URL, and check whether it
satisfies 'isLocal'.

* page/Page.cpp:
(WebCore::Page::showAllPlugins): Revised to use SecurityOrigin.

Source/WebKit2:

The 'getWebVisiblePluginInfo' is filtering plugins, even when we want to list
all plugins. To avoid this, we check the Document's SecurityOrigin. If no such
origin exists, we construct a SecurityOrigin from the URL.
        
If the relevant SecurityOrigin satsifies 'isLocal', we show all plugins.

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getWebVisiblePluginInfo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (194366 => 194367)


--- trunk/Source/WebCore/ChangeLog	2015-12-22 18:20:49 UTC (rev 194366)
+++ trunk/Source/WebCore/ChangeLog	2015-12-22 19:37:50 UTC (rev 194367)
@@ -1,3 +1,17 @@
+2015-12-22  Brent Fulgham  <[email protected]>
+
+        Allow _javascript_ to iterate over plugins for local SecurityOrigins
+        https://bugs.webkit.org/show_bug.cgi?id=152489
+
+        Reviewed by Alexey Proskuryakov.
+
+        Instead of calling 'isLocalFile' on the URL, we check the Document's SecurityOrigin. If
+        no origin exists, we construct a SecurityOrigin from the URL, and check whether it
+        satisfies 'isLocal'.
+
+        * page/Page.cpp:
+        (WebCore::Page::showAllPlugins): Revised to use SecurityOrigin.
+
 2015-12-22  Michael Catanzaro  <[email protected]>
 
         [GTK] Everything broken in GTK+ 3.19

Modified: trunk/Source/WebCore/page/Page.cpp (194366 => 194367)


--- trunk/Source/WebCore/page/Page.cpp	2015-12-22 18:20:49 UTC (rev 194366)
+++ trunk/Source/WebCore/page/Page.cpp	2015-12-22 19:37:50 UTC (rev 194367)
@@ -524,7 +524,15 @@
 
 bool Page::showAllPlugins() const
 {
-    return m_showAllPlugins || mainFrame().loader().documentLoader()->url().isLocalFile();
+    if (m_showAllPlugins)
+        return true;
+
+    if (Document* document = mainFrame().document()) {
+        if (SecurityOrigin* securityOrigin = document->securityOrigin())
+            return securityOrigin->isLocal();
+    }
+
+    return false;
 }
 
 inline MediaCanStartListener* Page::takeAnyMediaCanStartListener()

Modified: trunk/Source/WebCore/page/SecurityOrigin.h (194366 => 194367)


--- trunk/Source/WebCore/page/SecurityOrigin.h	2015-12-22 18:20:49 UTC (rev 194366)
+++ trunk/Source/WebCore/page/SecurityOrigin.h	2015-12-22 19:37:50 UTC (rev 194367)
@@ -161,7 +161,7 @@
     // The local SecurityOrigin is the most privileged SecurityOrigin.
     // The local SecurityOrigin can script any document, navigate to local
     // resources, and can set arbitrary headers on XMLHttpRequests.
-    bool isLocal() const;
+    WEBCORE_EXPORT bool isLocal() const;
 
     // The origin is a globally unique identifier assigned when the Document is
     // created. http://www.whatwg.org/specs/web-apps/current-work/#sandboxOrigin

Modified: trunk/Source/WebKit2/ChangeLog (194366 => 194367)


--- trunk/Source/WebKit2/ChangeLog	2015-12-22 18:20:49 UTC (rev 194366)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-22 19:37:50 UTC (rev 194367)
@@ -1,3 +1,19 @@
+2015-12-22  Brent Fulgham  <[email protected]>
+
+        Allow _javascript_ to iterate over plugins for local SecurityOrigins
+        https://bugs.webkit.org/show_bug.cgi?id=152489
+
+        Reviewed by Alexey Proskuryakov.
+
+        The 'getWebVisiblePluginInfo' is filtering plugins, even when we want to list
+        all plugins. To avoid this, we check the Document's SecurityOrigin. If no such
+        origin exists, we construct a SecurityOrigin from the URL.
+        
+        If the relevant SecurityOrigin satsifies 'isLocal', we show all plugins.
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::getWebVisiblePluginInfo):
+
 2015-12-21  Hunseop Jeong  <[email protected]>
 
         [EFL] test_ewk2_context failed after r192808

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (194366 => 194367)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2015-12-22 18:20:49 UTC (rev 194366)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2015-12-22 19:37:50 UTC (rev 194367)
@@ -48,6 +48,7 @@
 #include "WebProcess.h"
 #include "WebProcessProxyMessages.h"
 #include <WebCore/Color.h>
+#include <WebCore/Document.h>
 #include <WebCore/DocumentLoader.h>
 #include <WebCore/IDBFactoryBackendInterface.h>
 #include <WebCore/LoaderStrategy.h>
@@ -189,6 +190,13 @@
     getPluginInfo(page, plugins);
 
 #if PLATFORM(MAC)
+    if (Document* document = page->mainFrame().document()) {
+        if (SecurityOrigin* securityOrigin = document->securityOrigin()) {
+            if (securityOrigin->isLocal())
+                return;
+        }
+    }
+    
     for (int32_t i = plugins.size() - 1; i >= 0; --i) {
         PluginInfo& info = plugins.at(i);
         PluginLoadClientPolicy clientPolicy = info.clientLoadPolicy;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to