https://bugs.webkit.org/show_bug.cgi?id=83805
<rdar://problem/
11238748>
Reviewed by Simon Fraser.
When a page with a full-frame plug-in is restored from the page cache, it needs to re-fetch the plug-in stream.
Fix this by breaking the assumption that a plug-in will always get its data from WebCore if it's a full-frame plug-in;
instead it only get its data from WebCore if it's a full-frame plug-in that's not being restored from the page cache.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::NetscapePlugin):
Rename m_loadManually to m_shouldUseManualLoader.
(WebKit::NetscapePlugin::initialize):
Get the mode from parameters.isFullFramePlugin instead.
(WebKit::NetscapePlugin::manualStreamDidReceiveResponse):
(WebKit::NetscapePlugin::manualStreamDidReceiveData):
(WebKit::NetscapePlugin::manualStreamDidFinishLoading):
(WebKit::NetscapePlugin::manualStreamDidFail):
Rename m_loadManually to m_shouldUseManualLoader.
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
Rename m_loadManually to m_shouldUseManualLoader.
* WebProcess/Plugins/Plugin.cpp:
(WebKit::Plugin::Parameters::encode):
(WebKit::Plugin::Parameters::decode):
* WebProcess/Plugins/Plugin.h:
(Parameters):
Add an extra isFullFramePlugin parameter, and rename loadManually to shouldUseManualLoader.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
Initialize m_frameCameFromPageCache.
(WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
Set m_frameCameFromPageCache to true.
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
Set m_frameCameFromPageCache to false.
(WebKit::WebFrameLoaderClient::createPlugin):
Initialize isFullFramePlugin and shouldUseManualLoader.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114295
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-16 Anders Carlsson <andersca@apple.com>
+
+ Nightly Back/Forward no longer calls plug-in's NPP_NewStream
+ https://bugs.webkit.org/show_bug.cgi?id=83805
+ <rdar://problem/11238748>
+
+ Reviewed by Simon Fraser.
+
+ When a page with a full-frame plug-in is restored from the page cache, it needs to re-fetch the plug-in stream.
+
+ Fix this by breaking the assumption that a plug-in will always get its data from WebCore if it's a full-frame plug-in;
+ instead it only get its data from WebCore if it's a full-frame plug-in that's not being restored from the page cache.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::NetscapePlugin):
+ Rename m_loadManually to m_shouldUseManualLoader.
+
+ (WebKit::NetscapePlugin::initialize):
+ Get the mode from parameters.isFullFramePlugin instead.
+
+ (WebKit::NetscapePlugin::manualStreamDidReceiveResponse):
+ (WebKit::NetscapePlugin::manualStreamDidReceiveData):
+ (WebKit::NetscapePlugin::manualStreamDidFinishLoading):
+ (WebKit::NetscapePlugin::manualStreamDidFail):
+ Rename m_loadManually to m_shouldUseManualLoader.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ Rename m_loadManually to m_shouldUseManualLoader.
+
+ * WebProcess/Plugins/Plugin.cpp:
+ (WebKit::Plugin::Parameters::encode):
+ (WebKit::Plugin::Parameters::decode):
+ * WebProcess/Plugins/Plugin.h:
+ (Parameters):
+ Add an extra isFullFramePlugin parameter, and rename loadManually to shouldUseManualLoader.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
+ Initialize m_frameCameFromPageCache.
+
+ (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
+ Set m_frameCameFromPageCache to true.
+
+ (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
+ Set m_frameCameFromPageCache to false.
+
+ (WebKit::WebFrameLoaderClient::createPlugin):
+ Initialize isFullFramePlugin and shouldUseManualLoader.
+
2012-04-16 Alexey Proskuryakov <ap@apple.com>
EndPrinting message should be sent synchronously when printing was initiated from DOM.
#endif
, m_isTransparent(false)
, m_inNPPNew(false)
- , m_loadManually(false)
+ , m_shouldUseManualLoader(false)
, m_nextTimerID(0)
#if PLATFORM(MAC)
, m_drawingModel(static_cast<NPDrawingModel>(-1))
bool NetscapePlugin::initialize(const Parameters& parameters)
{
- uint16_t mode = parameters.loadManually ? NP_FULL : NP_EMBED;
+ uint16_t mode = parameters.isFullFramePlugin ? NP_FULL : NP_EMBED;
- m_loadManually = parameters.loadManually;
+ m_shouldUseManualLoader = parameters.shouldUseManualLoader;
CString mimeTypeCString = parameters.mimeType.utf8();
}
// Load the src URL if needed.
- if (!parameters.loadManually && !parameters.url.isEmpty() && shouldLoadSrcURL())
+ if (!parameters.shouldUseManualLoader && !parameters.url.isEmpty() && shouldLoadSrcURL())
loadURL("GET", parameters.url.string(), String(), HTTPHeaderMap(), Vector<uint8_t>(), false, 0);
return true;
const String& mimeType, const String& headers, const String& /* suggestedFileName */)
{
ASSERT(m_isStarted);
- ASSERT(m_loadManually);
+ ASSERT(m_shouldUseManualLoader);
ASSERT(!m_manualStream);
m_manualStream = NetscapePluginStream::create(this, 0, responseURL.string(), false, 0);
void NetscapePlugin::manualStreamDidReceiveData(const char* bytes, int length)
{
ASSERT(m_isStarted);
- ASSERT(m_loadManually);
+ ASSERT(m_shouldUseManualLoader);
ASSERT(m_manualStream);
m_manualStream->didReceiveData(bytes, length);
void NetscapePlugin::manualStreamDidFinishLoading()
{
ASSERT(m_isStarted);
- ASSERT(m_loadManually);
+ ASSERT(m_shouldUseManualLoader);
ASSERT(m_manualStream);
m_manualStream->didFinishLoading();
void NetscapePlugin::manualStreamDidFail(bool wasCancelled)
{
ASSERT(m_isStarted);
- ASSERT(m_loadManually);
+ ASSERT(m_shouldUseManualLoader);
if (!m_manualStream)
return;
bool m_isWindowed;
bool m_isTransparent;
bool m_inNPPNew;
- bool m_loadManually;
+ bool m_shouldUseManualLoader;
RefPtr<NetscapePluginStream> m_manualStream;
Vector<bool, 8> m_popupEnabledStates;
{
// Load the src URL if needed.
m_sourceURL = parameters.url;
- if (!parameters.loadManually && !parameters.url.isEmpty())
+ if (!parameters.shouldUseManualLoader && !parameters.url.isEmpty())
controller()->loadURL(pdfDocumentRequestID, "GET", parameters.url.string(), String(), HTTPHeaderMap(), Vector<uint8_t>(), false);
return true;
encoder->encode(names);
encoder->encode(values);
encoder->encode(mimeType);
- encoder->encode(loadManually);
+ encoder->encode(isFullFramePlugin);
+ encoder->encode(shouldUseManualLoader);
#if PLATFORM(MAC)
encoder->encodeEnum(layerHostingMode);
#endif
return false;
if (!decoder->decode(parameters.mimeType))
return false;
- if (!decoder->decode(parameters.loadManually))
+ if (!decoder->decode(parameters.isFullFramePlugin))
+ return false;
+ if (!decoder->decode(parameters.shouldUseManualLoader))
return false;
#if PLATFORM(MAC)
if (!decoder->decodeEnum(parameters.layerHostingMode))
Vector<String> names;
Vector<String> values;
String mimeType;
- bool loadManually;
+ bool isFullFramePlugin;
+ bool shouldUseManualLoader;
#if PLATFORM(MAC)
LayerHostingMode layerHostingMode;
#endif
: m_frame(frame)
, m_hasSentResponseToPluginView(false)
, m_frameHasCustomRepresentation(false)
+ , m_frameCameFromPageCache(false)
{
}
const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForResponse(response);
+ m_frameCameFromPageCache = true;
}
void WebFrameLoaderClient::transitionToCommittedForNewPage()
const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForResponse(response);
+ m_frameCameFromPageCache = false;
m_frame->coreFrame()->createView(webPage->size(), backgroundColor, /* transparent */ false, IntSize(), shouldUseFixedLayout);
m_frame->coreFrame()->view()->setTransparent(!webPage->drawsBackground());
parameters.names = paramNames;
parameters.values = paramValues;
parameters.mimeType = mimeType;
- parameters.loadManually = loadManually;
+ parameters.isFullFramePlugin = loadManually;
+ parameters.shouldUseManualLoader = parameters.isFullFramePlugin && !m_frameCameFromPageCache;
#if PLATFORM(MAC)
parameters.layerHostingMode = webPage->layerHostingMode();
#endif
RefPtr<PluginView> m_pluginView;
bool m_hasSentResponseToPluginView;
bool m_frameHasCustomRepresentation;
+ bool m_frameCameFromPageCache;
};
} // namespace WebKit