Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (145318 => 145319)
--- trunk/Source/WebKit/chromium/ChangeLog 2013-03-09 16:34:13 UTC (rev 145318)
+++ trunk/Source/WebKit/chromium/ChangeLog 2013-03-09 16:54:44 UTC (rev 145319)
@@ -1,3 +1,27 @@
+2013-03-09 David Dorwin <[email protected]>
+
+ [chromium] Set the Helper Plugin's URL to that of the host document.
+ https://bugs.webkit.org/show_bug.cgi?id=111913
+
+ This allows content settings, etc. to be based on the document hosting
+ the element that requested the Helper Plugin.
+
+ Reviewed by Adam Barth.
+
+ * src/WebHelperPluginImpl.cpp:
+ (WebKit::writeDocument):
+ (WebKit::WebHelperPluginImpl::initialize):
+ (WebKit::WebHelperPluginImpl::initializePage):
+ * src/WebHelperPluginImpl.h:
+ (WebKit):
+ (WebHelperPluginImpl):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::createHelperPlugin):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::createHelperPlugin):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
2013-03-08 Sheriff Bot <[email protected]>
Unreviewed. Rolled Chromium DEPS to r187037. Requested by
Modified: trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp (145318 => 145319)
--- trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp 2013-03-09 16:34:13 UTC (rev 145318)
+++ trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp 2013-03-09 16:54:44 UTC (rev 145319)
@@ -40,6 +40,7 @@
#include "Page.h"
#include "PageWidgetDelegate.h"
#include "Settings.h"
+#include "WebDocument.h"
#include "WebFrameImpl.h"
#include "WebPlugin.h"
#include "WebPluginContainerImpl.h"
@@ -59,11 +60,15 @@
writer.addData(str8.data(), str8.length());
}
-void writeDocument(WebCore::DocumentWriter& writer, const String& pluginType)
+void writeDocument(const String& pluginType, const WebDocument& hostDocument, WebCore::DocumentWriter& writer)
{
+ // Give the new document the same URL as the hose document so that content
+ // settings and other decisions can be made based on the correct origin.
+ const WebURL& url = ""
+
writer.setMIMEType("text/html");
writer.setEncoding("UTF-8", false);
- writer.begin();
+ writer.begin(url);
addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n", writer);
String objectTag = "<object type=\"" + pluginType + "\"></object>";
@@ -115,12 +120,12 @@
ASSERT(!m_page);
}
-bool WebHelperPluginImpl::initialize(WebViewImpl* webView, const String& pluginType)
+bool WebHelperPluginImpl::initialize(const String& pluginType, const WebDocument& hostDocument, WebViewImpl* webView)
{
ASSERT(webView);
m_webView = webView;
- return initializePage(webView, pluginType);
+ return initializePage(pluginType, hostDocument);
}
void WebHelperPluginImpl::closeHelperPlugin()
@@ -175,7 +180,7 @@
return plugin;
}
-bool WebHelperPluginImpl::initializePage(WebKit::WebViewImpl* webView, const String& pluginType)
+bool WebHelperPluginImpl::initializePage(const String& pluginType, const WebDocument& hostDocument)
{
Page::PageClients pageClients;
fillWithEmptyClients(pageClients);
@@ -190,7 +195,7 @@
unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
- webView->client()->initializeHelperPluginWebFrame(this);
+ m_webView->client()->initializeHelperPluginWebFrame(this);
// The page's main frame was set in initializeFrame() as a result of the above call.
Frame* frame = m_page->mainFrame();
@@ -199,7 +204,7 @@
// No need to set a size or make it not transparent.
DocumentWriter* writer = frame->loader()->activeDocumentLoader()->writer();
- writeDocument(*writer, pluginType);
+ writeDocument(pluginType, hostDocument, *writer);
return true;
}
Modified: trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.h (145318 => 145319)
--- trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.h 2013-03-09 16:34:13 UTC (rev 145318)
+++ trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.h 2013-03-09 16:54:44 UTC (rev 145319)
@@ -42,6 +42,8 @@
namespace WebKit {
class HelperPluginChromeClient;
+class WebDocument;
+class WebFrame;
class WebViewImpl;
class WebWidgetClient;
@@ -54,7 +56,7 @@
public:
virtual ~WebHelperPluginImpl();
- bool initialize(WebViewImpl*, const String& pluginType);
+ bool initialize(const String& pluginType, const WebDocument& hostDocument, WebViewImpl*);
void closeHelperPlugin();
// WebHelperPlugin methods:
@@ -63,7 +65,7 @@
private:
explicit WebHelperPluginImpl(WebWidgetClient*);
- bool initializePage(WebKit::WebViewImpl*, const String& pluginType);
+ bool initializePage(const String& pluginType, const WebDocument& hostDocument);
void destroyPage();
// WebWidget methods:
Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (145318 => 145319)
--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2013-03-09 16:34:13 UTC (rev 145318)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2013-03-09 16:54:44 UTC (rev 145319)
@@ -23,6 +23,7 @@
#include "TimeRanges.h"
#include "UUID.h"
#include "WebAudioSourceProvider.h"
+#include "WebDocument.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
#include "WebHelperPluginImpl.h"
@@ -406,8 +407,9 @@
WebPlugin* WebMediaPlayerClientImpl::createHelperPlugin(const WebString& pluginType, WebFrame* frame)
{
ASSERT(!m_helperPlugin);
+
WebViewImpl* webView = static_cast<WebViewImpl*>(frame->view());
- m_helperPlugin = webView->createHelperPlugin(pluginType);
+ m_helperPlugin = webView->createHelperPlugin(pluginType, frame->document());
if (!m_helperPlugin)
return 0;
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (145318 => 145319)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2013-03-09 16:34:13 UTC (rev 145318)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2013-03-09 16:54:44 UTC (rev 145319)
@@ -1593,13 +1593,13 @@
}
}
-WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType)
+WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, const WebDocument& hostDocument)
{
WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin);
ASSERT(popupWidget);
WebHelperPluginImpl* helperPlugin = static_cast<WebHelperPluginImpl*>(popupWidget);
- if (!helperPlugin->initialize(this, pluginType)) {
+ if (!helperPlugin->initialize(pluginType, hostDocument, this)) {
helperPlugin->closeHelperPlugin();
helperPlugin = 0;
}
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (145318 => 145319)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2013-03-09 16:34:13 UTC (rev 145318)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2013-03-09 16:54:44 UTC (rev 145319)
@@ -104,6 +104,7 @@
class WebCompositorImpl;
class WebDevToolsAgentClient;
class WebDevToolsAgentPrivate;
+class WebDocument;
class WebFrameImpl;
class WebGestureEvent;
class WebHelperPluginImpl;
@@ -513,7 +514,8 @@
void hideAutofillPopup();
- WebHelperPluginImpl* createHelperPlugin(const String& pluginType);
+ // Creates a Helper Plugin of |pluginType| for |hostDocument|.
+ WebHelperPluginImpl* createHelperPlugin(const String& pluginType, const WebDocument& hostDocument);
// Returns the input event we're currently processing. This is used in some
// cases where the WebCore DOM event doesn't have the information we need.